ERC20Internals::totalSupply_ and ERC20Internals::_balanceOf use return in assembly, which can interrupt the execution of calling functionsIn an ERC20 implementation, internal functions like totalSupply_ and _balanceOf should act as normal helpers: returning a value to the calling function without altering the execution flow.
In this implementation, these functions use return in assembly, which executes an EVM RETURN and ends the entire call. If a child contract calls these functions within other logic, execution is immediately halted and any subsequent code is never run.
Likelihood: Low
This only occurs when a child contract reuses these internal functions within logic that expects to continue execution after the call. It does not occur in the base ERC20.
Impact: Medium
The internal call prematurely ends all execution, causing unexpected behavior, skipping validations, and breaking inherited functions that depend on these helpers.
This test demonstrates that the internal functions _balanceOf and totalSupply_, by using return in assembly, immediately end the EVM call. When a child contract tries to use _balanceOf inside a function that should continue executing logic afterwards, that logic is never run. In this case, the expression return balance * 25 is completely ignored, returning only the raw value from _balanceOf.
The mitigation consists of replacing the manual return in assembly with a simple assignment to the Solidity return variable (supply / amount), letting the compiler handle the return without interrupting the execution of the calling 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.