Skip to content
Smart contracts Audit finding Intermediate

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.

Protocol Team Follow

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2023-06-dodo-judging/issues/247

Found by

Protocol Team

Vulnerability Detail

https://github.com/sherlock-audit/2023-06-dodo/blob/a8d30e611acc9762029f8756d6a5b81825faf348/new-dodo-v3/contracts/DODOV3MM/D3Vault/D3Vault.sol#L178-L186

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.

The original report as published on Sherlock, by Protocol Team. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

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.

More by Protocol Team

View all

8 more disclosed reports, best first.

More from DODO V3 update

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Smart contract vulnerabilities

The lesson behind this report.

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.