Skip to content

Code4rena

Ajna Protocol

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

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

Disclosed reports

Newest first. Only what Ajna Protocol chose to make public.

DoS

Position NFT can be spammed with insignificant positions by anyone until rewards DoS

The PositionManager contract allowed anyone to attach arbitrarily small positions to any position NFT, which could bloat the NFT's position index array. An attacker could spam an NFT with many tiny positions until reward calculation and claiming for that NFT exceeded the block gas limit, causing a denial of service.

Ajna Protocol

High
Business logic

It is possible to steal the unallocated part of every delegation period budget

The standard funding mechanism allowed any proposal with a non-negative funding vote to be included in the final slate, even with zero votes. An attacker could submit a proposal to transfer the unallocated remainder of a low-activity period to themselves and vote for it with a dust amount, stealing those funds.

Ajna Protocol

Medium
Business logic

Incorrect calculation of the remaining updatedRewards leads to possible underflow error

The rewards manager contract calculates a per-pool reward cap but compares it against a global total of rewards claimed across all pools, so the cap can be smaller than the claimed total. This causes an arithmetic underflow that reverts transactions, temporarily or permanently blocking users from unstaking their NFTs or claiming rewards for affected pools.

Ajna Protocol

High
Business logic

The lender could possibly lose unclaimed rewards in case a bucket goes bankrupt

When a lender calls memorializePositions after a bucket has gone bankrupt, the contract zeroes out the tracked LP balance, which also removes the basis for claiming any unclaimed rewards. The lender could therefore lose rewards that they would otherwise have been able to claim.

Ajna Protocol

High
Business logic

Delegation rewards are not counted toward granting fund

The treasury accounting in the Ajna grants contract fails to subtract delegation rewards when updating the treasury balance, so the recorded treasury is higher than the actual token balance. An attacker could exploit this to cause the treasury to overstate its funds, potentially leading to insolvency or misallocation of grants.

Ajna Protocol

High
Smart contracts

An Optimizer Bug in PositionManager.getPositionIndexesFiltered

The contract uses Solidity 0.8.14, which contains a known Yul optimizer bug that can remove memory writes in inline assembly. This could cause the array length to be set incorrectly, returning a wrong number of indexes.

Ajna Protocol

Medium
DoS

PositionManager.moveLiquidity could revert due to underflow

The moveLiquidity function could revert due to an underflow when subtracting the moved LP amount from the stored position LP, because the moved amount can exceed the tracked LP. An attacker could trigger this to cause a denial of service for the position owner.

Ajna Protocol

Medium
Smart contracts

PositionManager & PermitERC721 Failure to comply with the EIP-4494

The PositionManager and PermitERC721 contracts do not comply with the EIP-4494 standard for permit-based ERC-721 approvals. This means third-party tools and contracts cannot detect or correctly use the permit functionality, and nonces cannot be tracked, leading to invalid or future signatures.

Ajna Protocol

Medium
Business logic

The voting thresholds in Ajna’s Extraordinary Funding Mechanism can be manipulated to execute proposals below the expected threshold

The voting threshold for Ajna's Extraordinary Funding Mechanism is calculated from the current total token supply, so a large token holder can burn their own tokens to lower the threshold and pass a proposal that would otherwise fail. This could allow them to withdraw more funds from the treasury than the community actually approved.

Ajna Protocol

Medium
Business logic

Governance attack on Extraordinary Proposals

The vote threshold check for Extraordinary Proposals incorrectly compared a raw token amount against a sum that mixed treasury and non-treasury token slices, so the required percentage of non-treasury votes was lower than the whitepaper design. An attacker who could pass one large proposal could then drain the treasury through successive proposals with decreasing support.

Ajna Protocol

Medium
Smart contracts

Unsafe casting from uint256 to uint128 in RewardsManager

The RewardsManager contract downcasts uint256 values to uint128 without checking for overflow when recording staking data. This can cause incorrect reward calculations, including lost or inflated rewards, and potentially transaction failures.

Ajna Protocol

Medium
Business logic

missing isEpochClaimed validation

The internal reward-claiming routine does not check whether an epoch has already been claimed, and the liquidity-moving function calls it without that check. A staker could claim rewards for an epoch and then move their staked liquidity to trigger the same claim again, though the project disputed that this yields extra rewards.

Ajna Protocol

High
Business logic

Claiming accumulated rewards while the contract is underfunded can lead to a loss of rewards

The RewardsManager contract caps the amount of rewards a staker can claim at its current Ajna token balance, so if the contract holds fewer tokens than the staker's accumulated rewards, the staker receives less than earned. The shortfall is not recorded, so the remaining rewards cannot be claimed later, causing a permanent loss of rewards.

Ajna Protocol

High
Business logic

PositionManager’s moveLiquidity can set wrong deposit time and permanently freeze LP funds moved

The moveLiquidity function in PositionManager copies the source bucket's deposit time to the destination position without checking the destination bucket's bankruptcy time. If the destination bucket went bankrupt after the source deposit time, the moved LP shares become permanently frozen because later operations reject positions whose deposit time is not after the bucket's bankruptcy time.

Ajna Protocol

High