Sparkn

CodeFox Inc.
DeFiFoundryProxy
15,000 USDC
View results
Submission Details
Severity: high

Unchecked external call - `Distributor.sol`

Summary

An attacker could front-run a legitimate distribute() call.

Vulnerability

distribute() does not check that the caller is authorized. An attacker could watch for a valid call and then submit their own first.

For example, they could create a contract:

contract Attacker {
function drain(Distributor d) external {
d.distribute{value: 0}(...);
}
}

And front-run the legit call and drain the funds.

Impact

Attacker could steal the full prize pool.

Tools Used

Manual

Recommendations

Use a commit-reveal scheme or require an authorized address:

address public authorized;
modifier onlyAuthorized() {
require(msg.sender == authorized, "Not authorized");
_;
}
function distribute() external onlyAuthorized {
//...
}

Support

FAQs

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