log3 Memory Safety Issue + MediumNormally, the _approve and _transfer functions emit ERC20 events (Approval and Transfer) using log3 to signal blockchain clients about changes in allowances and balances.
In this codebase, the event emission uses a hardcoded memory pointer 0x00, which is not safe, because Solidity reserves 0x00 for internal memory operations. Writing to this address can overwrite memory used elsewhere in the contract or in inherited contracts, potentially corrupting memory or event data.
Likelihood: Medium
Overwriting 0x00 occurs whenever _approve or _transfer is called, as 0x00 is used directly to store event data.
In contracts that inherit ERC20Internals or perform other assembly operations, this memory collision can propagate and produce unpredictable behavior.
Impact: Medium
Memory corruption can cause incorrect event logs, making blockchain clients or indexers record wrong Transfer or Approval data.
Other assembly operations could read corrupted memory, leading to token accounting errors or unexpected reverts.
This PoC shows that using 0x00 in _approve or _transfer can overwrite memory, leading to unpredictable behavior.
Replace all 0x00 memory usage in log3 or revert sequences with dynamically allocated memory from the free memory pointer mload(0x40).
_approve function
_transfer function
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.
The contest is complete and the rewards are being distributed.