Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Malicious user can perform a permanent DoS to the AuctionDemo::claimAuction function by consuming all transaction gas #1029

Closed
c4-submissions opened this issue Nov 11, 2023 · 4 comments
Labels
3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working duplicate-734 edited-by-warden partial-50 Incomplete articulation of vulnerability; eligible for partial credit only (50%)

Comments

@c4-submissions
Copy link
Contributor

c4-submissions commented Nov 11, 2023

Lines of code

https://github.com/code-423n4/2023-10-nextgen/blob/8b518196629faa37eae39736837b24926fd3c07c/hardhat/smart-contracts/AuctionDemo.sol#L116

Vulnerability details

Impact

The AuctionDemo::claimAuction will become permanently bricked, which means that all non-winning bids that were placed while the auction was active will not be able to be refunded, the Ether from the winning bid will not be able to be sent to the contract owner, and the auction winner will not be able to receive his NFT.

Proof of Concept

Let's take the following example:

  1. A new auction starts
  2. Just after it starts, a malicious user places a dust amount bid on it, through a contract that loops endlessly in its receive function
  3. After that, the auction goes on as normal, users place bids back and forth and everything seems to be fine
  4. The auction comes to an end
  5. The auction winner proceeds to call the AuctionDemo::claimAuction function in order to claim the NFT that they just won.
  6. Unfortunately for him though, the function reverts, since the block gas limit was reached, due to the endless loop inside the receive function of the malicious bidder contract. And the function will keep on reverting, no matter how many times it gets called.

Please note: In this example, the malicious bidder is the first one to place a bid, but this is not strictly necessary. The malicious bid can be placed at any time during the auction, as long as it is not the winning bid (since the Ether from that one gets sent to the contract owner instead of being refunded). The provided example is just the worst-case scenario, where the attacker performs the exploit in the cheapest way possible.

Tools Used

Manual Review

Recommended Mitigation Steps

Add a gas cap to the refund call.

Assessed type

DoS

@c4-submissions c4-submissions added 3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working labels Nov 11, 2023
c4-submissions added a commit that referenced this issue Nov 11, 2023
@code4rena-admin code4rena-admin changed the title Malicious user can perform a permanent DoS to the AuctionDemo::participateToAuction function by consuming all transaction gas Malicious user can perform a permanent DoS to the AuctionDemo::claimAuction function by consuming all transaction gas Nov 12, 2023
@c4-pre-sort
Copy link

141345 marked the issue as duplicate of #486

@c4-judge
Copy link

c4-judge commented Dec 1, 2023

alex-ppg marked the issue as not a duplicate

@c4-judge c4-judge reopened this Dec 1, 2023
@c4-judge
Copy link

c4-judge commented Dec 1, 2023

alex-ppg marked the issue as duplicate of #1782

@c4-judge
Copy link

c4-judge commented Dec 8, 2023

alex-ppg marked the issue as partial-50

@c4-judge c4-judge added the partial-50 Incomplete articulation of vulnerability; eligible for partial credit only (50%) label Dec 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working duplicate-734 edited-by-warden partial-50 Incomplete articulation of vulnerability; eligible for partial credit only (50%)
Projects
None yet
Development

No branches or pull requests

4 participants