-
Notifications
You must be signed in to change notification settings - Fork 3
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
The owner of RPDX Decaying Bonds is not updated on token transfers #1030
Comments
bytes032 marked the issue as high quality report |
bytes032 marked the issue as primary issue |
psytama (sponsor) confirmed |
The finding lacks a clear loss of funds, although that may be possible since |
The code breaks the implementation of EIP721, and may also cause losses + issues with integrations I think Medium Severity to be appropriate |
GalloDaSballo marked the issue as selected for report |
@GalloDaSballo Hi, could you explain why the code breaks the EIP721? As shown in the PoC, |
Thank you for flagging, you're right that EIP721 is not broken I believe the code to be written incorrectly and while I have considered downgrading I think Med is appropriate in this situation |
Lines of code
https://github.com/code-423n4/2023-08-dopex/blob/main/contracts/decaying-bonds/RdpxDecayingBonds.sol#L36-L44
https://github.com/code-423n4/2023-08-dopex/blob/main/contracts/decaying-bonds/RdpxDecayingBonds.sol#L122
Vulnerability details
Summary
The
RdpxDecayingBonds
contract keeps track of abonds
mapping with bonds information including the bond token owner. When the token is transfered, thebonds[bondId].owner
value should be updated, but it isn't.Impact
The
owner
value will be bricked when a token is transfered, as it can't be changed by any means.Any integration relying on this value will make wrong trusted assumptions related to the bond token owner, potentially leading to critical issues as loss of funds, because of the importance of the
owner
attribute has.Ranking it as Medium, as there is no direct loss of funds within the current scope, but bricks the contract functionality, as there is no way to fix it.
Proof of Concept
The
owner
attribute of thebonds
mapping is set on eachmint()
, but its value is never updated:RdpxDecayingBonds.sol#L36-L44
RdpxDecayingBonds.sol#L122
Coded Proof of Concept
This test shows how the
owner
remains the same on thebonds
transfer after performing a transfer.Add this test to the
tests/RdpxDecayingBondsTest.t.sol
file, and runforge test --mt "testSameOwnerOnTransfer"
:Tools Used
Manual Review
Recommended Mitigation Steps
Either update the
owner
value on each token transfer, or remove it, as the owner of the token is already tracked via the OZ ERC721 contract.Assessed type
Token-Transfer
The text was updated successfully, but these errors were encountered: