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

Position is not minted in the OwnershipNFTs upon mint in the Rust implementation #171

Closed
c4-bot-8 opened this issue Sep 13, 2024 · 0 comments
Labels
3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working insufficient quality report This report is not of sufficient quality 🤖_primary AI based primary recommendation

Comments

@c4-bot-8
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2024-08-superposition/blob/main/pkg/sol/SeawaterAMM.sol#L346

Vulnerability details

Impact

Currently the user can mint a new position using mintPositionBC5B086D() function in the proxy which will be delegated later in the implementation. The problem is that in the Rust code a new position is created but the actual ERC721 tokenId is not minted. Therefore, the owner will not be authorized to call any function in the OwnershipNFTs as he's not the owner of the tokenId.

Proof of Concept

The current implementation of the mint functionality:

https://github.com/code-423n4/2024-08-superposition/blob/main/pkg/sol/SeawaterAMM.sol#L346-348

    function mintPositionBC5B086D(address /* token */, int32 /* lower */, int32 /* upper */) external returns (uint256 /* id */) {
        directDelegate(_getExecutorPosition());
    }

First, we call mintPositionBC5B086D() that will be delegated to the implementation contract. In the implementation, it basically grants a new position to the owner:

https://github.com/code-423n4/2024-08-superposition/blob/main/pkg/seawater/src/lib.rs#L506-508

let owner = msg::sender();
self.grant_position(owner, id);

But the actual NFT is then not minted in the OwnershipNFTs smart contract meaning the owner will not be set as ownerOf(tokenId) and the position is not actually created.

Tools Used

Manual review.

Recommended Mitigation Steps

Mint a new ERC721 position in the SeawaterAMM mintPositionBC5B086D() function if the call to the implementation was successful.

Assessed type

Other

@c4-bot-8 c4-bot-8 added 3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working labels Sep 13, 2024
c4-bot-10 added a commit that referenced this issue Sep 13, 2024
@c4-bot-12 c4-bot-12 added the 🤖_primary AI based primary recommendation label Sep 13, 2024
@howlbot-integration howlbot-integration bot added the insufficient quality report This report is not of sufficient quality label Sep 16, 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 insufficient quality report This report is not of sufficient quality 🤖_primary AI based primary recommendation
Projects
None yet
Development

No branches or pull requests

2 participants