hats-finance / Euro-Dollar-0xa4ccd3b6daa763f729ad59eae75f9cbff7baf2cd

Audit competition repository for Euro-Dollar (0xa4ccd3b6daa763f729ad59eae75f9cbff7baf2cd)
https://hats.finance
MIT License
1 stars 0 forks source link

Insecure Signature Verification in burn Function Allows Unauthorized Token Burning #29

Open hats-bug-reporter[bot] opened 3 days ago

hats-bug-reporter[bot] commented 3 days ago

Github username: -- Twitter username: -- Submission hash (on-chain): 0xcbdc91bbed5ed57de6e9d1ee01a094c7927f39acab776a32a84261efbd0ade44 Severity: medium

Description: Description\ In the token contracts, the burn function allows an authorized account with the BURN_ROLE to burn tokens from a user's address after verifying a signature:

function burn(
        address from,
        uint256 amount,
        bytes32 h,
        bytes memory signature
    )
        public
        onlyRole(BURN_ROLE)
        returns (bool)
    {
        require(from.isValidSignatureNow(h, signature), "signature/hash does not match");

        _burn(from, amount);

        return true;
    }

Issue:

Recommendation:

To ensure secure signature verification and prevent unauthorized token burning, the function should compute the hash h within the function body using the critical parameters and a predefined message structure. This hash should then be used for signature verification.

AndreiMVP commented 3 days ago

Burn with signature allows us to add extra proof also onchain of the uniqueness / confirmation of that transaction, at least for users who can provide signature. The security of it depends more on the BURN_ROLE so we'll assume that's trusted.