Skip to content
Business logic Audit finding Intermediate

The check for value transfer success is made after the return statement in _withdrawFromYieldPool of LidoVault

The LidoVault contract's _withdrawFromYieldPool function returns before checking whether the value transfer succeeded, so a failed transfer does not revert the transaction. An attacker could withdraw without receiving funds, causing a loss to users.

pedroais Follow

Originally disclosed on Code4rena

Submitted by pedroais, also found by 0x52, 0xliumin, cccz, CertoraInc, fatherOfBlocks, GimelSec, hake, hickuphh3, hyh, IllIllI, isamjay, mtz, oyc_109, p4st13r4, peritoflores, rotcivegaf, sorrynotsorry, StErMi, tabish, WatchPug, z3s, 0x4non, 0xf15ers, berndartmueller, dipp, Dravee, MaratCerby, saian, simon135, sseefried, and TerrierLover

Users can lose their funds

Proof of Concept

LidoVault.sol#L142

The code checks transaction success after returning the transfer value and finishing execution. If the call fails the transaction won’t revert since require(sent, Errors.VTCOLLATERALWITHDRAW_INVALID); won’t execute.

Users will have withdrawn without getting their funds back.

Recommended Mitigation Steps

Return the function after the success check

sforman2000 (Sturdy) confirmed

iris112 (Sturdy) commented:

Fix the issue of return before require sturdyfi/code4rena-may-2022#9

hickuphh3 (judge) commented:

Issue is rather clear-cut.


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

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

The return statement is placed before the require check that verifies the success of the value transfer.

Impact

Users could lose their funds because a failed transfer does not revert, leaving them without their withdrawn amount.

What the attacker needed

None

The fix

The function should perform the success check before returning, so that a failed transfer reverts the transaction.

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, when you send funds, you must check that the send worked. Here, the code sends the funds and then immediately exits the function before checking if the send succeeded. So if the send fails, the contract still thinks the withdrawal is complete, and the user loses their money.

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 pedroais

View all

6 more disclosed reports, best first.

More from Sturdy contest

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.