15,000 USDC
View results
Submission Details
Severity: medium

Vulnerability with Multiple Entrypoint Tokens in DSCEngine.sol Contract

Summary

Certain ERC20 tokens, such as Synthetix tokens (SNX, sBTC) and the TUSD stablecoin, have multiple valid contract addresses that can manipulate the same underlying storage. These multiple entry point tokens pose a vulnerability when used within the DSCEngine.sol contract due to the potential for manipulation of the balanceOf and transfer functions.

Vulnerability Details

The current architecture of the DSCEngine.sol contract assumes that a contract address is a unique identifier for a token and relies on the return value of balanceOf for determining the necessary transfers during the redemption of DSC tokens. This assumption becomes problematic with tokens that have multiple valid contract addresses.

An attacker could exploit this vulnerability by initiating a redemption of DSC tokens using the alternate address of a token with multiple valid contract addresses. During the execution of the redemption function, balanceOf would return a positive balance for the double entry point token, crediting the attacker and transferring them the entire balance of the double entry point token. This attack only costs gas and the initial DSC tokens used for redemption.

Impact

An attacker can exploit this vulnerability to drain the entire balance of a double entry point token from the DSCEngine.sol contract. This could lead to significant financial loss for users holding DSC tokens backed by that collateral.

Recommendations

Users should be explicitly warned not to redeem DSC tokens with tokens that have multiple valid addresses. A safeguard could be to introduce an explicit blacklist to prevent any address other than an "official" one from being used for such tokens. This could be fixed at deployment time, as double entry point tokens are rare and now widely known to be dangerous.

Another potential solution is to architecturally store tokens in dedicated, special-purpose contracts for each token address. However, this approach would increase gas costs and complexity. As always, thorough testing and auditing of any changes are recommended to ensure they do not introduce new vulnerabilities.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.