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

claimAuction can be DoS'ed or abuse for gas-mining #293

Closed
c4-submissions opened this issue Nov 5, 2023 · 7 comments
Closed

claimAuction can be DoS'ed or abuse for gas-mining #293

c4-submissions opened this issue Nov 5, 2023 · 7 comments
Labels
3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working duplicate-734 partial-50 Incomplete articulation of vulnerability; eligible for partial credit only (50%) upgraded by judge Original issue severity upgraded from QA/Gas by judge

Comments

@c4-submissions
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2023-10-nextgen/blob/main/smart-contracts/AuctionDemo.sol#L104

Vulnerability details

Impact

claimAuction is called when auction ends by the highest bidder or admins (checked inside WinnerOrAdminRequired modifier). The caller pays for gas to refund everyone who was out-bid and to transfer NFT to the highest bidder. An attacker can DoS this function by creating multiple small bids from contract with recieve-fallback function to mine gas.

Description

For each user that needs to be refunded a call with value is made. Bids can be placed by contracts, and their receive-fallback can execute arbitrary code, including gas-mining operations.

This is a common anti-pattern when implementing auctions, described in SWC-128, more comprehensive example of "auction-like" contract with the same issue described here: https://consensys.github.io/smart-contract-best-practices/development-recommendations/general/external-calls/#favor-pull-over-push-for-external-calls.

This issue is different from issue found in bot report [H-01] Permanent DoS due to non-shrinking array usage in an unbounded loop: we show that refunding inside claim function is a bad practice and might also lead to DoS.

Tools Used

Manual analysis + bot report

Recommended Mitigation Steps

Use pull model for returning auction bids.

Assessed type

DoS

@c4-submissions c4-submissions added 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working labels Nov 5, 2023
c4-submissions added a commit that referenced this issue Nov 5, 2023
@c4-pre-sort
Copy link

141345 marked the issue as duplicate of #1632

@c4-pre-sort
Copy link

141345 marked the issue as duplicate of #843

@c4-pre-sort
Copy link

141345 marked the issue as duplicate of #486

@c4-judge
Copy link

c4-judge commented Dec 5, 2023

alex-ppg marked the issue as not a duplicate

@c4-judge c4-judge reopened this Dec 5, 2023
@c4-judge c4-judge closed this as completed Dec 5, 2023
@c4-judge
Copy link

c4-judge commented Dec 5, 2023

alex-ppg marked the issue as duplicate of #734

@c4-judge c4-judge added duplicate-734 partial-50 Incomplete articulation of vulnerability; eligible for partial credit only (50%) labels Dec 5, 2023
@c4-judge
Copy link

c4-judge commented Dec 8, 2023

alex-ppg marked the issue as partial-50

@c4-judge c4-judge added 3 (High Risk) Assets can be stolen/lost/compromised directly upgraded by judge Original issue severity upgraded from QA/Gas by judge and removed 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value labels Dec 9, 2023
@c4-judge
Copy link

c4-judge commented Dec 9, 2023

alex-ppg changed the severity to 3 (High Risk)

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 partial-50 Incomplete articulation of vulnerability; eligible for partial credit only (50%) upgraded by judge Original issue severity upgraded from QA/Gas by judge
Projects
None yet
Development

No branches or pull requests

3 participants