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

Implementation of IERC677Receiver doesn't follow the standard #41

Closed
code423n4 opened this issue Apr 13, 2023 · 4 comments
Closed

Implementation of IERC677Receiver doesn't follow the standard #41

code423n4 opened this issue Apr 13, 2023 · 4 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 low quality report This report is of especially low quality unsatisfactory does not satisfy C4 submission criteria; not eligible for awards

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2023-04-frankencoin/blob/main/contracts/IERC677Receiver.sol#L4-#L8
https://github.com/code-423n4/2023-04-frankencoin/blob/main/contracts/StablecoinBridge.sol#L75-#L84

Vulnerability details

Impact

The receiver in IERC677 implementation should be properly checked to ensure if the address to be passed is a contract or not. The current implementation of functions doesn't cover that.

Moreover, there is no support to or implementation of ERC677 standard by Ethereum. The proposal is still in the draft stage.

Proof of Concept

Include a check to see if the address is a contract.

function isContract(address addr) internal view returns (bool) {
    uint size;
    assembly {
      size := extcodesize(addr)
    }
    return (size > 0);
  }

& revert accordingly.

Tools Used

Manual Review

Recommended Mitigation Steps

Comply with the standard, and include a check to see if the address is a contract address.
Reference Implementation

@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 Apr 13, 2023
code423n4 added a commit that referenced this issue Apr 13, 2023
@c4-pre-sort c4-pre-sort added the low quality report This report is of especially low quality label Apr 28, 2023
@c4-pre-sort
Copy link

0xA5DF marked the issue as low quality report

@0xA5DF
Copy link

0xA5DF commented Apr 28, 2023

Impact doesn't seem to be significant, also it's not clear what's the deviation from the standard.
A reference to another implementation isn't a proof for what the standard should be

@hansfriese
Copy link

High level call to an EOA will revert, so there is no impact here.

@c4-judge
Copy link
Contributor

hansfriese marked the issue as unsatisfactory:
Invalid

@c4-judge c4-judge added the unsatisfactory does not satisfy C4 submission criteria; not eligible for awards label May 11, 2023
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 low quality report This report is of especially low quality unsatisfactory does not satisfy C4 submission criteria; not eligible for awards
Projects
None yet
Development

No branches or pull requests

5 participants