Skip to content
Access control Audit finding Intermediate

TIMELOCK_ROLE Has Absolute Power to Withdraw All FUND May Raise Red Flags for Investors

The TIMELOCK_ROLE in the contracts is granted the ability to withdraw all funds through several emergency and partial withdrawal functions. An attacker or malicious holder of that role could drain the protocol's funds, which the judge noted is contingent on the account holding the role.

Meta0xNull Follow

Originally disclosed on Code4rena

Submitted by Meta0xNull

TIMELOCK_ROLE Can Withdraw All FUND from the Contracts via emergencyWithdrawGAS(), emergencyWithdraw(), partialWithdrawGAS(), partialWithdraw().

While I believe developer have good intention to use these functions. It often associate with Rug Pull by developer in the eyes of investors because Rug Pull is not uncommon in Defi. Investors lose all their hard earn money.

Read More: $10.8M Stolen, Developers Implicated in Alleged Smart Contract ‘Rug Pull’ https://www.coindesk.com/tech/2020/12/02/108m-stolen-developers-implicated-in-alleged-smart-contract-rug-pull/

Read More: The Rise of Cryptocurrency Exit Scams and DeFi Rug Pulls https://www.cylynx.io/blog/the-rise-of-cryptocurrency-exit-scams-and-defi-rug-pulls/

Proof of Concept

https://github.com/code-423n4/2021-11-malt/blob/main/src/contracts/Permissions.sol#L80-L109

Recommended Mitigation Steps

  1. Pause the Contract and Disable All Functions when Bad Thing Happen rather than Withdraw All Fund to a random address.
  2. If Withdraw Fund can’t avoid, a Multi Sig ETH Address should be hardcoded into the contract to ensure the fund move to a safe wallet.

0xScotch (sponsor) commented:

Duplicate of #263

Alex the Entreprenerd (judge) commented:

This is not a duplicate of #263, where 263 talks about sidestepping the delay of the timelock, this finding talks about the high degree of power that the TIMELOCK_ROLE has.

This is a typical “admin privilege” finding, it’s very important to disclose admin privileges to users so that they can make informed decisions

In this case the TIMELOCK_ROLE can effectively rug the protocol, however this is contingent on the account that has the role to pull the rug.

Because of its reliance on external factors, am downgrading the finding to medium severity

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

Likely the contract grants a single role unrestricted withdrawal functions that can move all funds without any delay or multi-signature safeguard.

Impact

The holder of the TIMELOCK_ROLE could withdraw all funds from the contracts, though this depends on that account acting maliciously; the judge downgraded it to medium for this reliance on external factors.

What the attacker needed

Control of the TIMELOCK_ROLE account

The fix

The contract should pause and disable functions during incidents rather than withdrawing all funds, and if withdrawal is unavoidable, a hardcoded multi-signature address should receive the funds.

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 is a program that holds money on a blockchain. Here, one special permission level (a role) is allowed to move all the money out of the contract at once. If whoever holds that role turns out to be dishonest, they could take everything, which is why the report says investors should be told about this power.

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 Meta0xNull

View all

3 more disclosed reports, best first.

More from Malt Protocol - Versus 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.