• LISA
    LISA
    • Public Scans
    • My Scans
    1. Scan
    2. ...
    2025-07-11 09:02:13
    Public
    Full Disclosure

    BankrollNetworkLife Attack

    high4medium3
    Created By:
    Credit Usage:

    Uniswap swapExactETHForTokens uses a fixed minimum amountOutMin of 1, allowing price manipulation and sandwich attacks.

    HIGH

    Description

    The buyback function calls swapExactETHForTokens with amountOutMin set to 1. This allows attackers to front-run the transaction and manipulate the price, resulting in the contract receiving far fewer tokens than expected. This can drain the contract's ETH with minimal token returns, leading to significant fund loss.

    Recommendation

    Calculate a reasonable amountOutMin based on the current price and expected slippage. For example, use the current reserves in the Uniswap pool to determine the minimum acceptable tokens, or allow a configurable slippage tolerance.

    Affected Lines

    Line 727 – 732

    Profit calculation in distribute() does not cap to available balances, leading to over-issuance of dividends.

    HIGH

    Description

    The distribute function calculates profit as share * timeElapsed without ensuring it does not exceed dividendBalance_ or swapBalance_. When profit exceeds the balance, safeSub sets the balance to zero, but the full profit is added to profitPerShare_ and rewardsProfitPerShare_. This allows users to claim more dividends than available, potentially draining the contract's funds.

    Recommendation

    Cap profit to the current dividendBalance_ and swapBalance_ before subtraction. For example, use profit = Math.min(share * timeElapsed, dividendBalance_) to prevent over-issuance.

    Affected Lines

    Line 674 – 689

    Incorrect token calculation during purchase leads to users receiving fewer tokens than expected.

    HIGH

    Description

    The purchaseTokens function miscalculates the number of tokens minted by subtracting the entry fee from the incoming ETH directly. This results in users receiving fewer tokens than intended. For example, with a 10% entry fee, sending 1.1 ETH should yield 1 token, but the code mints 0.99 tokens instead, leading to an unfair token distribution and incorrect supply.

    Recommendation

    Calculate tokens as _incomingeth * 100 / (100 + entryFee_) to correctly account for the entry fee percentage of the total cost.

    Affected Lines

    Line 760 – 765

    Buyback function uses minimal output amount of 1, risking significant slippage.

    HIGH

    Description

    The buyback function sets the minimum tokens received to 1, making it vulnerable to front-running and price manipulation. Attackers can exploit this to drain contract funds by forcing unfavorable swaps, resulting in substantial losses.

    Recommendation

    Calculate a reasonable amountOutMin using current market rates with a slippage tolerance (e.g., 99% of the expected amount).

    Affected Lines

    Line 727 – 732

    `tokenBalance` function returns ETH balance instead of token balance.

    MEDIUM

    Description

    The tokenBalance function erroneously returns the address's ETH balance instead of their token balance, causing incorrect data exposure and potential integration errors.

    Recommendation

    Return tokenBalanceLedger_[_customerAddress] to reflect the actual token holdings.

    Affected Lines

    Line 526 – 530

    Claim function does not validate ERC20 transfer success.

    MEDIUM

    Description

    The claim function does not check the return value of the token transfer. If the token uses a boolean return instead of reverting, failed transfers go unnoticed, leading to incorrect claim accounting and user losses.

    Recommendation

    Use require(token.transfer(...), "Transfer failed") or SafeERC20's safeTransfer to handle transfer failures.

    Affected Lines

    Line 322 – 322

    Unbounded distribution interval allows exceeding daily drip rate.

    MEDIUM

    Description

    The distribute function does not cap the elapsed time since the last distribution. If inactive for over 24 hours, subsequent calls distribute more than the intended 2% daily rate, potentially depleting reserves faster than designed.

    Recommendation

    Cap now.safeSub(lastPayout) to a maximum of 24 hours to enforce the daily drip limit.

    Affected Lines

    Line 674 – 674