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

FERC1155 royalty should be limited to prevent potential underflows #239

Closed
code423n4 opened this issue Jul 12, 2022 · 1 comment
Closed
Labels
2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Warden finding duplicate Another warden found this issue old-submission-method

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2022-07-fractional/blob/main/src/FERC1155.sol#L223

Vulnerability details

Impact

Generally, when accessing the contract's royalties, the caller will use the following schema:

uint amount = x;
(address receiver, uint royalty) = c.royaltyInfo(id, amount);
token.transfer(receiver, royalty);
token.transfer(owner, amount - royalty); // send remaining balance to the owner of the token.

If the royalty is larger than 100%, the last line will trigger an underflow.

Proof of Concept

https://github.com/code-423n4/2022-07-fractional/blob/main/src/FERC1155.sol#L223

Allows the controller to set whatever value they want.

Tools Used

none

Recommended Mitigation Steps

Use a reasonable limit, e.g. 10%

@code423n4 code423n4 added 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Warden finding old-submission-method labels Jul 12, 2022
code423n4 added a commit that referenced this issue Jul 12, 2022
@0x0aa0 0x0aa0 added the duplicate Another warden found this issue label Jul 18, 2022
@0x0aa0
Copy link
Collaborator

0x0aa0 commented Jul 18, 2022

Duplicate of #166

@0x0aa0 0x0aa0 marked this as a duplicate of #166 Jul 19, 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 Warden finding duplicate Another warden found this issue old-submission-method
Projects
None yet
Development

No branches or pull requests

3 participants