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

heeze - Incorrect index due to not emptying tstore #773

Open
sherlock-admin4 opened this issue Sep 15, 2024 · 0 comments
Open

heeze - Incorrect index due to not emptying tstore #773

sherlock-admin4 opened this issue Sep 15, 2024 · 0 comments

Comments

@sherlock-admin4
Copy link
Contributor

sherlock-admin4 commented Sep 15, 2024

heeze

High

Incorrect index due to not emptying tstore

Summary

An incorrect index of the checkpoint is used when creating a Protected Listing because the tstore opcode is not emptied after the use.

Vulnerability Detail

The tstore opcode is temporary but not emptied after until the end of the transaction. Hence if a user creates multiple protectedListings in the same transaction the same checkpointIndex will be used for all the listings except the first.

POC

  • User creates a ProtectedListing the checkpoint is updated with the current checkpoint
  • User creates another ProtectedListing in the same transaction leading to the same checkpoint been used for listing 2
  • User can continuously do this and all subsequent listings will have the same checkpoint

Impact

The listing checkpoint index is used to calculate the unlock price of a user's NFT, as such this will result in listings with lower price.

Code Snippet

In https://github.com/sherlock-audit/2024-08-flayer/blob/main/flayer/src/contracts/ProtectedListings.sol#L138

Tool used

Manual Review

Recommendation

Clear the tstore opcode after use/call.

@sherlock-admin2 sherlock-admin2 changed the title Bright Emerald Fish - Incorrect index due to not emptying tstore heeze - Incorrect index due to not emptying tstore Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant