Description:Description\
The USDE token contract implements a burn function that accepts a signature as authorization.
However, the signature verification is flawed as it only validates that the signature is from the correct address without verifying that the signed message matches the actual burn parameters.
The current implementation allows any signed message from the token holder to authorize a burn of any amount, enabling potential replay attacks and unauthorized burns.
This is particularly dangerous as it could lead to token holders losing more tokens than they authorized.
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;
}
Attack Scenario\
Alice signs a message authorizing a burn of 100 tokens
Bob, who has the BURN_ROLE, sees this signature
Bob can use this signature to:
Burn more than 100 tokens from Alice's account
Replay the signature multiple times to repeatedly burn tokens
Use the signature on different chains in case of network forks
Alice loses more tokens than she authorized
Revised Code File (Optional)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.21;
contract USDE {
// Add nonce tracking for burn signatures
mapping(address => uint256) public burnNonces;
Github username: -- Twitter username: -- Submission hash (on-chain): 0xefafa8a3a9fead0f3a0102398da97fd49fc9afb5080b785d17f480f18d36fd1d Severity: high
Description: Description\ The USDE token contract implements a burn function that accepts a signature as authorization.
However, the signature verification is flawed as it only validates that the signature is from the correct address without verifying that the signed message matches the actual burn parameters.
The current implementation allows any signed message from the token holder to authorize a burn of any amount, enabling potential replay attacks and unauthorized burns.
This is particularly dangerous as it could lead to token holders losing more tokens than they authorized.
Attack Scenario\ Alice signs a message authorizing a burn of 100 tokens
Bob, who has the BURN_ROLE, sees this signature
Bob can use this signature to:
Burn more than 100 tokens from Alice's account
Replay the signature multiple times to repeatedly burn tokens
Use the signature on different chains in case of network forks
Alice loses more tokens than she authorized
contract USDE { // Add nonce tracking for burn signatures mapping(address => uint256) public burnNonces;
}