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

ERC677 onTokenTransfer return value not check #12

Closed
code423n4 opened this issue May 29, 2023 · 1 comment
Closed

ERC677 onTokenTransfer return value not check #12

code423n4 opened this issue May 29, 2023 · 1 comment
Labels
2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value invalid This doesn't seem right withdrawn by warden Special case: warden has withdrawn this submission and it can be ignored

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2023-05-chainlink/blob/709cde28937727a729b9b5a6653e3720227f9897/contracts/pools/tokens/ERC677.sol#L20

Vulnerability details

Impact

According to the ERC677 specification, the onTokenTransfer interface has a bool return, but the code implementation does not check this return value.
This results in a problem with callback of receiver contract, when the receiver contract rejects the call, it may only return false and not revert. However, according to the code implementation, the callback will succeed silently.

Proof of Concept

Receiving Contract
onTokenTransfer
function onTokenTransfer(address from, uint256 amount, bytes data) returns (bool success)
  function transferAndCall(address to, uint amount, bytes memory data) public returns (bool success) {
    super.transfer(to, amount);
    emit Transfer(msg.sender, to, amount, data);
    if (to.isContract()) {
      // @audit should check return value
      IERC677Receiver(to).onTokenTransfer(msg.sender, amount, data);
    }
    return true;
  }

Tools Used

Manual review

Recommended Mitigation Steps

check onTokenTransfer return value

Assessed type

CanAuto

@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 May 29, 2023
code423n4 added a commit that referenced this issue May 29, 2023
@code423n4 code423n4 added invalid This doesn't seem right withdrawn by warden Special case: warden has withdrawn this submission and it can be ignored and removed bug Something isn't working labels May 29, 2023
@code423n4
Copy link
Contributor Author

Withdrawn by kutugu

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 invalid This doesn't seem right withdrawn by warden Special case: warden has withdrawn this submission and it can be ignored
Projects
None yet
Development

No branches or pull requests

1 participant