Beatland Festival

First Flight #44
Beginner FriendlyFoundrySolidityNFT
100 EXP
View results
Submission Details
Impact: low
Likelihood: high
Invalid

`FestivalPass:withdraw` does not emit event when organizer withdraws funds

FestivalPass:withdraw does not emit event when organizer withdraws funds

Description

  • The owner can withdraw funds using the FestivalPass:withdraw function

  • The issue is no event is emitted. The event IFestivalPass:FundsWithdrawn exists, but FestivalPass does not implement it.

// Organizer withdraws ETH
function withdraw(address target) external onlyOwner {
@> payable(target).transfer(address(this).balance);
}

Risk

Likelihood:

  • This occurs every time FestivalPass:withdraw is called.

Impact:

  • External applications relying on the emission to detect suspicious withdraws would not function properly.

Proof of Concept

Place the following into FestivalPass.t.sol and expect it to fail on the vm.expectEmit()

event FundsWithdrawn(address indexed target, uint256 amount);
...
function test_Withdraw_Emit() public {
// User buys pass
uint256 GENERAL_PASS = 1;
vm.prank(user1);
festivalPass.buyPass{value: GENERAL_PRICE}(GENERAL_PASS);
uint256 expectedBalance = GENERAL_PRICE;
assertEq(address(festivalPass).balance, expectedBalance);
vm.prank(owner);
vm.expectEmit(true, true, false, true);
emit FundsWithdrawn(address(organizer), expectedBalance);
festivalPass.withdraw(organizer);
}

Recommended Mitigation

Place the following into FestivalPass.sol

// Organizer withdraws ETH
function withdraw(address target) external onlyOwner {
+ emit FundsWithdrawn(target, address(this).balance);
payable(target).transfer(address(this).balance);
}

See related issue: "IFestivalPass:FundsWithdrawn natspec is incorrect"

Updates

Lead Judging Commences

inallhonesty Lead Judge 29 days ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

Missing events / Events not properly configured

Informational. This protocol doesn't rely on events to function, they are just nice to have, but not mandatory.

Support

FAQs

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