The PerpetualVault contract's setKeeper() function does not emit an event when a new keeper is assigned. This lack of transparency makes it difficult to track critical role changes, hindering security monitoring and reducing on-chain auditability of administrative actions.
The setKeeper() function in PerpetualVault.sol only checks for the zero address but does not emit an event:
The keeper role in this contract likely has significant privileges related to execution of transactions, making changes to this role particularly important to track.
Limited auditability of role changes, making it difficult to track keeper assignments and changes over time
Potentially undetected unauthorized role assignments or malicious role changes
Security teams and protocol users have reduced visibility into important administrative actions
Historical analysis of role changes becomes more difficult and less reliable
Severity: 🟡 Medium
Manual code review
Add event emission when updating the keeper:
This improvement:
Declares a specific event for keeper changes
Indexes both the old and new keeper addresses for efficient filtering
Includes both values to maintain a complete history of changes
Follows established patterns for role change events
This proof of concept demonstrates how the lack of event emission for keeper role changes impairs the ability to track and audit critical role changes in the protocol.
Admin: The contract owner who can assign keeper roles.
Auditor/Monitor: External entities trying to track role changes.
Protocol: The PerpetualVault contract.
Setup: We deploy both the original contract and a fixed version that emits events for keeper changes.
Auditing Scenario:
When a keeper is changed in the original contract, no events are emitted, making it impossible to track these changes on-chain.
With the fixed contract, each keeper change emits an event that can be indexed and monitored.
Impact for Auditors/Monitors:
Without events, auditors must rely on contract state snapshots to detect role changes, which is much less reliable.
Security monitoring tools typically rely on events to detect administrative actions, so the absence of events makes automated security monitoring difficult.
The history of role changes cannot be accurately reconstructed from the blockchain data.
Benefits of the Fix:
Clear tracking of all keeper role changes, including when they occurred and who was involved.
Improved ability to detect unauthorized role assignments.
Better support for security monitoring and compliance.
Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelihood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point.
Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelihood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.