You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Early Withdrawals Undercharge Penalty Fees When Debond Fee <10 BPS
Summary
The integer division in PodUnwrapLocker.earlyWithdraw's penalty calculation will cause undercollection for early withdrawals when debond fees are set below 10 basis points. The protocol loses expected penalty revenue as users avoid the 10% surcharge due to truncation errors in basis point calculations.
Furthermore, there is no other way to update DEN and _fees. The flawed calculation _debondFee + _debondFee / 10 fails to properly apply the intended 10% penalty surcharge when the base _debondFee is set below 10 bps (0.1%). This results in early withdrawals paying only the base debond fee without the protocol-specified penalty surcharge.
Internal Pre-conditions
Protocol sets debond fee to 5 bps (0.05% as example) through governance
DEN constant of 10000 basis points is hardcoded in system
Penalty calculation uses integer division for 10% surcharge
External Pre-conditions
User locks $100,000 (as example) worth of assets in PodUnwrapLocker
Market conditions incentivize early withdrawal (e.g., price drop)
Protocol operates with sub-10 bps debond fee
Attack Path
Withdraw $100,000 during 5 bps fee period:
Correct penalty: 5 bps + 0.5 bps = 5.5 bps ($550)
Actual penalty: 5 bps ($500)
Attacker repeats with 10 withdrawals of $1M each:
Protocol loses 0.5 bps × $10M = $5000
Protocol processes 1000 withdrawals at 5 bps:
Total loss: 0.5 bps × $100M = $50,000
Impact
Protocol loses 9.09% of expected penalty revenue (0.5/5.5) per qualifying withdrawal. For $1B in early withdrawals at 5 bps:
Expected penalty: $1B × 0.055% = $550,000
Actual penalty: $1B × 0.05% = $500,000
Direct loss: $50,000 (9.09% of expected fees)
PoC
No response
Mitigation
Modify the penalty calculation to apply the 10% surcharge before division:
This preserves precision by multiplying _debondFee by 11 (equivalent to 110%) before division, ensuring the 10% penalty is properly applied regardless of the debond fee value.
The text was updated successfully, but these errors were encountered:
Crazy Cyan Worm
Medium
Early Withdrawals Undercharge Penalty Fees When Debond Fee <10 BPS
Summary
The integer division in
PodUnwrapLocker.earlyWithdraw
's penalty calculation will cause undercollection for early withdrawals when debond fees are set below 10 basis points. The protocol loses expected penalty revenue as users avoid the 10% surcharge due to truncation errors in basis point calculations.Root Cause
In
PodUnwrapLocker.earlyWithdraw
([PodUnwrapLocker.sol#L122-L139](https://www.notion.so/oioii1999/PodUnwrapLocker-earlyWithdraw-L122-L139-19cabc17a5a68014b5b1fbae49683f10)
) the penalty calculation uses integer division that truncates fractional values when_debondFee < 10
. This occurs because the additional 10% penalty (_debondFee / 10
) rounds to zero for values below 10 basis points, combined with theDEN
constant being defined as 10000 in[DecentralizedIndex.sol#L](https://www.notion.so/oioii1999/PodUnwrapLocker-earlyWithdraw-L122-L139-19cabc17a5a68014b5b1fbae49683f10)20
.while in the function
__DecentralizedIndex_init
of the contractDecentralizedIndex
:Furthermore, there is no other way to update
DEN
and_fees
. The flawed calculation_debondFee + _debondFee / 10
fails to properly apply the intended 10% penalty surcharge when the base_debondFee
is set below 10 bps (0.1%). This results in early withdrawals paying only the base debond fee without the protocol-specified penalty surcharge.Internal Pre-conditions
DEN
constant of 10000 basis points is hardcoded in systemExternal Pre-conditions
Attack Path
Impact
Protocol loses 9.09% of expected penalty revenue (0.5/5.5) per qualifying withdrawal. For $1B in early withdrawals at 5 bps:
PoC
No response
Mitigation
Modify the penalty calculation to apply the 10% surcharge before division:
This preserves precision by multiplying
_debondFee
by 11 (equivalent to 110%) before division, ensuring the 10% penalty is properly applied regardless of the debond fee value.The text was updated successfully, but these errors were encountered: