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.
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
- Alice wants to execute a flash governance decision (e.g., disable to the protocol), so she first calls
approveon theflashGovernanceConfig.assetto allowFlashGovernanceArbiterto transferflashGovernanceConfig.amountof assets from her. - An attacker Bob, who listens to the mempool, notices Alice’s
approvetransaction and decides to front-run it. He callsassertGovernanceApprovedwithsenderbeing Alice,targetbeing any address, andemergencybeingtrue. - As a result, Alice cannot execute her flash governance decision, and her funds are locked in the contract for the
flashGovernanceConfig.unlockTimeperiod.
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 asmsg.senderis evil.My fellow wardens, if you are reading this, do not go easy on a
transferFrom()that takes an argument asfrom.
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
- Alice approves the FlashGovernanceArbiter contract to transfer a certain amount of her assets.
- Bob sees Alice's approval transaction in the mempool and front-runs it.
- Bob calls assertGovernanceApproved with sender set to Alice, target any address, and emergency true.
- 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.