Platform: Code4rena
Start Date: 12/04/2023
Pot Size: $60,500 USDC
Total HM: 21
Participants: 199
Period: 7 days
Judge: hansfriese
Total Solo HM: 5
Id: 231
League: ETH
Rank: 190/199
Findings: 1
Award: $0.07
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: decade
Also found by: 0x3b, 0xDACA, 0xWaitress, 0xWeiss, 0xkaju, Arz, Aymen0909, BPZ, EloiManuel, HaCk0, J4de, Jerry0x, Jiamin, John, Juntao, Kek, Lalanda, MiloTruck, Mukund, PNS, RedTiger, Ruhum, Satyam_Sharma, ToonVH, Tricko, Udsen, ak1, anodaram, bin2chen, carrotsmuggler, cccz, circlelooper, deadrxsezzz, giovannidisiena, jasonxiale, joestakey, juancito, karanctf, kenta, kodyvim, ladboy233, lil_eth, lukino, markus_ether, marwen, mrpathfindr, nobody2018, parlayan_yildizlar_takimi, peakbolt, ravikiranweb3, rbserver, rvierdiiev, silviaxyz, volodya, zhuXKET, zzebra83
0.0748 USDC - $0.07
The restructureCapTable
function is designed to wipe the balances of other accounts in the event that the system is at high risk and FPS holders want to restructure the system. It takes as input an array called addressesToWipe
containing the addresses whose balances should be burned. However, the current implementation of the function only burns the balance of the first address in the array, leaving all others untouched. This could lead to unexpected scenarios where balances are not properly burned, posing a significant risk to the system. While making multiple calls could be a solution, this would result in additional gas costs. Therefore, a more effective approach would be to update the function to correctly burn the balances of all addresses in the addressesToWipe
array, thereby mitigating the risk posed by the current implementation.
In the code they loop over all addresses and try to set their balances to zero.
The code has a bug that causes it to always take the 0th address instead of the ith address during each iteration. As a result, only the balance of the first address is burned.
manual analysis
To mitigate the issue, the loop in the restructureCapTablefunction should be updated to iterate over each address in the
addressesToWipe` array, and burn the balance of each account. This can be achieved by changing the loop to the following:
for (uint256 i = 0; i<addressesToWipe.length; i++){ address current = addressesToWipe[i]; _burn(current, balanceOf(current)); }
This will ensure that the balances of all accounts in the addressesToWipe
array are burned.
#0 - c4-pre-sort
2023-04-20T14:23:35Z
0xA5DF marked the issue as duplicate of #941
#1 - c4-judge
2023-05-18T14:28:12Z
hansfriese marked the issue as satisfactory