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.
Originally disclosed on Code4rena
Submitted by carlitox477, also found by 0xA5DF, 0xDjango, brgltd, IllIllI, and reassor
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;
}
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
- The owner calls setTimeLock with a new address.
- The TIME_LOCK_ADDRESS is updated to the new address.
- 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.