Skip to content
Business logic Audit finding Intermediate

FurnaceP1.setRatio will work incorrectly after call when frozen

The setRatio function in FurnaceP1 updates the ratio even when the melt call fails due to the contract being frozen, leaving lastPayout and lastPayoutBal stale. After unfreezing, the melting rate could be higher than intended because the payout variables were not updated.

rvierdiiev Follow

Originally disclosed on Code4rena

Submitted by rvierdiiev

FurnaceP1.setRatio will not update lastPayout when called in frozen state, which means that after component will be unfrozen, melting will be incorrect.

Proof of Concept

melt function should burn some amount of tokens from lastPayoutBal. It depends of lastPayout and ratio variables. The more time has passed, the more tokens will be burnt.

When setRatio function is called, then melt function is tried to be executed, because new ratio is provided and it should not be used for previous time ranges. In case if everything is ok, then lastPayout and lastPayoutBal will be updated, so it’s safe to update ratio now. But it’s possible that melt function will revert in case if notFrozen modifier is not passed. As result lastPayout and lastPayoutBal will not be updated, but ratio will be. Because of that, when Furnace will be unfrozen, then melting rate can be much more, then it should be, because lastPayout wasn’t updated.

Tools Used

VsCode

Recommended Mitigation Steps

In case of catch case, you can update lastPayout and lastPayoutBal.

tbrent (Reserve) confirmed

Reserve mitigated:

Update payout variables if melt fails during setRatio. PR: https://github.com/reserve-protocol/protocol/pull/885

Status: Mitigation error. Full details in report from 0xA5DF - and also shared below in the Mitigation Review section.


The original report as published on Code4rena, by rvierdiiev. 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 setRatio function updates the ratio without ensuring that lastPayout and lastPayoutBal are updated when the melt call reverts due to the frozen state.

Impact

After unfreezing, the melting rate could be higher than intended, potentially burning more tokens than expected.

What the attacker needed

Contract is frozen; setRatio is called

The fix

The mitigation was to update payout variables if melt fails during setRatio, but the mitigation had an error according to the report.

How it was found

  1. Call setRatio while the contract is frozen, causing melt to revert.
  2. Observe that ratio is updated but lastPayout and lastPayoutBal remain unchanged.
  3. Unfreeze the contract and call melt; the melting rate is higher than expected.

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.

This is a smart contract bug where a function that changes a rate also tries to update some tracking variables, but if the contract is paused (frozen), that update is skipped while the rate still changes. Later, when unpaused, the contract uses old tracking data with the new rate, causing incorrect calculations.

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 rvierdiiev

View all

72 more disclosed reports, best first.

More from Reserve Core

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.