Badger Citadel contest - remora's results

Bringing BTC to DeFi

General Information

Platform: Code4rena

Start Date: 14/04/2022

Pot Size: $75,000 USDC

Total HM: 8

Participants: 72

Period: 7 days

Judge: Jack the Pug

Total Solo HM: 2

Id: 110

League: ETH

BadgerDAO

Findings Distribution

Researcher Performance

Rank: 31/72

Findings: 2

Award: $275.64

🌟 Selected for report: 0

🚀 Solo Findings: 0

Findings Information

🌟 Selected for report: Ruhum

Also found by: 0xBug, 0xDjango, IllIllI, MaratCerby, TrungOre, danb, hyh, m9800, minhquanym, pedroais, remora, shenwilly

Labels

bug
duplicate
2 (Med Risk)

Awards

184.248 USDC - $184.25

External Links

Lines of code

https://github.com/code-423n4/2022-04-badger-citadel/blob/18f8c392b6fc303fe95602eba6303725023e53da/src/Funding.sol#L202-L216

Vulnerability details

Impact

Function getAmountOut(_assetAmountIn) fails to handle the case for funding.discount == 0

Proof of Concept

function getAmountOut(uint256 _assetAmountIn) public view returns (uint256 citadelAmount_) { uint256 citadelAmountWithoutDiscount = _assetAmountIn * citadelPriceInAsset; if (funding.discount > 0) { citadelAmount_ = (citadelAmountWithoutDiscount * MAX_BPS) / (MAX_BPS - funding.discount); } // @audit-issue // if `funding.discount == 0`, `citadelAmount_` will be returned with default initialized value (i.e 0) citadelAmount_ = citadelAmount_ / assetDecimalsNormalizationValue; }

Tools Used

Manual review

#0 - GalloDaSballo

2022-04-23T01:31:05Z

Yes, dup of many others

#1 - jack-the-pug

2022-05-29T07:10:56Z

Dup #149

  1. Comment is misleading for @param _minCitadelOut
  1. TREASURY_GOVERNANCE_ROLE is not used anywhere in the contract KnightingRound.sol and can be omitted.
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