Skip to content

Latest commit

 

History

History
56 lines (37 loc) · 2.08 KB

File metadata and controls

56 lines (37 loc) · 2.08 KB

Acidic Midnight Mustang

Medium

Malicious users can DoS users attempting to perform a max investment

Summary

After a KYC'd user is provided signature, any wallet can call on their behalf and invest on their behalf.

        // update kyc address and total amounts invested for this investment round (in stablecoin terms)
        kycAddressInvestedPerRound[_params.kycAddress][
            _params.investmentRound
        ] += postFeeStableAmountEquivalent;
        totalInvestedPerRound[_params.investmentRound] += postFeeStableAmountEquivalent;

        // transfer tokens from msg.sender to this contract (in payment token terms)
        IERC20(_params.paymentTokenAddress).safeTransferFrom(
            msg.sender,
            address(this),
            _params.amountToInvest
        );

Any time a user wishes to invest, there's 2 restrictions they have to comply with:

  1. their new total investment must not exceed their allowed limit
  2. the total invested amount should not exceed the cap.

This means that any time a KYC'd user attempts to max invest, a malicious user can front-run them and invest a dust amount, just so that their new total now exceeds the limit and ultimately the transaction reverts.

As the investments and the signature have a deadline, this would allow for a malicious user to fully DoS a investor out of the investment.

Root Cause

Lack of access control. Having certain caps set.

Attack Path

  1. User is given a max investment of $2000.
  2. User wishes to invest for the total $2000 and they submit such transaction.
  3. Griefer sees said transaction and front-runs it, investing a dust amount.
  4. User's tx now reverts due to exceeded cap
  5. Repeat steps 2-4 until either the deadline of the signature or of the investment round comes

Impact

Investor might be forced out of the investment round.

Affected Code

https://github.com/sherlock-audit/2024-11-vvv-exchange-update/blob/main/vvv-platform-smart-contracts/contracts/vc/VVVVCInvestmentLedger.sol#L189

Mitigation

If investment exceeds limit, instead of reverting, invest up to the cap.