Open c4-bot-3 opened 9 months ago
0xRobocop marked the issue as duplicate of #151
0xRobocop marked the issue as duplicate of #260
0xA5DF marked the issue as satisfactory
0xA5DF marked the issue as selected for report
Changing to med since setDistributableERC20s()
is a function rarely called, and this would only be relevant if we're after min distribution period has passed since the last distribution.
0xA5DF changed the severity to 2 (Med Risk)
Hi @0xA5DF, I think this issue should be invalid.
This issue arises solely due to owner misbehaviour/error, which is a centralization risk and should be included in analysis reports. Changing the configuration of distributable ERC20 tokens in the middle of the distribution period is the owner's fault and not expected behaviour.
Please consider re-evaluating this issue, thank you.
The submission talks about a scenario where the owner sent out the tx when there was no distribution going on and a malicious actor front runs it. This is a likely scenario and isn't due to an error on the admin side (the admin can prevent this by running distribution first, but there's no way for the average admin to guess that running this tx without distributing first would cause any issues). Therefore I'm maintaining med severity.
Lines of code
https://github.com/code-423n4/2024-02-althea-liquid-infrastructure/blob/bd6ee47162368e1999a0a5b8b17b701347cf9a7d/liquid-infrastructure/contracts/LiquidInfrastructureERC20.sol#L441 https://github.com/code-423n4/2024-02-althea-liquid-infrastructure/blob/bd6ee47162368e1999a0a5b8b17b701347cf9a7d/liquid-infrastructure/contracts/LiquidInfrastructureERC20.sol#L222
Vulnerability details
Impact
Double claim, DOS by bricking distribution, few holders can lose some rewards due to missing validation of distribution timing when owner calling LiquidInfrastructureERC20::setDistributableERC20s.
This issue will be impact on following ways :
when a new token is accepted by any nft it should be added as a desirable token, or a new managerNFT with a new token, then also LiquidInfrastructureERC20::setDistributableERC20s has to be called to distribute the rewards. so when owner calls LiquidInfrastructureERC20::setDistributableERC20s which adds a new token as desired token,
erc20EntitlementPerUnit
is now changed - Now the actual owner tx is processed, which increases/decreases the size ofdistributableERC20s
array. - But now distribution is not possible because the Out of Bound revert on the distribution function becausedistributableERC20s
array is changed, buterc20EntitlementPerUnit
array size is same before thedistributableERC20s
array is modified.Double claim by a holder: so some holder can DOS by - A last holder of the 10 holders array frontrun this owner tx (setDistributableERC20s) and calls LiquidInfrastructureERC20::distribute with 90% of the holders count as params, so all the rewards of old desirable tokens will be distributed to 9 holders. - Now after the owners action, backrun it to distribute to the last holder, which will also receive new token as rewards. - The previous holders can also claim their share in the next distribution round, but the last holder also can claim which makes double claim possible, which takes a cut from all other holders.
if owner calls LiquidInfrastructureERC20::setDistributableERC20s which removes some token, then any token balance in the contract will be lost until the owner re-adds the token, and it can be distributed again.
Proof of Concept
The logs of the POC shows the revert
Index out of bounds
First run
forge init --force
then runforge i openzeppelin/openzeppelin-contracts@v4.3.1
and modifyfoundry.toml
file into belowsrc = "contracts"
src = "src" out = "out" libs = ["lib"]
Then copy the below POC into
test/Test.t.sol
and runforge t --mt test_POC -vvvv
Tools Used
Manual review + foundry testing
Recommended Mitigation Steps
Modify LiquidInfrastructureERC20::setDistributableERC20s to only change the desirable tokens after a potential distribution for fair reward sharing.
Assessed type
DoS