Skip to content
Access control Audit finding Beginner

FraxlendPair#setTimeLock: Allows the owner to reset TIME LOCK ADDRESS

The setTimeLock function allows the owner to change the TIME_LOCK_ADDRESS multiple times, even though the code comments indicate it should be a constant/immutable value. An attacker with owner privileges could reset the timelock address whenever they want, which is not the expected behaviour.

carlitox477 Follow

Originally disclosed on Code4rena

Submitted by carlitox477, also found by 0xA5DF, 0xDjango, brgltd, IllIllI, and reassor

https://github.com/code-423n4/2022-08-frax/blob/c4189a3a98b38c8c962c5ea72f1a322fbc2ae45f/src/contracts/FraxlendPairCore.sol#L84-L86

https://github.com/code-423n4/2022-08-frax/blob/c4189a3a98b38c8c962c5ea72f1a322fbc2ae45f/src/contracts/FraxlendPair.sol#L204-L207

Impact

Allows to reset TIMELOCKADDRESS value multiple times by the owner. According to comments in FraxlendPairCore this should act as a constant/immutable value. Given that this value will be defined through function setTimeLock in FraxLendPair contract this value can be changed whenever the owner wants. This does not seem to be the expected behaviour.

Proof of Concept

The owner can call the function setTimeLock whenever they want, which resets the value of TIMELOCKADDRESS.

Recommended Mitigation Steps

Add a bool which act as mutex if TIMELOCKADDRESS has already been set, and modify setTimeLock function in FraxlendPair contract

// In FraxlendPair contract
bool public timelockSetted;
function setTimeLock(address _newAddress) external onlyOwner {
        require(!timelockSetted);
        emit SetTimeLock(TIME_LOCK_ADDRESS, _newAddress);
        TIME_LOCK_ADDRESS = _newAddress;
        timelockeSetted=true;
}

DrakeEvans (Frax) confirmed


The original report as published on Code4rena, by carlitox477. 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 setTimeLock function lacks a check to prevent multiple calls, so the owner can reset the address at will.

Impact

The owner could change the timelock address multiple times, which may violate the intended immutability and could be used to manipulate the contract's behaviour.

What the attacker needed

Owner privileges

The fix

Add a boolean mutex to ensure setTimeLock can only be called once, as suggested in the report.

How it was found

  1. The owner calls setTimeLock with a new address.
  2. The TIME_LOCK_ADDRESS is updated to the new address.
  3. The owner can repeat this process multiple times.

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.

In smart contracts, some values are meant to be set once and never changed, like a permanent address. Here, the owner can change a supposedly fixed address repeatedly, which could break trust or allow manipulation. The report suggests adding a check to prevent changing it after the first 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 carlitox477

View all

9 more disclosed reports, best first.

More from Frax Ether Liquid Staking 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.