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

Receiving address might not be able to handle WETH instead of ETH #607

Open
code423n4 opened this issue Jul 14, 2022 · 4 comments
Open

Receiving address might not be able to handle WETH instead of ETH #607

code423n4 opened this issue Jul 14, 2022 · 4 comments
Labels
bug Warden finding QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2022-07-fractional/blob/8f2697ae727c60c93ea47276f8fa128369abfe51/src/utils/SafeSend.sol#L30-L35

Vulnerability details

Impact

Funds might be automatically frozen via _sendEthOrWeth().

Proof of Concept

buyFractions() does not provide the option to pay with WETH, therefore the receiving address of sellFractions() wouldn't expect to receive WETH instead of ETH.

If for some unexpected reason the native ETH transfer fails, WETH will be sent to the receiver that might not be able to handle ERC20s, leading to the funds being frozen.

https://github.com/code-423n4/2022-07-fractional/blob/8f2697ae727c60c93ea47276f8fa128369abfe51/src/utils/SafeSend.sol#L30-L35

    function _sendEthOrWeth(address _to, uint256 _value) internal {
        if (!_attemptETHTransfer(_to, _value)) {
            WETH(WETH_ADDRESS).deposit{value: _value}();
            WETH(WETH_ADDRESS).transfer(_to, _value);
        }
    }

Tools Used

Manual Review

Recommended Mitigation Steps

Simply revert if native ETH transfer is not successful instead of attempting WETH transfer.

Other instance:
https://github.com/code-423n4/2022-07-fractional/blob/8f2697ae727c60c93ea47276f8fa128369abfe51/src/modules/Buyout.sol#L235-L236

@code423n4 code423n4 added 3 (High Risk) Assets can be stolen/lost/compromised directly bug Warden finding labels Jul 14, 2022
code423n4 added a commit that referenced this issue Jul 14, 2022
@itsmetechjay
Copy link
Collaborator

Warden submitted this as a high-risk severity by mistake, so we are updating it to medium severity.

@itsmetechjay itsmetechjay added 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value and removed 3 (High Risk) Assets can be stolen/lost/compromised directly labels Jul 15, 2022
@mehtaculous mehtaculous added the sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue label Jul 20, 2022
@mehtaculous
Copy link
Member

0 (Not bug)

WETH is used in the event that the receiving address is not an EOA and it has not implemented a payable receive function to receive eth. This is not an issue.

@HardlyDifficult
Copy link
Collaborator

There's some validity to the warden's point here. Where it wouldn't lead to assets getting trapped in the contract, reverting could be a safer solution than falling back to WETH. Lowing risk and converting into a QA report for the warden.

@HardlyDifficult HardlyDifficult added QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax and removed 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value labels Aug 4, 2022
@HardlyDifficult
Copy link
Collaborator

HardlyDifficult commented Aug 7, 2022

Merging with #605, #604

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Warden finding QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue
Projects
None yet
Development

No branches or pull requests

4 participants