Skip to content
Business logic Audit finding Intermediate

StabilizerNode.stabilize() should update lastTracking as well to avoid an unnecessary incentive.

The stabilize() function refreshes pool tracking data but does not update the lastTracking timestamp, so the separate trackPool() function can still pay its tracking incentive immediately afterwards. An attacker could repeatedly call stabilize() and then trackPool() to collect incentives more often than intended.

hansfriese Follow

Originally disclosed on Code4rena

Submitted by hansfriese

StabilizerNode.stabilize() should update lastTracking as well to avoid an unnecessary incentive.

Current logic pays unnecessary incentives to track the pool.

Proof of Concept

trackPool() pays an incentive per trackingBackoff in order to ensure pool consistency.

File: 2023-02-malt\contracts\StabilityPod\StabilizerNode.sol
248:   function trackPool() external onlyActive {
249:     require(block.timestamp >= lastTracking + trackingBackoff, "Too early"); //@audit lastTracking should be updated in stabilize() also
250:     bool success = maltDataLab.trackPool();
251:     require(success, "Too early");
252:     malt.mint(msg.sender, (trackingIncentive * (10**malt.decimals())) / 100); // div 100 because units are cents
253:     lastTracking = block.timestamp;
254:     emit Tracking();
255:   }

And stabilize() tracks the pool as well and we don’t need to pay an incentive unnecessarily in trackPool() if stabilize() was called recently.

For that, we can update lastTracking in stabilize().

Recommended Mitigation Steps

Recommend updating lastTracking in stabilize().

  function stabilize() external nonReentrant onlyEOA onlyActive whenNotPaused {
    // Ensure data consistency
    maltDataLab.trackPool();
    lastTracking = block.timestamp; //++++++++++++++++

    ...

0xScotch (Malt) confirmed


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

Impact

Unnecessary tracking incentives could be paid out more often than the intended backoff period allows, draining funds from the contract.

What the attacker needed

Ability to call stabilize(); ability to call trackPool()

The fix

The lastTracking timestamp should be set to the current block time inside stabilize() so the incentive cooldown is reset; the report notes the project confirmed it.

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 pays a small reward to anyone who refreshes its pool data, but only once per waiting period. A second function also refreshes that data without resetting the timer, so the reward can be claimed again straight away. The fix is to reset the timer in both places.

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 hansfriese

View all

65 more disclosed reports, best first.

More from Malt Protocol - Versus 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.