Skip to content
Business logic Audit finding Intermediate

MAX SHORTFALL WITHDRAW limit on BTP extraction is not enforced

The sNote contract's function for extracting tokens to cover collateral shortfall allows the owner to withdraw up to 50% of the total BPT, but this limit is not enforced across multiple calls. An attacker (the owner) could call the function repeatedly to withdraw almost all BPT, increasing risk for stakers.

gellej Follow

Originally disclosed on Code4rena

Submitted by gellej, also found by gzeon

The function extractTokensForCollateralShortfall() allows the owner of the sNote contract to withdraw up to 50% of the total amount of BPT.

Presumably, this 50% limit is in place to prevent the owner from “rug-pulling” the sNote holders (or at least to give them a guarantee that their loss is limited to 50% of the underlying value).

However, this limit is easily circumvented as the function can simply be called a second, third and fourth time, to withdraw almost all of the BPT.

As the contract does not enforce this limit, the bug requires stakers to trust the governance to not withdraw more than 50% of the underlying collateral. This represents a higher risk for the stakers, which may also result in a larger discount on sNote wrt its BPT collateral (this is why I classified the bug as medium risk - users may lose value - not from an exploit, but from the lack of enforcing the 50% rule)

Proof of Concept

See above. The code affected is here: https://github.com/code-423n4/2022-01-notional/blob/main/contracts/sNOTE.sol#L100

Recommended Mitigation Steps

Rewrite the logic and enforce a limit during a time period - i.e. do not allow to withdraw over 50% per week (or any time period that is longer than the cooldown period, so that users have time to withdraw their collateral)

jeffywu (Notional) confirmed

pauliax (judge) commented:

Great find, 50% withdrawal limit can be bypassed by invoking the function multiple times.


The original report as published on Code4rena, by gellej. 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 contract enforces a 50% limit per call but does not track cumulative withdrawals over time, allowing repeated calls to bypass the intended cap.

Impact

The owner could withdraw almost all BPT, potentially causing losses for sNote holders and increasing the discount on sNote relative to its collateral.

What the attacker needed

Owner of sNote contract

The fix

The logic should be rewritten to enforce a limit over a time period, such as not allowing withdrawals over 50% per week, giving users time to withdraw.

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.

The sNote contract lets its owner take out some tokens to cover a shortfall, but it was supposed to be capped at half the total. However, the cap only applies to each individual withdrawal, so the owner can just call the function again and again to take out nearly everything. This means users who put their tokens in have to trust the owner not to abuse this, which is riskier than intended.

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 gellej

View all

1 more disclosed report, best first.

More from Notional 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.