• LISA
    LISA
    • Public Scans
    • My Scans
    1. Scan
    2. ...
    2025-07-02 06:28:44
    Public
    Full Disclosure

    OWASP SC01-03 Contracts Audit

    high11
    Created By:
    Credit Usage:

    The burn function lacks access control, allowing any user to burn tokens from any account.

    HIGH

    Description

    The burn function is publicly accessible without any access control checks. This allows any user to call the function and burn tokens from any account, leading to unauthorized reduction of balances and potential loss of funds for users. Attackers can exploit this to arbitrarily destroy tokens held by other addresses, disrupting the contract's intended economic model.

    Recommendation

    Restrict access to the burn function using appropriate access control mechanisms. For example, use require(msg.sender == account) to ensure only the account owner can burn their own tokens, or implement role-based access control (e.g., OpenZeppelin's Ownable or AccessControl libraries) to restrict burning to authorized addresses.

    Affected Lines

    Line 7 – 9

    Incorrect totalLendingPool update on withdrawal leading to accounting error

    HIGH

    Description

    The withdraw function decreases the user's balance but does not decrease the totalLendingPool. This causes totalLendingPool to inaccurately represent the actual pooled ETH, as withdrawals reduce the contract's ETH balance without adjusting the total. This discrepancy can lead to incorrect calculations in functions relying on totalLendingPool (e.g., interest calculations, liquidity checks), potentially allowing exploitation of the inflated total.

    Recommendation

    Decrease totalLendingPool by amount in the withdraw function after transferring ETH to maintain accurate accounting.

    Affected Lines

    Line 13 – 19

    Unrestricted access to mintReward allows arbitrary balance inflation

    HIGH

    Description

    The mintReward function is publicly callable by any address, allowing anyone to arbitrarily increase any user's balance. This can be exploited to mint unlimited rewards, drain the contract's ETH via withdrawals, or disrupt the system's economic balance.

    Recommendation

    Add access control (e.g., a modifier like onlyOwner or a designated role check) to restrict mintReward to authorized addresses.

    Affected Lines

    Line 21 – 23

    Incorrect collateral value calculation due to missing decimal adjustment

    HIGH

    Description

    The borrow function multiplies the price by the amount without considering the price feed's decimals. If the price feed uses 8 decimals (e.g., Chainlink), the collateral value is overestimated by 1e8, leading to incorrect loan collateralization. This allows users to borrow more than allowed or prevents legitimate borrowing due to inflated collateral requirements.

    Recommendation

    Adjust the calculation by dividing by the price feed's decimal factor. For example, if the price has 8 decimals: (uint256(price) * amount) / 1e8;

    Affected Lines

    Line 21 – 21

    Missing check for price feed staleness

    HIGH

    Description

    The contract does not verify if the price from the oracle is fresh. Using outdated price data (e.g., due to oracle downtime) can result in incorrect collateral valuations, leading to undercollateralized loans or unfair liquidations.

    Recommendation

    Check the price feed's timestamp to ensure it's updated within an acceptable time window (e.g., last updated within 1 hour).

    Affected Lines

    Line 18 – 18

    Missing state updates in core functions

    HIGH

    Description

    The borrow and repay functions do not modify any state variables, making the contract unable to track user positions. This renders the borrowing/repayment functionality non-operational as no debt or collateral is recorded.

    Recommendation

    Implement state variables to track user debts and collateral. Update these variables in borrow and repay to reflect loan positions.

    Affected Lines

    Line 17 – 22

    The burn function lacks access control, allowing any user to burn tokens from any account.

    HIGH

    Description

    The burn function is publicly accessible without any access control checks. This allows any user to call the function and burn tokens from any arbitrary account, leading to unauthorized balance reductions. Attackers can exploit this to maliciously destroy tokens belonging to other users, violating the contract's intended access controls and causing direct financial harm.

    Recommendation

    Restrict access to the burn function using an access control modifier (e.g., onlyOwner). Implement a role-based mechanism (like OpenZeppelin's Ownable or AccessControl) to ensure only authorized addresses can invoke this privileged operation.

    Affected Lines

    Line 7 – 9

    Unauthorized minting of rewards due to missing access control

    HIGH

    Description

    The mintReward function is publicly accessible without any access control, allowing any user to arbitrarily increase any address's balance. This can lead to unauthorized inflation of balances, enabling attackers to drain the contract's ETH via withdrawals or disrupt reward mechanisms.

    Recommendation

    Restrict the mintReward function with access control (e.g., using onlyOwner modifier) to ensure only authorized entities can mint rewards.

    Affected Lines

    Line 21 – 23

    Missing update to totalLendingPool during withdrawal leading to incorrect accounting

    HIGH

    Description

    The withdraw function deducts the user's balance but does not reduce totalLendingPool. This causes totalLendingPool to overstate the contract's actual ETH balance, leading to insolvency when subsequent withdrawals exceed the real available funds. The discrepancy can also disrupt other logic relying on accurate pool tracking.

    Recommendation

    Decrement totalLendingPool by amount in the withdraw function to maintain accurate accounting of the total pool.

    Affected Lines

    Line 13 – 19

    Missing check for stale price data from oracle

    HIGH

    Description

    The contract uses the latest price from the oracle without verifying if the data is recent. If the price feed returns outdated data (e.g., due to a halted oracle), the contract may use incorrect prices for collateral valuation, leading to undercollateralized loans or incorrect borrowing limits.

    Recommendation

    Integrate checks for the timestamp of the price data. For example, if using Chainlink, retrieve latestRoundData which includes a timestamp, and ensure it is within an acceptable threshold (e.g., less than 24 hours old).

    Affected Lines

    Line 18 – 18

    Incorrect handling of price feed decimals leading to miscalculations

    HIGH

    Description

    The contract multiplies the price directly by the amount without adjusting for the price feed's decimals. This can cause collateral value to be vastly overestimated or underestimated, leading to improper loan approvals or liquidations.

    Recommendation

    Determine the decimals of the price feed (e.g., 8 for Chainlink) and adjust the calculation. For example, divide by 10**decimals to normalize the value: collateralValue = (uint256(price) * amount) / (10 ** priceFeedDecimals);.

    Affected Lines

    Line 21 – 21