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

M-01 Token transfers do not verify that the tokens were successfully transferred #289

Closed
code423n4 opened this issue Oct 25, 2022 · 1 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 This issue or pull request already exists edited-by-warden

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2022-10-holograph/blob/main/contracts/enforcer/PA1D.sol#L416

Vulnerability details

Impact

Not all IERC20 implementations revert() when there’s a failure in transfer() / transferFrom(). The function signature has a boolean return value and they indicate errors that way instead. By not checking the return value, operations that should have marked as failed, may potentially go through without actually making a payment

Proof of Concept

There are 4 instances of this issue:

File: /contracts/HolographOperator.sol

400: _utilityToken().transfer(job.operator, leftovers);

596: payable(hToken).transfer(hlgFee);

https://github.com/code-423n4/2022-10-holograph/blob/main/contracts/HolographOperator.sol

File: /contracts/enforcer/PA1D.sol

416: require(erc20.transfer(addresses[i], sending), "PA1D: Couldn't transfer token");

439: require(erc20.transfer(addresses[i], sending), "PA1D: Couldn't transfer token");

https://github.com/code-423n4/2022-10-holograph/blob/main/contracts/enforcer/PA1D.sol

Tools Used

Manual audit

Recommended Mitigation Steps

Perform the check.

@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 25, 2022
code423n4 added a commit that referenced this issue Oct 25, 2022
@code423n4 code423n4 changed the title M-01 Return values of transfer()/transferFrom() not checked M-01 Token transfers do not verify that the tokens were successfully transferred Oct 25, 2022
@gzeoneth
Copy link
Member

Duplicate of #456

@gzeoneth gzeoneth marked this as a duplicate of #456 Oct 28, 2022
@gzeoneth gzeoneth added the duplicate This issue or pull request already exists label Oct 28, 2022
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 This issue or pull request already exists edited-by-warden
Projects
None yet
Development

No branches or pull requests

2 participants