DatingDapp

First Flight #33
Beginner FriendlyFoundrySolidityNFT
100 EXP
View results
Submission Details
Severity: high
Invalid

Unauthorized Transaction Approval Vulnerability

Summary

The MultiSig::approveTransaction function contains a critical vulnerability that allows unauthorized approvals for transactions. Due to the lack of validation for owner2, any external account can approve transactions on their behalf, bypassing the intended multi-signature security model.

Vulnerability Details

The MultiSig::approveTransaction function correctly verifies that msg.sender is owner1 before allowing approval.

However, there is no verification that msg.sender is owner2 when approving on behalf of owner2.

This allows any external account to approve transactions for owner2, leading to unauthorized approvals and potential loss of funds.

Impact

A malicious actor can approve transactions on behalf of owner2, leading to financial losses or unauthorized contract state changes.

Tools Used

. Foundry

Recommendations

To mitigate this issue, add an explicit check to verify that msg.sender is owner2 before allowing the approval:

function approveTransaction(uint256 _txId) external onlyOwners {
require(_txId < transactions.length, "Invalid transaction ID");
Transaction storage txn = transactions[_txId];
require(!txn.executed, "Transaction already executed");
if (msg.sender == owner1) {
if (txn.approvedByOwner1) revert AlreadyApproved();
txn.approvedByOwner1 = true;
} else
+ if (msg.sender == owner2) { // Ensure only owner2 can approve for themselves
if (txn.approvedByOwner2) revert AlreadyApproved();
txn.approvedByOwner2 = true;
+ } else {
+ revert("Unauthorized approver");
}
emit TransactionApproved(_txId, msg.sender);
}
Updates

Appeal created

n0kto Lead Judge 7 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.