vault balance not updated in withdrawReserves()
The withdrawReserves() function does not update the vault balance after transferring reserves out, leading to an incorrect exchange rate calculation. This could impact many funding-related functions.
Originally disclosed on Sherlock
Source: https://github.com/sherlock-audit/2023-06-dodo-judging/issues/247
Found by
Protocol Team
Vulnerability Detail
Impact
This is a critical bug, will cause wrong exchange rate calculation, which will impact almost all the funding related functions.
Tool Used
Manual Review
Recommandation
update vault balance in withdrawReserves()
Discussion
hrishibhat
Please note: This issue is not part of the contest submissions and is not eligible for contest rewards.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely, the withdrawReserves() function does not update the vault's internal balance after transferring reserves.
Impact
This could cause incorrect exchange rate calculations, impacting almost all funding-related functions.
What the attacker needed
None
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
In a smart contract, a vault holds funds and tracks balances. When reserves are withdrawn, the contract should update its internal record of how much it holds. Here, it fails to do so, so the recorded balance stays too high, making the exchange rate wrong and affecting other functions that rely on it.
What is Smart contracts?
Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.