Skip to content

Code4rena

Basin Invitational

Every publicly disclosed report for Basin Invitational and what kind of bugs they were.

disclosed reports
19
most reported class
Business logic
bug classes found
7
first disclosure
2023
Find Basin Invitational on bugbounty.fyi Current scope, rewards and status, if it runs a public program.

Disclosed reports

Newest first. Only what Basin Invitational chose to make public.

Business logic

For extreme ratios, getRatiosFromPriceSwap will return data for which is impossible to converge into a reserve

The lookup table function getRatiosFromPriceSwap returns a wide price range for certain extreme prices, causing the reserve calculation loop to oscillate and never converge, returning a value far from the target. An attacker could exploit this to obtain incorrect reserve calculations, potentially disrupting the protocol's functionality.

Basin Invitational

Medium
Access control

WellUpgradeable can be upgraded by anyone

The WellUpgradeable contract's _authorizeUpgrade function lacks an onlyOwner modifier, allowing any address to call upgradeTo and upgradeToAndCall. An attacker could upgrade the contract to a malicious implementation, compromising its integrity and potentially causing total fund loss.

Basin Invitational

High
Business logic

Incorrectly assigned decimal1 parameter upon decoding

The decodeWellData function incorrectly checks decimal0 instead of decimal1 when defaulting to 18 decimals, causing decimal1 to be set to 18 regardless of its actual value. This leads to incorrect scaling of token reserves, potentially causing overvaluation or undervaluation of token amounts and prices in various functions.

Basin Invitational

High
Smart contracts

Due to bit-shifting errors, reserve amounts in the pump will be corrupted, resulting in wrong oracle values

A bit-shifting error in the storeBytes16 function caused the upper 128 bits of a storage slot to overwrite the lower 128 bits of another slot, corrupting reserve amounts and leading to wrong oracle values. An attacker could potentially manipulate the pump's reserve data, though the impact was limited because the incorrectly shifted bytes were never non-zero.

Basin Invitational

Medium
Business logic

Useless Modifier and Bad Assumptions in Constructor

The report claims a useless modifier in an empty constructor and a bad assumption that the block time remains constant, which could cause functions like readInstantaneousReserves to work incorrectly if the block time changes. The judge increased severity to Medium, but the project acknowledged the first item as a duplicate QA report and the second as a duplicate of another issue.

Basin Invitational

Medium
Leaked secrets

Single hardcoded cap used for multiple tokens in a pump causing some assets to be more stale, while having no effects on other stable assets

The MultiFlowPump contract uses a single hardcoded cap for maximum percentage change in token reserves, applied to all tokens regardless of their volatility. This can cause volatile assets to be capped more than normal trading activity, or stable assets to be allowed to deviate more than usual, distorting the pump's moving averages and potentially enabling price manipulation.

Basin Invitational

Medium
Smart contracts

Due to slot confusion, reserve amounts in the pump will be corrupted, resulting in wrong oracle values

The MultiFlowPump contract stores reserve counts using libraries that pack bytes16 values, but in two functions the wrong storage slot is read when the number of reserves is odd, causing the lower 128 bits of one slot to be overwritten with a value from a different slot. This corrupts reserve amounts in the pump, leading to wrong oracle values.

Basin Invitational

Medium
Memory corruption

Memory corruption in getBytes32FromBytes() can likely lead to loss of funds

The getBytes32FromBytes function in the LibBytes library has an incorrect out-of-bounds check: when the requested index equals the data length, it reads memory beyond the bytes array instead of returning zero. An attacker could cause callers to receive arbitrary incorrect data, potentially leading to incorrect pricing or loss of funds if used in reserve calculations.

Basin Invitational

Medium
Smart contracts

Aquifer is vulnerable to Metamorphic Contract Attack

The Aquifer contract allows deploying Well contracts via create2 with a salt, and if the implementation contract can self-destruct, an attacker can redeploy a different implementation to the same address and then deploy a new Well to the same address with different logic. This could cause users to interact with a Well whose behaviour differs from what they expect.

Basin Invitational

Medium
DoS

Long term denial of service due to lack of fees in Well

The Well AMM charges no fees, so an attacker can sandwich a victim's swap with two trades that move the price beyond the victim's slippage limit, causing the victim's transaction to revert. The attacker's tokens are restored by the constant product formula, so the only cost is gas.

Basin Invitational

Medium
Business logic

addLiquidity Sandwich Attack for unbalanced token deposits

A liquidity provider who deposits tokens in an imbalanced ratio can be front-run by an attacker who adds liquidity in the same imbalanced way and then immediately removes it after the victim's deposit, stealing a significant portion of the victim's funds. The report demonstrates that the attacker can gain nearly 30% of the victim's deposited tokens.

Basin Invitational

Medium
Business logic

The constant product invariant can be broken.

The constant product invariant of a liquidity pool can be broken because the sync function updates reserves without updating the LP token supply. An attacker can donate tokens and call sync to make removeLiquidityImbalanced revert, causing a temporary denial of service for that function.

Basin Invitational

Medium
Race condition

boreWell can be frontrun/DoS-d

The boreWell function in the Aquifer contract uses a publicly visible salt parameter when creating new Wells. An attacker can frontrun a user's transaction with the same salt to either capture the deposit intended for that Well or cause the user's transaction to revert, repeatedly blocking Well creation.

Basin Invitational

Medium
Business logic

Transferout exclusive feeOnTransfer tokens will run out of well

The Well contract does not account for fee-on-transfer tokens that deduct fees from the sender, so each transfer out reduces the Well's actual token balance below its stored reserves. An attacker could repeatedly swap and skim to drain the Well's funds.

Basin Invitational

Medium
Audit finding

There is a large precision error in sqrt calculation of lp

The square root calculation used to determine LP token supply has a larger precision error than division, causing excess reserve tokens to remain in the contract when users add liquidity with imbalanced reserves. An attacker could monitor the contract and withdraw these accumulated excess reserves via removeLiquidityImbalanced.

Basin Invitational

Medium