Skip to content
Business logic Audit finding Advanced

Cancel should allow to cancel the proposal of t

The cancel function refuses to cancel proposals that are in the Expired state, even though that state can change if the timelock's grace period is later extended by an upgrade. An attacker could then revive an expired proposal and execute it, sending funds to a compromised destination.

OxG0P1 Follow

Originally disclosed on Immunefi

Informational View original
  • Disclosed after under an hour

31284 - [SC - Insight] cancel should allow to cancel the proposal of t...

Submitted on May 16th 2024 at 11:26:54 UTC by @OxG0P1 for Boost | Alchemix

Report ID: #31284

Report type: Smart Contract

Report severity: Insight

Target: https://github.com/alchemix-finance/alchemix-v2-dao/blob/main/src/AlchemixGovernor.sol

Impacts:

  • Direct theft of any user funds, whether at-rest or in-motion, other than unclaimed yield

Description

Brief/Intro

cancel() does not allow to cancel proposals which are Expired.

Vulnerability Details

The state of being "Expired" depends on the GRACE_PERIOD of the timelock, and the GRACE_PERIOD may be altered due to upgrades. Once the GRACE_PERIOD of the timelock is changed, the state of the proposal may also be altered, so "Expired" is not necessarily the final state.

Impact Details

Funds in the Timelock will be lost.

References

https://github.com/alchemix-finance/alchemix-v2-dao/blob/f1007439ad3a32e412468c4c42f62f676822dc1f/src/governance/L2Governor.sol#L445-L448 https://github.com/alchemix-finance/alchemix-v2-dao/blob/f1007439ad3a32e412468c4c42f62f676822dc1f/src/governance/L2Governor.sol#L625-L627

Proof of Concept

Consider the following scenario:

Alice submits Proposal A to stake 20,000 ETH to a DeFi protocol, and it successfully passes. However, it cannot be executed because there are now only 15,000 ETH in the timelock (due to other proposals consuming the funds), and then Proposal A expires.

Subsequently, the DeFi protocol gets hacked or rug-pulled.

Meanwhile, Proposal B is about to be executed to upgrade the timelock and extend the GRACE_PERIOD (for example, by 7 days). Alice wants to cancel Proposal A, but she cannot because it is in the "Expired" state.

Proposal B is then executed, causing Proposal A to change from "Expired" to "Queued." A malicious user sends 5,000 ETH to the timelock and immediately executes Proposal A, sending 20,000 ETH to the hacked protocol.

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

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 cancel check treats the Expired state as final and blocks cancellation, while the Expired state actually depends on a mutable grace period.

Impact

Funds held in the timelock could be sent to a compromised protocol, resulting in loss of those funds.

What the attacker needed

A passed proposal that later expires; a queued timelock upgrade extending grace period; attacker can top up the timelock

How it was found

  1. Alice submits a proposal to send funds to a DeFi protocol and it passes.
  2. The proposal cannot be executed because the timelock holds too little, so it expires.
  3. A separate proposal is queued to upgrade the timelock and extend the grace period.
  4. Alice tries to cancel the expired proposal but cannot because of its state.
  5. The upgrade executes, moving the old proposal from Expired back to Queued.
  6. A malicious user tops up the timelock and executes the revived proposal.

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 governance proposal is a vote to make the system do something, like send money. Once a proposal sits too long without being run, it is marked 'expired' and the cancel button stops working on it. But if the waiting period is later lengthened, that same proposal can become runnable again, and someone can trigger it before the owner can cancel it.

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 OxG0P1

View all

4 more disclosed reports, best first.

More from Alchemix

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.