Closed code423n4 closed 1 year ago
This is the desired behavior as these incentives are meant to compensate for the gas fees. As for the front-running risk, this is a drawback of making the function permissionless and could be managed with private rpcs
Lines of code
https://github.com/code-423n4/2022-11-redactedcartel/blob/main/src/vaults/AutoPxGmx.sol#L242-L313
Vulnerability details
Impact
In Contract
AutoPxGmx
, any account may get incentive rewards by callingcompound(poolFee, 1, 0, false)
.Proof of Concept
AutoPxGmx.compound()
is a public function without any guard. Any account (who does not have be a Priex user) my get incentive rewards if callingautoPxGmx.compound(poolFee, 1, 0, false)
(i.e. opt in incentive option). Especially with front-running by monitoring transactions (in mempool) that will triggercompound()
(i.e.depositFsGmx(), redeem(), withdraw(), and compound()
), an attacker can get a stream of incentive rewards.Tools Used
Manual audit.
Recommended Mitigation Steps
Changing the function visibility from
global
tointernal
, or setting some guards on the function call, e.g. only theowner
of the contract, or only theowners
ofGMX/GLP/pxGmx...
can call the function, depending on the strategies of system design.