Skip to content
DoS Audit finding Intermediate

It might not be possible to applyRewards() , if an amount received is less than 0.05 eth

The applyRewards function fails when the amount of ETH received is below the minimum stake amount required by SafEth, causing the reward reinvestment to revert. This could disrupt the bi-weekly reward flow, especially in early stages or low-reward conditions.

m_Rassska Follow

Originally disclosed on Code4rena

Submitted by m_Rassska

  • Upon claiming Votium rewards, applyRewards() is intended to be invoked bi-weekly in order to exchange the tokens for eth and put the eth received back into the strategies. Based on the current ratio it either stakes the amount into safETH or obtains some CVX by selling eth on Curve and then locks them to get vlCVX.

    •  uint256 safEthRatio = (safEthTvl * 1e18) / totalTvl;
       if (safEthRatio < ratio) {
           ISafEth(SAF_ETH_ADDRESS).stake{value: amount}(0);
       } else {
           votiumStrategy.depositRewards{value: amount}(amount);
       }
      
  • Let’s say the safEthRatio < ratio, which triggers ISafEth(SAF_ETH_ADDRESS).stake{value: amount} being invoked. And if the amount < ISafEth(SAF_ETH_ADDRESS).minAmount. The whole re-investing strategy collapses.

  • As of Sep. 2023, the Votium rewards are 0,000016 eth for 1 vlCVX per round, it means, we need at least 3125 vlCVX being delegated to the Votium in order to pass the threshold.

Impact

  • This could backfire in early stages or during certain market conditions, where the amount of vlCVX hold by afETH is not enough to generate 0.05 eth bi-weekly. Basically, that forces to flows that are inconsistent with the main re-investment flow proposed by Asymmetry, which ultimately could result in theft as demonstrated in the issue #15.

Recommended Mitigation Steps

  • Short term:

    • Wrapp IAfEth(manager).depositRewards into the try/catch block. And if one of the following conditions arises:

      • The min safETH deposit amount is not reached

      • Chainlink price feed could not be validated

      • Low-level call which sends fees fails just simply invoke VotiumStrategy.depositRewards().

        if (address(manager) == address(0)) {
          depositRewards(ethReceived);
        } else {
          try IAfEth(manager).depositRewards{value: ethReceived}(ethReceived) {}
          catch {depositRewards(ethReceived);}
        }
        
  • Long term: N/A

elmutt (Asymmetry) commented:

Nice find. At first glance it doesn’t seem to matter but when you pointed out out early market conditions resulting in less rewards it makes total sense that it will be a problem we will likely encounter.

m_Rassska (Warden) commented:

The reward threshold defined here should be changed to:

$\frac{0,000016} {ratio} * \sum_{i = 0}^{lockedBalances.length - 1} lockedBalances[i]$

Meaning that:

  • if the ratio = 1e18 => the rewards > 0,05eth
  • if the ratio = 5e17 => the rewards > 0,1eth

elmutt (Asymmetry) confirmed and commented:

Thanks! After discussing internally we decided to solve this by calling setMinAmount(0) on the safEth contract.

Done here: https://etherscan.io/tx/0xb024f513adb9a8fa3bbceceeb6c11d2a1bc9c5e3545dfa76f6d6e0c8bdaf38a3

Asymmetry mitigated:

No code changes needed. We removed the minimum stake amount from SafEth, as noted above.

Status: Mitigation confirmed. Full details in reports from m_Rassska, adriro, and d3e4.


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

This could backfire in early stages or during certain market conditions, where the amount of vlCVX held by afETH is not enough to generate 0.05 ETH bi-weekly, forcing flows inconsistent with the main re-investment flow and potentially leading to theft as demonstrated in issue #15.

What the attacker needed

Low reward amount; safEthRatio < ratio

The fix

The minimum stake amount was removed from SafEth by calling setMinAmount(0), as confirmed by the team.

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 tries to reinvest rewards automatically, but if the reward is too small (below a minimum), the reinvestment fails and the whole process stops. This means small rewards cannot be processed, which could break the system's intended operation.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

More by m_Rassska

View all

2 more disclosed reports, best first.

More from Asymmetry Finance afETH Invitational

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.