Part 2

Zaros
PerpetualsDEXFoundrySolidity
70,000 USDC
View results
Submission Details
Severity: medium
Invalid

Asset and Fee Manipulation

Summary

The FeeDistributionBranch contract is vulnerable to asset and fee manipulation, allowing attackers or malicious users to manipulate the amounts of fees distributed, introduce invalid assets, or inflate/deflate fee values. This weakness arises due to insufficient checks and reliance on external inputs, making the contract susceptible to exploits that could disrupt fee calculations or lead to an unfair redistribution of fees.

Vulnerability Details

Potential Manipulations:

Invalid or Malicious Asset Inclusion:

The receiveMarketFee function allows any asset address to be used, without checking whether it is a valid token or part of a trusted list. Attackers can introduce fake or malicious tokens, causing disruptions in fee processing.

Fee Inflation or Deflation:

The amount parameter in receiveMarketFee is entirely controlled by the caller. Attackers can pass excessively high values to skew fee distributions or extremely low values to evade proper fee sharing mechanisms.

Manipulation in Fee Claiming:

The claimFees function lacks safeguards against assets with no accrued fees or invalid balances, allowing unnecessary gas expenditure or denial-of-service risks.

Underlying Cause:

Over-reliance on user-provided inputs (e.g., asset, amount) without verifying their validity or correctness.

Lack of controls to ensure the asset exists in an approved list or the amount is within expected bounds.

function receiveMarketFee(address asset, uint256 amount, address market) external {
feeBalances[asset] += amount;
emit MarketFeesReceived(asset, amount, market);
}

Impact

Economic Loss: Incorrect fee distributions may lead to significant losses for legitimate users or stakeholders.

Denial of Service: Introducing fake or malicious assets could consume excessive gas or cause failures in fee-related operations.

Unfair Distribution: Attackers could manipulate fees to favor specific entities or themselves, violating the fairness of the system.

Tools Used

Manual Review

Recommendations

Whitelist Valid Assets:

Maintain a mapping of approved tokens and validate all asset parameters against this whitelist.

Example:

mapping(address => bool) private approvedAssets;
function addApprovedAsset(address asset) external onlyOwner {
require(asset != address(0), "Invalid address");
approvedAssets[asset] = true;
}
function receiveMarketFee(address asset, uint256 amount, address market) external {
require(approvedAssets[asset], "Asset not approved");
// Function logic
}
Updates

Lead Judging Commences

inallhonesty Lead Judge
5 months ago
inallhonesty Lead Judge 4 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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