-
Notifications
You must be signed in to change notification settings - Fork 3
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
Attacker could take advantage of a Re-Org attack and steal users Voting Weight. #167
Comments
Insufficient proof how this could be exploited on unlikely reorg. |
MarioPoneder marked the issue as unsatisfactory: |
Good day @MarioPoneder The issue pointed out here is that based on the CREATE method being used, in the event of a reorg, Bob stakes n amount of UNI tokens, Alice sees the network reorg and stakes n amount of UNI tokens too front running Bob, Alice being the malicious actor will then call alterDelegatee() (in order to take full control of the tokens) and deploy a new surrogate contract which automatically transfers Bobs tokens + Her tokens from the old surrogate to the new surrogate contract, making it impossible for Bob to access His tokens. hereby stealing all of Bob’s stake. Reorgs still do happen on main net Similar Past findings that have been given medium severity. |
I think this is a valid medium issue @MarioPoneder as the warden showed how this issue could be exploited to its maximum. |
Thanks you for your comments! Again, there is insufficient proof how a user could be harmed. If Bob's staking transaction is rolled-back due to the re-org, his staking token transfer is rolled back too. Consequently, leaving this as it is. |
Thanks for your feedback @MarioPoneder but the bone of contention here is that in the case of a reorg, the mapping you highlighted: Now Alice can call the |
Lines of code
https://github.com/code-423n4/2024-02-uniswap-foundation/blob/5a2761c8277541a24bc551fbd624413b384bea94/src/UniStaker.sol#L256-L261
https://github.com/code-423n4/2024-02-uniswap-foundation/blob/5a2761c8277541a24bc551fbd624413b384bea94/src/UniStaker.sol#L638-L659
https://github.com/code-423n4/2024-02-uniswap-foundation/blob/5a2761c8277541a24bc551fbd624413b384bea94/src/UniStaker.sol#L605-L616
Vulnerability details
Impact
In the
Stake function()
, thesurrogate
contracts that holds aStakers
votingweight
aredeployed
orcreated
using theCREATE
method where the address derivation depends only on thenonce
.Re-orgs
can happen in all EVM chains. In Ethereum, whereUnistaker
isdeployed
, "it's not so common" but still happens as the last one happened not so long ago:https://decrypt.co/101390/ethereum-beacon-chain-blockchain-reorg
The following exploit can be exploited due to the use of the
CREATE
method, during the course of aRe-org
.Proof of Concept
Bob
callsstake
,Alice
sees the networkRe-org
and callsstake
as well, FrontrunningBob
, thus creating aDelegationSurrogate
contract with an address in which Bobsvotingweight
will be sent to and because theCREATE
method is used in deploying theDelegationSurrogate
contract, both of them could theoritically, stake with different params and deployDelegationSurrogate
at the same address.All of
Bob's
votingweight
will be transferred to thisSurrogate contract
, controlled by Alice as well (since Hervotingweight
is also sent to the sameDelegationSurrogate
contract).Alice
can then proceed to callalterDelegatee()
, to change herSurrogate contract
thereby transferring all the voting tokens (both hers and Bobs) to a newSurrogatecontract
which causes a huge loss toBob
.Tools Used
Manual Review
Recommended Mitigation Steps
Deploy such contracts via
CREATE2
method withsalt
that includes themsg.sender
Assessed type
Other
The text was updated successfully, but these errors were encountered: