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

receiveTokenOrETH() MAY LOCK ETHER SENT TO THE CONTRACT, FOREVER #388

Closed
code423n4 opened this issue Nov 10, 2022 · 6 comments
Closed

receiveTokenOrETH() MAY LOCK ETHER SENT TO THE CONTRACT, FOREVER #388

code423n4 opened this issue Nov 10, 2022 · 6 comments
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-355 partial-25

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/debtdao/Line-of-Credit/blob/6987988fe39901cad9a8e5ebb2c6aa719590873d/contracts/utils/LineLib.sol#L59

Vulnerability details

Impact

receiveTokenOrETH() receives funds. However, there is code path within the function that does not require Ether. Ether passed to the function, when the non-Ether code path is taken, is locked in the contract forever, and the sender gets nothing extra in return for it.

Proof of Concept

If ETH is provided for a ERC20 credit line, it would not be accounted for, thus lost forever to the user. msg.value shouldn’t be provided here:

if(token != Denominations.ETH) { // ERC20 @audit add require(msg.value==0);
    IERC20(token).safeTransferFrom(sender, address(this), amount);
} 

Tools Used

VSCode

Recommended Mitigation Steps

Add a require(0 == msg.value) for the above three conditions.

@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 10, 2022
code423n4 added a commit that referenced this issue Nov 10, 2022
@c4-judge
Copy link
Contributor

dmvt marked the issue as duplicate of #25

@c4-judge
Copy link
Contributor

dmvt marked the issue as partial-25

@c4-judge
Copy link
Contributor

c4-judge commented Dec 6, 2022

dmvt marked the issue as not a duplicate

@c4-judge
Copy link
Contributor

c4-judge commented Dec 6, 2022

dmvt marked the issue as duplicate of #89

@c4-judge
Copy link
Contributor

c4-judge commented Dec 6, 2022

dmvt marked the issue as partial-25

@C4-Staff
Copy link
Contributor

liveactionllama marked the issue as duplicate of #355

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-355 partial-25
Projects
None yet
Development

No branches or pull requests

3 participants