-
Notifications
You must be signed in to change notification settings - Fork 7
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
Protocol is not ERC-1155 compliant #299
Comments
raymondfam marked the issue as insufficient quality report |
raymondfam marked the issue as duplicate of #218 |
0xA5DF marked the issue as not a duplicate |
0xA5DF marked the issue as primary issue |
0xA5DF changed the severity to QA (Quality Assurance) |
This is a loss of funds due to a mistake on the user's side. |
Moved to #336 |
0xA5DF marked the issue as grade-c |
0xA5DF marked the issue as grade-a |
Lines of code
https://github.com/code-423n4/2023-11-shellprotocol/blob/main/src/ocean/Ocean.sol#L317-L366
Vulnerability details
Impact
The
Ocean
contract is not fully compliant with the ERC-1155 standard. Specifically, theonERC1155Received
andonERC1155BatchReceived
functions do not revert when they reject a transfer. According to the ERC-1155 standard, these functions MUST revert if they reject a transfer.This may have been a deliberate choice by the authors given the comments in the functions' documentation, but ERC-1155 adherence is specifically listed as an invariant and this behaviour represents strict non-conformity.
Proof of Concept
This could lead to a potential loss of funds if an external IERC1155 contract is improperly implemented and doesn't check for the return value of
onERC1155Received
. In such a case, a user could unknowingly transfer tokens to theOcean
contract without a proper interaction. Since theOcean
contract doesn't revert the transaction, the tokens would be transferred successfully, but without the required interaction to credit them to the user in the ocean. This could lead to the tokens being stuck in theOcean
contract, resulting in a loss of funds for the user.Tools Used
Manual inspection
Recommended Mitigation Steps
To ensure full compliance with the ERC-1155 standard, modify the
onERC1155Received
andonERC1155BatchReceived
functions to revert when a transfer is rejected. This can be achieved by replacing thereturn 0;
statement with arevert
statement.Assessed type
Other
The text was updated successfully, but these errors were encountered: