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

Too much ETH in receiveTokenOrETH not reimbursed #124

Closed
code423n4 opened this issue Nov 7, 2022 · 3 comments
Closed

Too much ETH in receiveTokenOrETH not reimbursed #124

code423n4 opened this issue Nov 7, 2022 · 3 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-39 satisfactory Finding meets requirement

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/debtdao/Line-of-Credit/blob/d7ef66035ddf873b0c96804a1c9deeebb1f798ea/contracts/utils/LineLib.sol#L71

Vulnerability details

Impact

In LineLib.receiveTokenOrETH, it is only checked if msg.value is greater or equal than amount when the token is ETH:

if(msg.value < amount) { revert TransferFailed(); }

Therefore, when a user accidentally pays too much ETH, the additional amount will be lost. Note that this is different to ERC20 tokens, where the exact amount is enforced (by transferring the exact amount).

Proof Of Concept

Alice calls LineOfCredit.addCredit to add a credit with 1 ETH. While amount is set to 1 ETH (10**18), she accidentally sends 2 ETH with the call. The additional ETH is lost and cannot be recovered.

Recommended Mitigation Steps

Either force that the amount matches exactly or reimburse the additional ETH.

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

dmvt marked the issue as duplicate of #25

@c4-judge
Copy link
Contributor

c4-judge commented Dec 6, 2022

dmvt marked the issue as satisfactory

@c4-judge c4-judge added the satisfactory Finding meets requirement label Dec 6, 2022
@C4-Staff
Copy link
Contributor

liveactionllama marked the issue as duplicate of #39

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-39 satisfactory Finding meets requirement
Projects
None yet
Development

No branches or pull requests

3 participants