Skip to content
DoS Audit finding Intermediate

Griefing/DOS of withdrawals by EOAs from treasury (TRSRY) possible

The revokePolicyApprovals function in TreasuryCustodian lacks proper checks, allowing a malicious actor to revoke approvals for any address, including externally owned accounts (EOAs). An attacker monitoring the mempool could front-run legitimate withdrawal transactions and set approved amounts to zero, causing a denial of service.

minhtrng Follow

Originally disclosed on Code4rena

Submitted by minhtrng

https://github.com/code-423n4/2022-08-olympus/blob/b5e139d732eb4c07102f149fb9426d356af617aa/src/policies/TreasuryCustodian.sol#L53-L67

Any withdrawals from the treasury by an approved EOA can be denied by a malicious actor that watches the mempool.

Proof of Concept

The function TreasuryCustodian.revokePolicyApprovals() doesnt provide sufficient checks for its intended purpose of “revoking a deactivated policy’s approvals”. As can be seen by the TODO labels, the issue has already been acknowledged by the team (regardless it is still an issue present in an in-scope contract). The only check performed is trying to call the isActive()-function on an address and interpret the returned value as boolean. Attempting to call this function on an EOA will not fail and return 0 (=false). Hence the condition to revert is not fulfilled and the amounts approved to withdraw will be set to 0.

Tools Used

IDE (Remix, VSCode)

Recommended Mitigation Steps

A partial but insufficient fix would be to check if the address passed to the function contains code and hence is not an EOA. A better approach might be to add a mapping(address => bool) of all addresses that have been active policies some time in the past to the kernel, something like this:

As a public variable in Kernel.sol mapping(address => bool) public isRegisteredPolicy;

in Kernel.activatePolicy(): isRegisteredPolicy[address(policy_)] ) = true;

and finally in TreasuryCustodian.revokePolicyApprovals(): if(!kernel.isRegisteredPolicy(policy_) revert NotARegisteredPolicy

ind-igo (Olympus) confirmed and commented:

TODOs are outdated, I forgot to clear them ;(. But the points are taken. Code will be adjusted, but probably not the way from the recommendation. Instead will gate the function behind custodian role.


The original report as published on Code4rena, by minhtrng. 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 function only checks if the target address is an active policy by calling isActive(), but this call succeeds on EOAs and returns false, so the revert condition is not met and approvals are revoked.

What the attacker needed

Attacker can monitor the mempool; attacker can submit transactions

The fix

The function should be gated behind a custodian role, as the team indicated they will adjust the code.

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 meant to revoke approvals for inactive policies can be called on any address, including regular user accounts (EOAs). Because calling a function on an EOA doesn't fail but returns false, the check passes and approvals are wiped. An attacker can watch pending transactions and call this function first, blocking legitimate withdrawals.

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 minhtrng

View all

11 more disclosed reports, best first.

More from Olympus DAO contest

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.