Skip to content
Crypto Audit finding Intermediate

DOMAIN_SEPARATOR() is missing in LUSDToken.sol

The LUSDToken contract lacks the DOMAIN_SEPARATOR() function required by ERC2612, which could make it easier for attackers to replay valid signatures across chains or contracts.

matrix_0wl Follow with Haipls

Originally disclosed on Code4rena

Submitted by matrix_0wl, also found by Haipls

The DOMAIN_SEPARATOR() function in ERC2612 is an important part of the security of the standard. It is used to prevent replay attacks, which occur when a malicious user records a valid signed message and later sends it again to fraudulently perform an action on behalf of the original signer.

The DOMAIN_SEPARATOR() is generated based on specific contract parameters, including the contract’s address, the chain ID, and a unique identifier. These parameters ensure that the domain separator is unique to the contract and the chain, and prevent attackers from using the same signature on a different chain or contract.

If the DOMAIN_SEPARATOR() function is missing from ERC2612, it can significantly impact the security of the standard. It can make it easier for attackers to replay valid signatures, since the domain separator provides a crucial part of the uniqueness and security of the signature.

Therefore, it’s important to ensure that the DOMAIN_SEPARATOR() function is included and properly implemented in any contract that uses ERC2612.

Proof of Concept

Output form slither:

# Check LUSDToken

## Check functions
[✓] permit(address,address,uint256,uint256,uint8,bytes32,bytes32) is present
        [✓] permit(address,address,uint256,uint256,uint8,bytes32,bytes32) -> () (correct return type)
[✓] nonces(address) is present
        [✓] nonces(address) -> (uint256) (correct return type)
        [✓] nonces(address) is view
[ ] DOMAIN_SEPARATOR() is missing
[✓] totalSupply() is present
        [✓] totalSupply() -> (uint256) (correct return type)
        [✓] totalSupply() is view
[✓] balanceOf(address) is present
        [✓] balanceOf(address) -> (uint256) (correct return type)
        [✓] balanceOf(address) is view
[✓] transfer(address,uint256) is present
        [✓] transfer(address,uint256) -> (bool) (correct return type)
        [✓] Transfer(address,address,uint256) is emitted
[✓] transferFrom(address,address,uint256) is present
        [✓] transferFrom(address,address,uint256) -> (bool) (correct return type)
        [✓] Transfer(address,address,uint256) is emitted
[✓] approve(address,uint256) is present
        [✓] approve(address,uint256) -> (bool) (correct return type)
        [✓] Approval(address,address,uint256) is emitted
[✓] allowance(address,address) is present
        [✓] allowance(address,address) -> (uint256) (correct return type)
        [✓] allowance(address,address) is view
[✓] name() is present
        [✓] name() -> (string) (correct return type)
        [✓] name() is view
[✓] symbol() is present
        [✓] symbol() -> (string) (correct return type)
        [✓] symbol() is view
[✓] decimals() is present
        [✓] decimals() -> (uint8) (correct return type)
        [✓] decimals() is view
    )

Tools Used

VS Code, Slither

Recommended Mitigation Steps

To mitigate this risk, it is recommended to follow the ERC2612 specification strictly and ensure that the DOMAIN_SEPARATOR is correctly implemented.

tess3rac7 (Ethos Reserve) confirmed via duplicate issue #818


The original report as published on Code4rena, by matrix_0wl. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the contract implements the permit function but omits the required DOMAIN_SEPARATOR() function from the ERC2612 interface.

Impact

Attackers could potentially replay valid signatures, though the text does not demonstrate a working exploit.

What the attacker needed

None

The fix

The contract should strictly follow the ERC2612 specification and correctly implement the DOMAIN_SEPARATOR.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

ERC2612 is a standard that lets people approve token spending with a signed message instead of a transaction. A domain separator is a unique value tied to one contract and one blockchain, so a signature cannot be reused elsewhere. Without it, someone might reuse a signature on another chain or contract.

What is Crypto?

Encryption, signatures, randomness or certificate checks that do not protect what they claim to.

More from Ethos Reserve contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cryptographic weaknesses

The lesson behind this report.

Encryption, signatures, randomness or certificate checks that do not protect what they claim to.