Badger-Vested-Aura contest - tabish's results

Bringing BTC to DeFi

General Information

Platform: Code4rena

Start Date: 15/06/2022

Pot Size: $30,000 USDC

Total HM: 5

Participants: 55

Period: 3 days

Judge: Jack the Pug

Id: 138

League: ETH

BadgerDAO

Findings Distribution

Researcher Performance

Rank: 8/55

Findings: 1

Award: $1,723.59

🌟 Selected for report: 0

🚀 Solo Findings: 0

Findings Information

🌟 Selected for report: PumpkingWok

Also found by: kirk-baird, rfa, tabish, unforgiven

Labels

bug
duplicate
3 (High Risk)
sponsor confirmed
valid

Awards

1723.5939 USDC - $1,723.59

External Links

Lines of code

https://github.com/Badger-Finance/vested-aura/blob/v0.0.2/contracts/MyStrategy.sol#L220-L228

Vulnerability details

Impact

Detailed description of the impact of this finding.

getReward(address account) function of Aura Locker is an external function therefore can be called by anyone by passing in the address of strategy and transferring the rewards to the strategy. harvest function takes into account the initial balance of reward token before claiming reward and calculating auraBalEarned, therefore not taking into account any rewards which were transferred to the strategy directly.

https://github.com/Badger-Finance/vested-aura/blob/v0.0.2/contracts/MyStrategy.sol#L220-L228

uint256 auraBalBalanceBefore = AURABAL.balanceOf(address(this)); // Claim auraBAL from locker LOCKER.getReward(address(this)); harvested = new TokenAmount[](1); harvested[0].token = address(AURA); uint256 auraBalEarned = AURABAL.balanceOf(address(this)).sub(auraBalBalanceBefore);

Proof of Concept

Provide direct links to all referenced code in GitHub. Add screenshots, logs, or any other relevant proof that illustrates the concept.

Attack vector -

  • random user, calls getReward(address of strategy) and reward token (auraBal) get transferred to strategy
  • harvest function does not take into account the transferred reward token (auraBal) and just processes the newly claimed rewards.

Also there is no method to move the reward token (auraBAL) without an upgrade as it is a protected token https://github.com/Badger-Finance/vested-aura/blob/d504684e4f9b56660a9e6c6dfb839dcebac3c174/contracts/MyStrategy.sol#L164

harvest should take into account all the gained auraBAL before autocompounding it.

#0 - GalloDaSballo

2022-06-17T15:45:55Z

Agree that the reward token can remain stuck, will need to mitigate by instead of using the difference of auraBAL, we'll harvest the entire amount

#1 - KenzoAgada

2022-06-21T13:00:02Z

Duplicate of #129

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