• LISA
    LISA
    • Public Scans
    • My Scans
    1. Scan
    2. ...
    2025-06-22 12:54:58
    Public
    Full Disclosure

    SWC-110 Return Memory Scan

    high1
    Created By:
    Credit Usage:

    Assertion violation in checkAnInvariant due to everMatched being set to true through valid function calls.

    HIGH

    Description

    The checkAnInvariant function contains an invariant that everMatched must always be false. However, an attacker can call etch with an arbitrary address, compute the corresponding bytes32 hash, then call lookup with the hash and the same address. This sets everMatched to true, violating the invariant. When checkAnInvariant is called, the assertion fails, causing a panic and transaction revert. This indicates a critical flaw in the contract's logic, allowing attackers to trigger unexpected reverts or exploit logical inconsistencies.

    Recommendation

    Re-evaluate the contract's design to ensure the invariant !everMatched is correctly enforced. If everMatched should never be true, modify the lookup function to prevent state changes under unintended conditions. Alternatively, remove the assertion if the invariant is not essential to the contract's operation.

    Affected Lines

    Line 35 – 40