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

When the user is a smart contract, the user may not be able to withdraw ETH through the withdraw function #49

Closed
code423n4 opened this issue Nov 13, 2022 · 6 comments
Labels
bug Something isn't working disagree with severity Sponsor confirms validity, but disagrees with warden’s risk assessment (sponsor explain in comments) downgraded by judge Judge downgraded the risk level of this issue grade-c QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax 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-non-fungible/blob/323b7cbf607425dd81da96c0777c8b12e800305d/contracts/Pool.sol#L44-L50

Vulnerability details

Impact

In the Exchange contract, when paymentToken == POOL, the user's balance in the Pool contract will be increased.
In the Pool contract, the wrapped ETH cannot be transferred by the owner and can be withdrawn only by the owner himself.
If the user is a smart contract and will be reverted in the fallback/receive function, the user's ETH will not be able to be withdrawn.
This vulnerability is similar to the one I previously reported in foundation, which is marked as medium.
code-423n4/2022-02-foundation-findings#12

Proof of Concept

https://github.com/code-423n4/2022-11-non-fungible/blob/323b7cbf607425dd81da96c0777c8b12e800305d/contracts/Pool.sol#L44-L51

Tools Used

None

Recommended Mitigation Steps

Consider allowing the user to specify the recipient in the withdraw function

@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 Nov 13, 2022
code423n4 added a commit that referenced this issue Nov 13, 2022
@berndartmueller
Copy link
Member

The paymentToken is known and agreed upon by both involved parties (buyer and seller). If the receiver of the POOL tokens is a smart contract unable to withdraw ETH from the pool, it is the fault of the involved party. Thus I'm inclined to downgrade to QA (Low-risk).

But for now, I'm leaving it as is for the sponsor review. The final judgment follows after receiving feedback from the sponsor.

@nonfungible47
Copy link

Agree with above, users will need to ensure they can receive their funds properly.

@c4-sponsor
Copy link

nonfungible47 marked the issue as disagree with severity

@c4-sponsor c4-sponsor added the disagree with severity Sponsor confirms validity, but disagrees with warden’s risk assessment (sponsor explain in comments) label Nov 22, 2022
@berndartmueller
Copy link
Member

Downgrading to QA (Low) as both involved parties are aware of the paymentToken and the involved risks.

@c4-judge
Copy link
Contributor

berndartmueller changed the severity to QA (Quality Assurance)

@c4-judge c4-judge added QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax downgraded by judge Judge downgraded the risk level of this issue and removed 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value labels Nov 23, 2022
@c4-judge c4-judge added unsatisfactory does not satisfy C4 submission criteria; not eligible for awards grade-c labels Nov 23, 2022
@c4-judge
Copy link
Contributor

berndartmueller marked the issue as grade-c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working disagree with severity Sponsor confirms validity, but disagrees with warden’s risk assessment (sponsor explain in comments) downgraded by judge Judge downgraded the risk level of this issue grade-c QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax unsatisfactory does not satisfy C4 submission criteria; not eligible for awards
Projects
None yet
Development

No branches or pull requests

5 participants