Badger Citadel contest - harleythedog's results

Bringing BTC to DeFi

General Information

Platform: Code4rena

Start Date: 04/02/2022

Pot Size: $30,000 USDC

Total HM: 3

Participants: 37

Period: 3 days

Judge: leastwood

Id: 84

League: ETH

BadgerDAO

Findings Distribution

Researcher Performance

Rank: 14/37

Findings: 1

Award: $625.19

🌟 Selected for report: 0

🚀 Solo Findings: 0

Findings Information

🌟 Selected for report: WatchPug

Also found by: 0x1f8b, Czar102, cccz, cmichel, gellej, harleythedog, hickuphh3, hyh, pauliax, sirhashalot

Labels

bug
duplicate
2 (Med Risk)

Awards

625.1882 USDC - $625.19

External Links

Lines of code

https://github.com/code-423n4/2022-02-badger-citadel/blob/84596551d62f243d13fcb2d486346dde08002f7b/contracts/TokenSaleUpgradeable.sol#L254

Vulnerability details

Impact

The admins are the only ones that are able to finalize the sale. Throughout the token buying process, the admins are transferred tokenIn tokens, and the users are expecting to be able to get the corresponding tokenOut tokens once the sale is finalized. The admin can grief the users by never calling finalize, and then the users will not be able to claim their tokens. This isn't necessarily a gain for the admins, but the ability for the admins to take tokenIn tokens and the users never receive their corresponding tokenOut tokens is an issue. Even though the admins may be well intentioned, it is best to mitigate ways that the admins can negatively affect the users, and this is a major way the admins can grief the users.

Proof of Concept

See code for finalize here. Notice that it is only callable by an admin.

Tools Used

Inspection.

There should be a few extra logic checks in the finalize function (e.g. making sure that a predetermined amount of tokens have been purchased). Then, the finalize function should have the onlyOwner modifier removed, as then there would be no way for the admins to grief users out of all of the tokenOut tokens that they are owed.

#0 - GalloDaSballo

2022-02-10T02:19:06Z

I agree that finalize should be permissioneless, as for the grief, the whole idea behind finalize is that it will be called by the owner right after they sent the tokenOut

Not sure about severity but I think the finding has merit

#1 - 0xleastwood

2022-03-14T12:01:56Z

Duplicate of #50

#2 - 0xleastwood

2022-03-16T12:26:22Z

Duplicate of #61

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax © 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter