Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The contract does not check the code size of token addresses, which may lead to fund losses. #627

Closed
codehawks-bot opened this issue Aug 5, 2023 · 1 comment

Comments

@codehawks-bot
Copy link

The contract does not check the code size of token addresses, which may lead to fund losses.

Severity

Medium Risk

Relevant GitHub Links

bool success = IERC20(tokenCollateralAddress).transferFrom(msg.sender, address(this), amountCollateral);

bool success = i_dsc.transferFrom(dscFrom, address(this), amountDscToBurn);

bool success = IERC20(tokenCollateralAddress).transfer(to, amountCollateral);

Summary

The contract does not check the code size of token addresses, which may lead to fund losses.

Vulnerability Details

The contract does not check the code size of token addresses, which may lead to fund losses.If transferFrom() are called on a token address that doesn't have a contract in it, it will always return success, bypassing the return value check.This could lead to users minting tokens for free or cause significant fund losses.This is the reference link to the previous :sherlock-audit/2022-11-bond-judging#8

Impact

Hence this may lead to miscalculation of funds and may lead to loss of funds.

Tools Used

vscode

Recommendations

Use openzeppelin's safeERC20 or implement a code existence check

@PatrickAlphaC
Copy link
Member

Known

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants