Submitted by KupiaSec
Creating a snapshot may be impossible due to a rounding error in the calculations.
When initiating a snapshot, some assets are transferred to the slash store within the _transferToSlashStore() function. The transfer amount is calculated at L430. However, if convertToAssets(balanceOf(nodeOwner)) exceeds node.totalRestakedETH (which could occur due to a rounding error in the calculations), the transaction will revert due to an integer underflow.
Consider the following scenario:
Note: The exchange rate formula is (totalAssets + 1) / (totalSupply + 1) as defined in ERC4626.
In this situation, Bobs snapshot will revert because convertToAssets(balanceOf(nodeOwner)) is greater than node.totalRestakedETH.
This issue arises from calculation rounding errors. As seen in the scenario above, the issue can arise even with a single increase in totalAssets, and the likelihood of this problem grows as the number of participants increases.
Additionally, attackers could exploit this vulnerability to execute a DoS attack on others snapshots by transfering DUST ethers to the nodeAddress and performing the second step of the above scenario.
The _transferToSlashStore() function should be fixed as follows:
MiloTruck (judge) commented:
karan-andalusia (Karak) commented:
KupiaSec (warden) commented:
MiloTruck (judge) increased severity to High and commented:
Karak mitigated:
Status: Mitigation confirmed. Full details in reports from sl1, KupiaSec and 0xCiphky.
