Cached version of ovl may be outdated
Two contracts cache the address of the OVL token as an immutable variable, but the mothership contract allows the governor to change that address. After a change, the caching contracts would still interact with the old token address.
Submitted by pauliax
Impact
contract OverlayV1OVLCollateral and OverlayV1Governance cache ovl address:
IOverlayTokenNew immutable public ovl;
This variable is initialized in the constructor and fetched from the mothership contract:
mothership = IOverlayV1Mothership(_mothership);
ovl = IOverlayV1Mothership(_mothership).ovl();
ovl is declared as immutable and later contract interacts with this cached version. However, mothership contains a setter function, so the governor can point it to a new address:
function setOVL (address _ovl) external onlyGovernor {
ovl = _ovl;
}
OverlayV1OVLCollateral and OverlayV1Governance will still use this old cached value.
Recommended Mitigation Steps
Consider if this was intended, or you want to remove this cached version and always fetch on the go (this will increase the gas costs though).
realisation (Overlay) commented:
This is just a detail we were yet to settle on but definitely were going to as we got the contracts to a totally deployable state.
mikeyrf (Overlay) disagreed with severity:
disagree w severity reason - would put this at 1 - Low Risk given the governor would be responsible for properly setting
I agree with the warden that this constitutes a medium risk.
From the judging criteria (emphasis mine):
2 — Med (M): vulns have a risk of 2 and are considered “Medium” severity when assets are not at direct risk, but the function of the protocol or its availability could be impacted, or leak value with a hypothetical attack path with stated assumptions, but external requirements.
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 contracts store the token address as an immutable variable at deployment, while the source contract allows the governor to update that address later, creating a mismatch.
Impact
The protocol's functionality could be impacted because the contracts would continue using an outdated token address, though the governor is responsible for setting addresses correctly.
What the attacker needed
Governor changes the OVL address
The fix
The contracts should either always fetch the current token address from the mothership or the caching behaviour should be confirmed as intended.
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 can store a value permanently when it is created. Here, two contracts saved the address of a token and never update it. If the token address is later changed in another contract, these two keep using the old address, which could cause them to interact with the wrong token.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.