Skip to content
Business logic Audit finding Intermediate

Fees are taken on risk collateral

The withdrawal function charges a fee on the entire collateral deposited by risk users, not just on premiums and payouts. This could discourage risk users from providing collateral because fees may exceed their profits.

0x52 Follow

Originally disclosed on Code4rena

Submitted by 0x52

Fees are taken on funds deposited as collateral.

Proof of Concept

uint256 feeValue = calculateWithdrawalFeeValue(entitledShares, id);

In L226 of Vault.sol#withdraw the fee is taken on the entire collateral deposited by the risk users. This is problematic for two reasons. The first is that the collateral provided by the risk users will likely be many many times higher than the premium being paid by the hedge users. This will create a strong disincentive to use the protocol because it is likely a large portion of the profits will be taken by fees and the risk user may unexpectedly lose funds overall if premiums are too low.

The second issue is that this method of fees directly contradicts project documents which clearly indicate that fees are only taken on the premium and insurance payouts, not when risk users are receiving their collateral back.

Recommended Mitigation Steps

Fee calculations should be restructured to only take fees on premiums and insurance payouts.

MiguelBits (Y2K Finance) disputed

HickupHH3 (judge) commented:

Agree with the warden. If the withdrawal fee exceeds the premium paid, risk users are disincentivised to provide collateral.

The second issue is that this method of fees directly contradicts project documents which clearly indicate that fees are only taken on the premium and insurance payouts, not when risk users are receiving their collateral back.

Not sure if the warden is referring to the fee as the trading fee c in the article, but I would agree if it’s the case. Implementation isn’t according to spec. The actual fees charged might be more than expected.


The original report as published on Code4rena, by 0x52. 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

Likely the withdrawal fee is calculated on the full collateral amount rather than only on premiums and insurance payouts, contrary to the project's documentation.

Impact

Risk users could lose a large portion of their profits to fees and may even lose funds overall if premiums are too low, creating a strong disincentive to provide collateral.

What the attacker needed

Risk user provides collateral; risk user withdraws collateral

The fix

Fee calculations should be restructured to only take fees on premiums and insurance payouts.

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 this protocol, risk users put up collateral and hedge users pay premiums. The code takes a fee from the whole collateral when risk users withdraw, instead of only from the premiums and payouts. That means risk users might pay more in fees than they earn, so they may stop using the protocol.

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 0x52

View all

211 more disclosed reports, best first.

More from Y2k Finance 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.