Extension voting threshold check needs to rerun on each transfer #141
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Handle
cmichel
Vulnerability details
The
Extension
contract correctly reduces votes from thefrom
address of a transfer and adds it to theto
address of the transfer (in case both of them voted on it before), but it does not rerun the voting logic invoteOnExtension
that actually grants the extension.This leads to issues where an extension should be granted but is not:
POC
to
address has 100 tokens and votes for the extensionfrom
address has 100 tokens but does not vote for the extension and transfers the 100 tokens toto
to
now has 200 tokens,removeVotes
is run, thetotalExtensionSupport
is increased by 100 to 200. In theory, the threshold is reached and the vote should pass ifto
could callvoteOnExtension
again.voteOnExtension
with the new balance will fail as they already voted on it (lastVotedExtension == _extensionVoteEndTime
). The extension is not granted.Impact
Extensions that should be granted after a token transfer are not granted.
Recommended Mitigation Steps
Rerun the threshold logic in
removeVotes
as it has the potential to increase the total support ifto
voted for the extension butfrom
did not.The text was updated successfully, but these errors were encountered: