Skip to content
Access control Audit finding Intermediate

Lack of access control on assertGovernanceApproved can cause funds to be locked

The assertGovernanceApproved function lacks access control, allowing anyone to call it with a victim's address and emergency flag set to true. This locks the victim's approved funds for the unlock period, preventing them from executing their governance decision.

shw Follow

Originally disclosed on Code4rena

Submitted by shw, also found by kirk-baird and pauliax

Lack of access control on the assertGovernanceApproved function of FlashGovernanceArbiter allows anyone to lock other users’ funds in the contract as long as the users have approved the contract to transfer flashGovernanceConfig.amount of flashGovernanceConfig.asset from them.

Proof of Concept

  1. Alice wants to execute a flash governance decision (e.g., disable to the protocol), so she first calls approve on the flashGovernanceConfig.asset to allow FlashGovernanceArbiter to transfer flashGovernanceConfig.amount of assets from her.
  2. An attacker Bob, who listens to the mempool, notices Alice’s approve transaction and decides to front-run it. He calls assertGovernanceApproved with sender being Alice, target being any address, and emergency being true.
  3. As a result, Alice cannot execute her flash governance decision, and her funds are locked in the contract for the flashGovernanceConfig.unlockTime period.

Referenced code: DAO/FlashGovernanceArbiter.sol#L60-L81

Recommended Mitigation Steps

Only allow certain addresses to call the assertGovernanceApproved function on FlashGovernanceArbiter.

gititGoro (Behodler) confirmed, but disagreed with High severity and commented:

The reason I stuck with medium risk is because the user’s funds can’t be lost in this scenario. Only temporarily locked. If the user unapproves FlashGovernanceArbiter on EYE then they simply have to wait until the unlock period has passed and can withdraw again.

Jack the Pug (judge) commented:

Agreed. This should be somewhere in between Med and High. If it’s just the users’ deposits being temporarily locked, then it’s definitely a Med. But this one is taking probably all the funds from users’ wallets and locking them against their will, easy to pull off by anyone, all at once for all potential victims.

I tend to make it a High so that the future wardens and probably by extent the devs can be more careful with allowances. We have seen so many incidents caused by improper handling of users’ allowances.

A transferFrom() with from not being hard-coded as msg.sender is evil.

My fellow wardens, if you are reading this, do not go easy on a transferFrom() that takes an argument as from.


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

The assertGovernanceApproved function does not restrict who can call it, so any address can trigger it for another user.

Impact

An attacker could lock any user's approved funds for the unlock period, preventing them from executing their governance decision; the funds are not permanently lost but temporarily locked.

What the attacker needed

Victim has approved the contract to spend assets; attacker can front-run the approval transaction

The fix

The function should be restricted to only allow certain addresses to call it.

How it was found

  1. Alice approves the FlashGovernanceArbiter contract to transfer a certain amount of her assets.
  2. Bob sees Alice's approval transaction in the mempool and front-runs it.
  3. Bob calls assertGovernanceApproved with sender set to Alice, target any address, and emergency true.
  4. Alice's funds become locked in the contract for the unlock period, and she cannot execute her governance decision.

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 function that should only be callable by certain people can be called by anyone. An attacker can use this to lock a user's funds that they had approved for the contract to spend, stopping the user from using those funds for a set time.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More by shw

View all

22 more disclosed reports, best first.

More from Behodler contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.