No validation on the eloFactor passed back on battle outcomes. Could magnify points arbitrarily. In the updateBattleRecord() function, the opaque eloFactor gets passed. There are no checks on the value of eloFactor before it directly influences final rewards.
Since eloFactor directly scales reward points, a malicious game server could:
Massively inflate point earnings by inputting a high eloFactor
Greatly penalize losing players by inputting a low value
Distort rankings since changes aren't measured
Without validation, the game servers have full control to arbitrarily tune rewards distribution. This subverts the competitive integrity underpinning the game economy.
Proof of Concept
To exploit, the game server would pass unrealistic values for eloFactor, whether +1000x or negative numbers. This then flows down into the private _distributeRewards() function to disproportionately impact final points used for rewards.
Lines of code
https://github.com/code-423n4/2024-02-ai-arena/blob/cd1a0e6d1b40168657d1aaee8223dc050e15f8cc/src/RankedBattle.sol#L322-L349 https://github.com/code-423n4/2024-02-ai-arena/blob/cd1a0e6d1b40168657d1aaee8223dc050e15f8cc/src/RankedBattle.sol#L416-L424
Vulnerability details
Impact
No validation on the
eloFactor
passed back on battle outcomes. Could magnify points arbitrarily. In theupdateBattleRecord()
function, the opaqueeloFactor
gets passed. There are no checks on the value ofeloFactor
before it directly influences final rewards.Since
eloFactor
directly scales reward points, a malicious game server could:eloFactor
Without validation, the game servers have full control to arbitrarily tune rewards distribution. This subverts the competitive integrity underpinning the game economy.
Proof of Concept
To exploit, the game server would pass unrealistic values for
eloFactor
, whether +1000x or negative numbers. This then flows down into the private_distributeRewards()
function to disproportionately impact final points used for rewards.File::src/RankedBattle.sol::updateBattleRecord File::src/RankedBattle.sol::_addResultPoints
The specific
eloFactor
parameter in theupdateBattleRecord
function definition, and showing precisely where that value gets propagated and consumed.Tools Used
Vscode
Recommended Mitigation Steps
Not validating this critical input violates software security best practices and enables distortion of the core competitive game logic.
Assessed type
Invalid Validation