Skip to content

Sherlock

Ajna #2

Every publicly disclosed report for Ajna #2 and what kind of bugs they were.

disclosed reports
51
most reported class
Business logic
bug classes found
3
first disclosure
2023
Find Ajna #2 on bugbounty.fyi Current scope, rewards and status, if it runs a public program.

Disclosed reports

Newest first. Only what Ajna #2 chose to make public.

DoS

Function `_indexOf` will cause a settlement to revert if `auctionPrice > MAX_PRICE`

In ERC721 pools with fractional collateral, settling an auction when the auction price exceeds MAX_PRICE causes a revert because the bucket index lookup rejects prices above MAX_PRICE. This temporarily prevents settlement until the auction price drops below MAX_PRICE, potentially disadvantaging the borrower.

Ajna #2

Medium
Business logic

First pool borrower pays extra interest

The first borrower from a pool pays extra interest because the interest accumulator (inflator) is not updated when the pool has no debt before the borrow. An attacker could create a pool long before announcing it, causing the initial borrower to lose a significant amount to interest.

Ajna #2

Medium
Business logic

Reserves can be stolen by settling artificially created bad debt from them

The protocol's collateral withdrawal check relies solely on the LUP (lowest utilized price), which can be artificially inflated by adding quote tokens to a high-priced bucket. An attacker controlling both lender and borrower accounts can withdraw most collateral, then kick the loan and settle the resulting bad debt from pool reserves, stealing those reserves.

Ajna #2

High
Business logic

Incorrect implementation of `BPF` leads to kicker losing rewards in a `take` action

The bond payment factor calculation in the Ajna protocol's take function incorrectly sets the sign to zero when the threshold price is greater than or equal to the neutral price and the auction price equals the neutral price, resulting in a bond payment factor of zero instead of the bond factor. This causes the kicker to lose rewards and the borrower to face higher penalties.

Ajna #2

Medium
Business logic

Limit index isn't checked in repayDebt, so user control is void

The repayDebt function accepts a limit index meant to protect the borrower against an unfavourable change in the pool's price, but the check enforcing that limit only ran when collateral was also being pulled. A borrower whose strategy depended on the resulting price move could therefore have a repayment execute at a worse level than they intended.

Ajna #2

Medium
Business logic

LenderActions's moveQuoteToken can create a total debt undercoverage

The moveQuoteToken function in Ajna's LenderActions contract does not check that total pool debt remains less than total deposits after moving quote tokens, and the unutilized deposit fee can reduce deposits, potentially causing debt to exceed deposits. This could break the pool's core logic and lead to material miscalculations, though the probability is low.

Ajna #2

Medium
Business logic

Debt write off can be prohibited by HPB depositor by continuously allocating settlement blocking dust deposits in the higher buckets

A high-price bucket depositor can prevent their deposit from being used to settle bad debt by adding many tiny quote token deposits to higher price buckets, which makes the settlement loop process only dust amounts and become prohibitively expensive. This allows the depositor to avoid a loss while other depositors bear the bad debt.

Ajna #2

High
Business logic

kickWithDeposit removes the deposit without HTP pool state check

The kickWithDeposit function removes deposit from the pool without checking that the new lowest utilized price (LUP) remains above the highest threshold price (HTP), breaking a core invariant. An attacker could cause the pool to enter a state where LUP < HTP, potentially freezing other deposit operations.

Ajna #2

High
Business logic

Lenders lose interests and pay deposit fees due to no slippage control

The addQuoteToken function lacks slippage protection, so a lender's deposit may be processed after the LUP has moved, causing them to be charged a deposit fee and earn no interest. An attacker could front-run to manipulate the LUP and force the victim to pay fees.

Ajna #2

Medium
Business logic

Wrong Inflator used in calculating HTP to determine accrualIndex in accrueInterest

The accrueInterest function calculates the HTP using the new inflator (which includes newly accrued interest) while the LUP uses the old inflator, causing the accrual index to be set incorrectly. This leads to an underestimation of interestEarningDeposit and incorrect lenderFactor values.

Ajna #2

Medium
Business logic

Pool's kickWithDeposit misses liquidation debt check

The kickWithDeposit function in the Ajna protocol's Pool contract lacked the _revertIfAuctionDebtLocked check that prevents removal of quote token deposits locked by liquidation debt. An attacker could use kickWithDeposit to withdraw funds from high-priced buckets (HPBs) that should have been reserved for covering bad debt, potentially shifting losses to lower-bucket depositors.

Ajna #2

High
Business logic

Due to excessive HTP check moveQuoteToken can be unavailable for big deposits

The moveQuoteToken function checks the loan book's HTP against the LUP after removing the deposit but before adding it to the destination bucket, so a move that would be safe overall can revert. This can make it impossible for depositors with large deposits to move funds between buckets, potentially causing losses.

Ajna #2

Medium
Business logic

moveQuoteToken updates pool state using intermediary LUP, biasing pool's interest rate calculations

The moveQuoteToken function calculated the pool's LUP (lup) after removing liquidity from the source bucket but before adding it to the destination bucket, so the pool's interest rate state was updated with an intermediate LUP that did not reflect the final pool state. This systematically biased the pool's target utilisation and interest rate calculations.

Ajna #2

High
Business logic

`moveQuoteToken()` can cause bucket to go bankrupt but it is not reflected in the accounting

The moveQuoteToken() function lacks the bankruptcy check present in removeQuoteToken(), so a bucket can be left with zero collateral and zero quote tokens but non-zero LP tokens without being marked bankrupt. A future depositor would receive fewer LP tokens than expected because their deposit is diluted by the existing LP tokens.

Ajna #2

High
Business logic

scaledQuoteTokenAmount isn't updated to be collateral sell value in the quote token constraint case of _calculateTakeFlowsAndBondChange

In the quote token constraint branch of _calculateTakeFlowsAndBondChange, scaledQuoteTokenAmount is not updated to the collateral sell value (C * p), so the kicker's bond change is calculated from an incorrect value. This causes kickers to receive a reward proportional to (1 - BFP) * BFP instead of BFP, leading to a material loss when the borrower price is below the auction price.

Ajna #2

High
Access control

Anyone who approved quote tokens to a pool can be forced to take

The take functions in ERC20Pool and ERC721Pool allow anyone to specify a callee_ address that has approved quote token spending to the pool, causing that address to pay quote tokens and receive collateral. An attacker can force any user who approved quote tokens to take on collateral, potentially of low value, while paying the quote tokens.

Ajna #2

High
Business logic

Flashloan end result isn't controlled

The flash loan functions in Ajna pools do not verify that the borrowed tokens are returned after the callback, relying only on the token's safeTransfer to report success. An attacker could exploit a token that reports successful transfers but does not update internal balances to steal the entire pool's balance of that token.

Ajna #2

Medium
Business logic

Interest rate for pool is bounded wrongly

The pool deployment contract uses inclusive comparison operators for the interest rate bounds, so pools with rates exactly at the documented minimum (1%) or maximum (10%) are rejected. This means only rates strictly between 2% and 9% can be used, contrary to the intended 1-10% range.

Ajna #2

Medium
Business logic

user can drawDebt that is below dust amount

The protocol's minimum debt check only enforces the dust limit when there are fewer than 10 loans; with 10 or more loans it uses a lower average-based threshold. An attacker could create 10 accounts, each borrowing at the dust limit, so that the minimum debt becomes 10% of the dust limit, allowing further loans below the intended dust amount.

Ajna #2

Medium
Business logic

Incorrect MOMP calculation in neutral price calculation

The MOMP calculation in the Loans.update function incorrectly divides the borrower's accrued debt by the total number of loans, rather than the total pool debt. This results in a lower neutral price, causing kickers to lose their bonds more often than expected.

Ajna #2

Medium
Access control

Anyone can transfer approved LP tokens

The Pool.transferLPs function can be called by any address to transfer LP tokens that have been approved for transfer, rather than only by the token owner or the approved address. This allows an attacker to move a lender's LP tokens to the approved address at an inappropriate time, disrupting the lender's position management strategy.

Ajna #2

Medium