Platform: Code4rena
Start Date: 07/08/2023
Pot Size: $36,500 USDC
Total HM: 11
Participants: 125
Period: 3 days
Judge: alcueca
Total Solo HM: 4
Id: 274
League: ETH
Rank: 122/125
Findings: 1
Award: $4.23
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: RED-LOTUS-REACH
Also found by: 0x3b, 0x4non, 0xCiphky, 0xDING99YA, 0xDetermination, 0xE1, 0xG0P1, 0xStalin, 0xWaitress, 0xbrett8571, 0xhacksmithh, 0xkazim, 0xmuxyz, 0xweb3boy, 14si2o_Flint, AlexCzm, Alhakista, Bube, Bughunter101, Deekshith99, Eeyore, Giorgio, HChang26, InAllHonesty, JP_Courses, KmanOfficial, MatricksDeCoder, Mike_Bello90, MrPotatoMagic, Naubit, QiuhaoLi, RHaO-sec, Raihan, Rolezn, SUPERMAN_I4G, Shubham, Silverskrrrt, Strausses, T1MOH, Topmark, Tripathi, Watermelon, _eperezok, aakansha, auditsea, audityourcontracts, ayden, carlos__alegre, castle_chain, cducrest, ch0bu, d23e, deadrxsezzz, deth, devival, erebus, fatherOfBlocks, halden, hassan-truscova, hpsb, hunter_w3b, imkapadia, immeas, jat, kaden, kaveyjoe, klau5, koxuan, kutugu, ladboy233, lanrebayode77, leasowillow, lsaudit, markus_ether, matrix_0wl, merlin, nemveer, ni8mare, nonseodion, oakcobalt, owadez, p_crypt0, pipidu83, piyushshukla, popular00, ppetrov, rjs, sandy, sl1, supervrijdag, tay054, thekmj, wahedtalash77, windhustler, zhaojie
4.2289 USDC - $4.23
The Gauge weight can be forced changed by the governance using change_gauge_weight
. However unlike vote_for_gauge_weights
, which checks whether the gauge address is valid using isValidGauge
, change_gauge_weight
is not checking this condition. Possible impact:
A malicious governance can pretend deleting a gauge which is unfavourable for the users, by removing it using remove_gauge
, however it can still force change its weight leading to unfair distribution.
The malicious actor can set a very high weight to a gauge they favor (or control), which may result in that gauge receiving a disproportionate amount of rewards or influence in the system.
Add this code to:
gc.change_gauge_weight(user1, 100);
assertEq(gc.get_gauge_weight(user1), 100);
function testRemoveGauge() public { vm.startPrank(gov); gc.add_gauge(user1); assertTrue(gc.isValidGauge(user1)); gc.remove_gauge(user1); assertTrue(!gc.isValidGauge(user1)); assertTrue(gc.get_gauge_weight(user1) == 0); gc.change_gauge_weight(user1, 100); assertEq(gc.get_gauge_weight(user1), 100); vm.stopPrank(); }
You can observe that despite being deleted, user1 has gained again weight from 0 to 100. When the governance deleted user1, a deceiving event was created which states that user1 is removed and its weight is 0 however, one step later its weight was increased to 100. This can lead to market manipulation.
Foundry
Check is it valid gauge before updating weight
require(isValidGauge[_gauge], "Invalid gauge address");
Governance
#0 - c4-pre-sort
2023-08-12T06:56:16Z
141345 marked the issue as duplicate of #36
#1 - c4-judge
2023-08-24T06:10:59Z
alcueca changed the severity to QA (Quality Assurance)