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

Potential inability to work with non-EOA accounts when ETH is used as asset #448

Closed
code423n4 opened this issue Nov 10, 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-369 satisfactory Finding meets requirement

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/debtdao/Line-of-Credit/blob/audit/code4rena-2022-11-03/contracts/utils/LineLib.sol#L48

Vulnerability details

Impact

Potential impossibility to work with smart contracts wallets or any kind of contract with custom logic in the fallback function.

The usage of the transfer function for ETH transfers is not recommended, because it reverts on failure and it only forwards a gas stipend of 2300 gas units. If the recipient is an EOA is not a problem. However, the recipient could be any sort of contract (such as multisig or a smart contract wallet) with custom logic within the fallback function that could spend more than the given gas stipend, making the call fail.

Steps to reproduce

  1. Create a contract with custom logic that spends more than 2300 gas units to the fallback function.
  2. Use the contract to interact with the contract to lend/borrow ETH.
  3. The execution will revert when a transfer of ETH occurs.

Recommended Mitigation Steps

Two alternatives:

  1. Use the low-level call function. Solidity docs: https://docs.soliditylang.org/en/v0.8.17/security-considerations.html?highlight=call%20ether#sending-and-receiving-ether)
  2. Use the openzeppelin Address library. Function to use: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Address.sol#L60
@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 #14

@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 #369

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

No branches or pull requests

3 participants