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

Ensure zero msg.value if transferring from user and baseAsset is not WETH. #114

Closed
code423n4 opened this issue Jul 2, 2022 · 2 comments
Closed
Labels
2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working duplicate This issue or pull request already exists

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2022-06-putty/blob/3b6b844bc39e897bd0bbb69897f2deff12dc3893/contracts/src/PuttyV2.sol#L338
https://github.com/code-423n4/2022-06-putty/blob/3b6b844bc39e897bd0bbb69897f2deff12dc3893/contracts/src/PuttyV2.sol#L360
https://github.com/code-423n4/2022-06-putty/blob/3b6b844bc39e897bd0bbb69897f2deff12dc3893/contracts/src/PuttyV2.sol#L436

Vulnerability details

Impact

Ensure zero msg.value if transferring from user and baseAsset is not WETH.
A user that mistakenly calls either fillOrder() or exercise() with native ETH when baseAsset is not WETH, his native ETH will be locked in the contract.

Proof of Concept

There is a reference of the same issue.

Tools Used

Solidity Visual Developer of VSCode

Recommended Mitigation Steps

We should ensure msg.value == 0 for above cases.

} else {
    require(msg.value == 0, "ETH sent");
    ERC20(order.baseAsset).safeTransferFrom(msg.sender, order.maker, order.premium);
}
@code423n4 code423n4 added 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working labels Jul 2, 2022
code423n4 added a commit that referenced this issue Jul 2, 2022
@rotcivegaf
Copy link

Duplicate of #226

@outdoteth
Copy link
Collaborator

Duplicate: Native ETH can be lost if it’s not utilised in exercise and fillOrder: #226

@outdoteth outdoteth added the duplicate This issue or pull request already exists label Jul 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

4 participants