Critical functions in the contract do not emit events to log important actions such as token withdrawals, approvals, and position token redemptions.
Functions like _redeemPositionToken, _redeemWToken, and _approveCollateralTokenForAave do not emit any events when important state changes occur (e.g., withdrawal of tokens, minting of collateral tokens, approval of collateral tokens). This could lead to issues with transparency and auditability, making it harder for users and developers to track the contract’s state and the actions being performed.
Without event logging, users and external services (such as monitoring tools or front-end applications) cannot easily track actions in the contract. This makes debugging, tracking, and auditing the contract more difficult, as there are no logs to verify whether a transaction was successful or failed.
Proof of Concept for Lack of Event Emissions on Critical Functions
Overview:
The smart contract does not emit events in critical functions where state changes occur. This can result in a lack of transparency, making it difficult to track contract activities off-chain and troubleshoot issues. Attackers could exploit this by executing key transactions without leaving a clear on-chain trace, reducing visibility for users and auditors.
Actors:
Attacker: Any malicious actor or even a legitimate user who performs key state-changing actions without triggering an event.
Victim: Any external observer, including auditors, security monitors, and dApps relying on event logs for accurate transaction tracking.
Protocol: The smart contract system that lacks proper event emissions.
Working Test Case:
Vulnerable Smart Contract:
Issues:
The deposit() and withdraw() functions modify the internal balance mapping but do not emit any event.
External services tracking user deposits and withdrawals will have no visibility into these state changes.
Attackers can manipulate balances without external parties being notified, increasing the risk of unnoticed exploits.
Improved Version with Event Emission:
Detailed Exploit Scenario:
Alice deposits 1 ETH into the contract.
Bob, an indexer service, is monitoring contract events.
Alice calls deposit() and withdraw() functions.
No event is emitted.
Bob’s indexer fails to detect the deposit or withdrawal since there is no emitted event.
Alice's transaction history cannot be properly tracked by external services.
Off-chain tracking services cannot monitor user balances effectively.
Debugging the smart contract during disputes or failures becomes difficult.
Any external applications relying on event logs for real-time updates may break.
Add Event Emissions:
Emit events in all state-changing functions to ensure transparency.
Example fix:
2 Advanced Checks:
Ensure proper indexing: Use indexed keywords in events for efficient off-chain filtering.
Simulate event monitoring: Use Hardhat or Tenderly to ensure event logs are correctly emitted and captured.
Add on-chain verification: Implement a read function that can provide transaction history in case events are lost.
Manual code review
Implement event emissions for critical actions such as token withdrawals, collateral approvals, and redemption.
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.