Open hats-bug-reporter[bot] opened 2 months ago
Ultimately a non-existing receiptId that is lower than the starting point is allowed to go through.
On first delegate via delegate()
function, the receiptId
would be 4294967296 + 1
then this receiptId
would be checked in Subcall.consensusDelegate(to, amount, receiptId);
and it would be passed. The above issue wont occur in practical.
Github username: -- Twitter username: -- Submission hash (on-chain): 0x44ef391a519126fc96de190f4f9c355dea43b4620dcc6d843817415eaaac30cd Severity: medium
Description: As we know
receiptId
starts incrementing fromnextReceiptId
which is set4294967296
:Whenever delegating function
delegate
is invoked which creates thereceiptId
in the following way:This means that the first
receiptId
will be4294967296 + 1
:After this
consensusDelegate
is entered and performs the following check:This however is incorrect since the first ever existing
receiptId
starts at 4294967297, but instead this check allows 4294967296 to go through.Ultimately a non-existing
receiptId
that is lower than the starting point is allowed to go through.Note that this vulnerability also exists inside
consensusUndelegate
but due to the similarity this is not reported as separate issuesRecommendation
increment the number
This way anything which is lower than the first
receiptId
will revert.