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

OwnershipNFTs contract fais to reset approvals on token transfer #27

Closed
c4-bot-1 opened this issue Sep 12, 2024 · 1 comment
Closed
Labels
3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working duplicate-160 🤖_22_group AI based duplicate group recommendation satisfactory satisfies C4 submission criteria; eligible for awards sufficient quality report This report is of sufficient quality

Comments

@c4-bot-1
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2024-08-superposition/blob/main/pkg/sol/OwnershipNFTs.sol#L109-L116

Vulnerability details

Impact

When a token is transferred to a new owner, its approval for another address is not revoked, potentially allowing the previous owner or approved party to transfer the token again, resulting in the loss of the token for the new owner.

Proof of Concept

The token owner can approve a specified tokenId to another address, giving that address the ability to manage the token:

    function approve(address _approved, uint256 _tokenId) external payable {
        _requireAuthorised(msg.sender, _tokenId);
>>      getApproved[_tokenId] = _approved;
    }

However, after the token is transferred to another address, the getApproved mapping is not cleared. This allows the previously approved address to continue having control over the token, enabling it to transfer the token away from its new owner.

Tools Used

Manual review

Recommended Mitigation Steps

    function _transfer(
        address _from,
        address _to,
        uint256 _tokenId
    ) internal {
        _requireAuthorised(_from, _tokenId);
        SEAWATER.transferPositionEEC7A3CD(_tokenId, _from, _to);
+       delete getApproved[_tokenId];
    }

Assessed type

ERC721

@c4-bot-1 c4-bot-1 added 3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working labels Sep 12, 2024
c4-bot-7 added a commit that referenced this issue Sep 12, 2024
@c4-bot-12 c4-bot-12 added the 🤖_22_group AI based duplicate group recommendation label Sep 13, 2024
@howlbot-integration howlbot-integration bot added sufficient quality report This report is of sufficient quality duplicate-56 labels Sep 16, 2024
@c4-judge
Copy link
Contributor

alex-ppg marked the issue as satisfactory

@c4-judge c4-judge added the satisfactory satisfies C4 submission criteria; eligible for awards label Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working duplicate-160 🤖_22_group AI based duplicate group recommendation satisfactory satisfies C4 submission criteria; eligible for awards sufficient quality report This report is of sufficient quality
Projects
None yet
Development

No branches or pull requests

3 participants