This repository has been archived by the owner on Jul 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
0xpep7 - CouncilMember:burn renders the contract inoperable after the first execution #199
Labels
Has Duplicates
A valid issue with 1+ other issues describing the same vulnerability
High
A valid High severity issue
Reward
A payout will be made for this issue
Sponsor Confirmed
The sponsor acknowledged this issue is valid
Will Fix
The sponsor confirmed this issue will be fixed
Comments
github-actions
bot
added
High
A valid High severity issue
Duplicate
A valid issue that is a duplicate of an issue with `Has Duplicates` label
labels
Jan 19, 2024
1 comment(s) were left on this issue during the judging contest. takarez commented:
|
nevillehuang
added
Has Duplicates
A valid issue with 1+ other issues describing the same vulnerability
and removed
Duplicate
A valid issue that is a duplicate of an issue with `Has Duplicates` label
labels
Jan 25, 2024
This was referenced Jan 25, 2024
Closed
This was referenced Jan 25, 2024
Closed
popeye - Incorrect Balance Assignment When Burning Non-Sequential Tokens in
CouncilMember::burn
#166
Closed
Closed
Closed
See comments here for duplication reasons. |
sherlock-admin
changed the title
Happy Yellow Wolf - CouncilMember:burn renders the contract inoperable after the first execution
0xpep7 - CouncilMember:burn renders the contract inoperable after the first execution
Jan 29, 2024
sherlock-admin
added
the
Sponsor Confirmed
The sponsor acknowledged this issue is valid
label
Feb 7, 2024
The protocol team fixed this issue in PR/commit https://github.com/telcoin/telcoin-audit/pull/31. |
The Lead Senior Watson signed off on the fix. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
Has Duplicates
A valid issue with 1+ other issues describing the same vulnerability
High
A valid High severity issue
Reward
A payout will be made for this issue
Sponsor Confirmed
The sponsor acknowledged this issue is valid
Will Fix
The sponsor confirmed this issue will be fixed
0xpep7
high
CouncilMember:burn renders the contract inoperable after the first execution
Summary
The CouncilMember contract suffers from a critical vulnerability that misaligns the balances array after a successful burn, rendering the contract inoperable.
Vulnerability Detail
The root cause of the vulnerability is that the
burn
function incorrectly manages thebalances
array, shortening it by one each time an ERC721 token is burned while the latest minted NFT still withholds its uniquetokenId
which maps to the previous value ofbalances.length
.This misalignment between existing
tokenIds
and thebalances
array results in several critical impacts:totalSupply
now collides with the existingtokenId
.This mismanagement creates a cascading effect, collectively rendering the contract inoperable. Following POC will demonstrate the issue more clearly in codes.
POC
Run
git apply
on the following patch then runnpx hardhat test
to run the POC.Result
The Passing execution of the POC confirmed that operations such as
claim
,burn
&mint
were all reverted which make the contract inoperable.Impact
The severity of the vulnerability is high due to the high likelihood of occurence and the critical impacts on the contract's operability and token holders' ability to interact with their assets.
Code Snippet
https://github.com/sherlock-audit/2024-01-telcoin/blob/main/telcoin-audit/contracts/sablier/core/CouncilMember.sol#L220
Tool used
VsCode
Recommendation
It is recommended to avoid popping out balances to keep alignment with uniquely minted tokenId. Alternatively, consider migrating to ERC1155, which inherently manages a built-in balance for each NFT.
The text was updated successfully, but these errors were encountered: