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

Use call instead of transfer #33

Closed
Tracked by #93
code423n4 opened this issue Oct 19, 2022 · 3 comments
Closed
Tracked by #93

Use call instead of transfer #33

code423n4 opened this issue Oct 19, 2022 · 3 comments
Labels
bug Something isn't working duplicate This issue or pull request already exists primary issue Highest quality submission among a set of duplicates QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax responded The Holograph team has reviewed and responded sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/holographxyz/holograph-protocol/blob/c4_audit/contracts/enforcer/PA1D.sol#L396

Vulnerability details

Impact

The transfer function is not recommended for sending ETH due to its 2300 gas unit limit. Instead call can be used to circumvent the gas limit

Proof of Concept

  1. Observe the _payoutEth function
  function _payoutEth() private {
...

    // uint256 sent;
    for (uint256 i = 0; i < length; i++) {
      sending = ((bps[i] * balance) / 10000);
      addresses[i].transfer(sending);
      // sent = sent + sending;
    }
  }
  1. Observe that contract is using transfer function for sending eth to addresses[i] where addresses[i] might be a contract requiring more than 2300 gas unit in which case this function will fail

Recommended Mitigation Steps

Use call instead of transfer

@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 Oct 19, 2022
code423n4 added a commit that referenced this issue Oct 19, 2022
@d3e4
Copy link

d3e4 commented Oct 26, 2022

Duplicate of #452

@gzeoneth gzeoneth added the primary issue Highest quality submission among a set of duplicates label Oct 28, 2022
This was referenced Oct 28, 2022
@gzeoneth gzeoneth added the sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity") label Oct 31, 2022
@alexanderattar
Copy link

transfer was used intentionally, but this function will be refactored anyways due to other issues with gas calculation

@alexanderattar alexanderattar added the responded The Holograph team has reviewed and responded label Nov 8, 2022
@gzeoneth gzeoneth added QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax and removed 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value labels Nov 19, 2022
@gzeoneth
Copy link
Member

Consider with #36

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists primary issue Highest quality submission among a set of duplicates QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax responded The Holograph team has reviewed and responded sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Projects
None yet
Development

No branches or pull requests

4 participants