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

emergencyTokenTransfer should exclude the xTokenAddress token (pWETH) #370

Closed
code423n4 opened this issue Dec 9, 2022 · 3 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-437 unsatisfactory does not satisfy C4 submission criteria; not eligible for awards

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2022-11-paraspace/blob/main/paraspace-core/contracts/ui/WETHGateway.sol#L196

Vulnerability details

Impact

The privileged owner could benefit from this to withraw pWETH token from WETHGateway contract and then redeem for ETH, which could result in the protocol insolvent.

Proof of Concept

pWETH token can be transfered to the WETHGateway contract from msg.sender by calling withdrawETHWithPermit or withdrawETH. pWETH token act as the redeem token for user to withdraw ETH from WETHGateway contract. The emergencyTokenTransfer function can be used to withdraw any ERC20 tokens stucked in the WETHGateway contract including the pWETH token.

    function emergencyTokenTransfer(
        address token,
        address to,
        uint256 amount
    ) external onlyOwner {
        IERC20(token).safeTransfer(to, amount);
        emit EmergencyTokenTransfer(token, to, amount);
    }

The privileged owner could benefit from this to withraw pWETH token from WETHGateway contract and then redeem for ETH, which could result in the protocol insolvent.

Tools Used

manual review

Recommended Mitigation Steps

Exclude the pWETH token in the emergencyTokenTransfer function.

    function emergencyTokenTransfer(
        address token, // @audit-issue should exculde xTokenAddress
        address to,
        uint256 amount
    ) external onlyOwner {
        require(token != IPool(pool).getReserveData(address(WETH)).xTokenAddress, "xTokenAddress");
        IERC20(token).safeTransfer(to, amount);
        emit EmergencyTokenTransfer(token, to, amount);
    }
@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 Dec 9, 2022
code423n4 added a commit that referenced this issue Dec 9, 2022
@c4-judge
Copy link
Contributor

dmvt marked the issue as duplicate of #54

@c4-judge
Copy link
Contributor

dmvt marked the issue as satisfactory

@c4-judge c4-judge added the satisfactory satisfies C4 submission criteria; eligible for awards label Jan 23, 2023
@c4-judge c4-judge added unsatisfactory does not satisfy C4 submission criteria; not eligible for awards and removed satisfactory satisfies C4 submission criteria; eligible for awards labels Jan 31, 2023
@c4-judge
Copy link
Contributor

dmvt marked the issue as unsatisfactory:
Out of scope

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-437 unsatisfactory does not satisfy C4 submission criteria; not eligible for awards
Projects
None yet
Development

No branches or pull requests

3 participants