Skip to content
Business logic Audit finding Intermediate

traceurl - miss updating pool's token balance after finishLiquidation()

The finishLiquidation() function in D3VaultLiquidation.sol fails to update the pool's token balance after a liquidation, causing a mismatch between the recorded balance and the actual token balance. This could lead to serious problems, though the specific exploit is not detailed.

Protocol Team Follow

Originally disclosed on Sherlock

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

Found by

Protocol Team tracerul

high

Summary

In D3Liquidation's finishLiquidation() function, update pool's token balance is missing.

Vulnerability Detail

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

Impact

After finishLiquidation, there will be unequally of pool's token balance record and IERC20(token).balanceOf(pool), which will causing serious problems.

Tool Used

Manual Review

Recommandation

Call updateReserveByVault after pool transfer token to vault

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 finishLiquidation() function transfers tokens without calling the internal accounting function to update the pool's recorded reserve balance.

What the attacker needed

None

The fix

The fix is to call updateReserveByVault after the pool transfers tokens to the vault.

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, the pool keeps a record of how many tokens it holds. When a liquidation finishes, the actual token balance changes, but the record is not updated. This mismatch can cause the pool to behave incorrectly, for example by allowing users to withdraw more than they should.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

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.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.