Skip to content
Business logic Audit finding Intermediate

Debasing/rebasing periods can be decreased by 50% by a malicious actor

The debasing calculation rounds down the number of periods, and a malicious user can call the update function at a specific time to cause only one period to be counted instead of two, slowing the debase rate. This keeps the collateral factor low and harms the protocol.

000000 Follow

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2024-12-numa-audit-judging/issues/18

Found by

000000

Vulnerability Detail

Upon debasing, we have the following calculation:

Solidity
uint ndebase = ((blockTime - lastBlockTime) * debaseValue) / (deltaDebase);

If the time passed is less than 4320, we round down to 0 (debaseValue is 20 and deltaDebase is 24 hours). However, there is the following check to handle such round downs:

Solidity
                if (ndebase <= 0) {
                    // not enough time has passed to get some debase, so we reset our time reference
                    blockTime = lastBlockTime;
                }

It resets the time to the last block time before the update. However, this can still be abused by a malicious actor by instead rounding to 1. It can also happen during normal conditions by users simply interacting with the protocol at certain times.

Attack Path

  1. Malicious user calls VaultManager.getSynthScalingUpdate() or any other block time state updating function every $4320 * 2 - 1$ seconds
  2. The ndebase will equal $(4320 * 2 - 1) * 20 / 86400 = 1,9997685185$ which rounds down to 1
  3. Instead of 2 debasing periods, there will only be 1 which causes the protocol to debase much slower than supposed to, which would keep the CF low and cause huge issues for the protocol

Impact

Synthetics will derate slower than intended, which will keep the CF low as users are not incentivized to sell them

Mitigation

Refactor the formula

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

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 integer division in the debase calculation rounds down, and the check for zero does not account for rounding to one when nearly two periods have passed.

Impact

Synthetics will derate slower than intended, which could keep the collateral factor low and cause issues for the protocol.

What the attacker needed

Ability to call the update function; Timing calls precisely

The fix

The formula should be refactored to avoid rounding errors, for example by using a more precise calculation or accumulating remainders.

How it was found

  1. Call a function that updates the block time state, such as VaultManager.getSynthScalingUpdate(), every 4320 * 2 - 1 seconds.
  2. The calculated ndebase equals (4320 * 2 - 1) * 20 / 86400, which rounds down to 1.
  3. Only one debasing period is applied instead of two, slowing the debase rate.

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.

A smart contract periodically reduces the value of synthetic tokens (debasing) based on how much time has passed. The code calculates how many periods to apply by dividing elapsed time by a period length, but it rounds down. An attacker can time their calls so that almost two periods' worth of time is counted as only one, making the debasing happen more slowly 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 000000

View all

32 more disclosed reports, best first.

More from Numa

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.