Platform: Code4rena
Start Date: 03/05/2023
Pot Size: $60,500 USDC
Total HM: 25
Participants: 114
Period: 8 days
Judge: Picodes
Total Solo HM: 6
Id: 234
League: ETH
Rank: 96/114
Findings: 1
Award: $34.02
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: 0xTheC0der
Also found by: DadeKuma, Haipls, SpicyMeatball, ToonVH, aviggiano, azhar, evmboi32, juancito, kodyvim, ro1sharkm, rvierdiiev, sakshamguruji
34.0183 USDC - $34.02
https://github.com/code-423n4/2023-05-ajna/blob/276942bc2f97488d07b887c8edceaaab7a5c3964/ajna-core/src/PositionManager.sol#L170-L216 https://github.com/code-423n4/2023-05-ajna/blob/276942bc2f97488d07b887c8edceaaab7a5c3964/ajna-core/src/RewardsManager.sol#L207-L260
A malicious actor can force a staker to stake more memorializePositions than intended if the victim has approved tokens to PositionManager
.
Bob (malicious actor) can front-run the stake function call from Alice and force her to stake more memorializePositions than she intended.
1.) Alice approves a position from bucket i
and bucket j
to the PositionManager
2.) She calls memorializePositions
with tokenId x
and provides only i
in the params_.indexes
array array.
3.) She decides to call stake
on the RewardsManager
for the token x
4.) Bob sees her tx in the mempool and frontruns it with the call to memorializePositions
where he provides x
as the tokenId value and j
as the value params_.indexes
array
5.) Alice now stakes more than she intended. To fix this she needs to unstake, redeem the unwanted j
position and stake again. Since ETH fees are expensive this can cost quite a lot.
VS Code
Add a mayInteract
modifier to the memorializePositions
function call.
Access Control
#0 - c4-judge
2023-05-18T09:42:42Z
Picodes marked the issue as primary issue
#1 - c4-sponsor
2023-05-19T19:36:48Z
MikeHathaway marked the issue as sponsor confirmed
#2 - c4-judge
2023-05-30T21:47:21Z
Picodes marked the issue as duplicate of #488
#3 - c4-judge
2023-05-30T21:47:25Z
Picodes marked the issue as satisfactory
#4 - c4-judge
2023-05-30T21:47:30Z
Picodes marked the issue as partial-50
#5 - c4-judge
2023-05-30T21:48:18Z
Picodes changed the severity to 3 (High Risk)