29123 - [SC - Medium] Griefing attack for VestedZeroNFT
Last updated
Was this helpful?
Last updated
Was this helpful?
Submitted on Mar 7th 2024 at 19:12:50 UTC by @DuckAstronomer for
Report ID: #29123
Report type: Smart Contract
Report severity: Medium
Target: https://github.com/zerolend/governance
Impacts:
Griefing (e.g. no profit motive for an attacker, but damage to the users or the protocol)
Permanent freezing of funds
It is possible for anyone to call the claim()
function of the VestedZeroNFT
contract on behalf of the NFT owner. This poses an issue especially when an NFT is minted with penalty=true
. In such cases, the NFT owner ends up paying a penalty (currently 50%) and loses the ability to utilize the StakingBonus
contract.
This situation sets the stage for a Griefing attack scenario where an attacker can trigger claim()
for NFTs with penalty=true
. Consequently, the owners bear penalties and forfeit the opportunity to receive bonuses through the StakingBonus
mechanism.
https://github.com/zerolend/governance/blob/main/contracts/vesting/VestedZeroNFT.sol#L159
https://github.com/zerolend/governance/blob/main/contracts/vesting/VestedZeroNFT.sol#L211
https://github.com/zerolend/governance/blob/main/contracts/vesting/StakingBonus.sol#L74
https://github.com/zerolend/governance/blob/main/contracts/locker/BaseLocker.sol#L333
To run the Poc put it's code to the governance-main/test/Gauge.poc.ts
file, generate a random private key, and issue the following command:
PoC scenario:
The deployer generates VestedZeroNFT
with penalty=true
to the Whale.
The Ant (attacker) quickly invokes claim()
for the Whale's Nft.
As a result 50%
penalty is paid and now unclaimed()
returns 0
for the Nft.
The Whale wants to transfer Nft to the StakingBonus
contract, but their tx reverts since unclaimed()
returns 0
.