Missing event & timelock for critical onlyAdmin functions
Critical admin functions in the VaultTracker contract can change key parameters without emitting events or using timelocks. This means users and other privileged roles cannot detect upcoming changes or react in time, potentially leading to unexpected financial or trust impacts.
Submitted by 0xRajeev, also found by defsec.
Impact
onlyAdmin functions that change critical contract parameters/addresses/state should emit events and consider adding timelocks so that users and other privileged roles can detect upcoming changes (by offchain monitoring of events) and have the time to react to them.
Privileged functions in all contracts, for e.g. VaultTracker onlyAdmin, have direct financial or trust impact on users who should be given an opportunity to react to them by exiting/engaging without being surprised when changes initiated by such functions are made effective opaquely (without events) and/or immediately (without timelocks).
See similar Medium-severity finding in ConsenSys’s Audit of 1inch Liquidity Protocol (https://consensys.net/diligence/audits/2020/12/1inch-liquidity-protocol/#unpredictable-behavior-for-users-due-to-admin-front-running-or-general-bad-timing)
Proof of Concept
- https://github.com/Swivel-Finance/gost/blob/5fb7ad62f1f3a962c7bf5348560fe88de0618bae/test/vaulttracker/VaultTracker.sol#L36-L59
- https://github.com/Swivel-Finance/gost/blob/5fb7ad62f1f3a962c7bf5348560fe88de0618bae/test/vaulttracker/VaultTracker.sol#L70-L98
- https://github.com/Swivel-Finance/gost/blob/5fb7ad62f1f3a962c7bf5348560fe88de0618bae/test/vaulttracker/VaultTracker.sol#L102-L129
- https://github.com/Swivel-Finance/gost/blob/5fb7ad62f1f3a962c7bf5348560fe88de0618bae/test/vaulttracker/VaultTracker.sol#L132-L138
- https://github.com/Swivel-Finance/gost/blob/5fb7ad62f1f3a962c7bf5348560fe88de0618bae/test/vaulttracker/VaultTracker.sol#L144-L196
- https://github.com/Swivel-Finance/gost/blob/5fb7ad62f1f3a962c7bf5348560fe88de0618bae/test/vaulttracker/VaultTracker.sol#L201-L239
and others
Tools Used
Manual Analysis
Recommended Mitigation Steps
Add events to all possible flows (some flows emit events in callers) and consider adding timelocks to such onlyAdmin functions.
removing duplicate mark since the (valid) suggestion to emit events on the changes made by admin calls
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 admin functions lack event emission and timelock mechanisms, making changes opaque and immediate.
Impact
Users and privileged roles cannot detect or react to critical parameter changes, which could lead to financial loss or loss of trust.
What the attacker needed
Admin privileges
The fix
Add events to all admin functions that change critical parameters and consider adding timelocks to such functions.
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 functions can only be called by an administrator. If these functions change important settings without announcing it (by emitting an event) or without a delay (a timelock), users might not know until it's too late. This lack of transparency can be risky because users can't react to changes that affect their funds or trust.
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.