Skip to content

Sherlock

Perennial V2 Update #1

Every publicly disclosed report for Perennial V2 Update #1 and what kind of bugs they were.

disclosed reports
58
most reported class
Business logic
bug classes found
4
first disclosure
2023
Find Perennial V2 Update #1 on bugbounty.fyi Current scope, rewards and status, if it runs a public program.

Disclosed reports

Newest first. Only what Perennial V2 Update #1 chose to make public.

Business logic

MultiInvoker closableAmount the calculation logic is wrong

The MultiInvoker contract incorrectly calculates the closable amount by using the latest position's magnitude instead of the pending position's magnitude when updating the previous magnitude in a loop. This can cause the liquidation fee calculation to be wrong, potentially leading to reverts in some liquidation cases.

Perennial V2 Update #1

Medium
Business logic

Invalid oracle version can cause the `maker` position to exceed `makerLimit`, temporarily or permanently bricking the Market contract

When an oracle version is invalid, pending positions are invalidated and accumulated without applying position limit checks, which can push the global maker position above the maker limit. This causes all market updates to revert, temporarily or permanently bricking the contract and preventing users from withdrawing funds.

Perennial V2 Update #1

Medium
Business logic

`KeeperOracle.request` adds only the first pair of market+account addresses per oracle version to callback list, ignoring all the subsequent ones

The KeeperOracle.request function returns early if the oracle version was already requested, so only the first market and account are added to the callback list for that version. As a result, subsequent markets and accounts that requested the same oracle version are never called back when the oracle settles.

Perennial V2 Update #1

Medium
Business logic

Vault `_maxDeposit` incorrect calculation allows to bypass vault deposit cap

The vault's maximum deposit calculation incorrectly adds claimable assets to the cap, allowing users to deposit beyond the vault's deposit cap when there are redeemed but unclaimed assets. An attacker could repeatedly deposit and redeem to bypass the cap and deposit unlimited funds.

Perennial V2 Update #1

Medium
Audit finding

interfaceFee Incorrectly converted uint40 when stored

The interface fee amount is checked against a uint48 maximum but stored as uint40, so values above about 1.1M are truncated, potentially to zero. An attacker or user could set a large interface fee that is saved incorrectly, leading to a smaller or zero fee being charged when the order executes.

Perennial V2 Update #1

Medium
Business logic

Vault leverage can be increased to any value up to min margin requirement due to incorrect `maxRedeem` calculations with closable and `LEVERAGE_BUFFER`

The vault's maxRedeem calculation incorrectly multiplies the closable amount by LEVERAGE_BUFFER, allowing a user to redeem more collateral than the position reduction permits. This can leave the vault with a small position and little collateral, effectively increasing leverage beyond the configured limit and exposing depositors to liquidation risk.

Perennial V2 Update #1

High
Business logic

Vault max redeem calculations limit redeem amount to the smallest position size in underlying markets which can lead to very small max redeem amount even with huge TVL vault

The vault's maximum redeem amount was limited by the smallest open position across underlying markets, so a tiny position in one market could cap redemptions at a very small amount even for a large vault. An attacker could not directly exploit this, but users with large deposits would need many transactions to redeem, losing funds to gas or being unable to redeem at all.

Perennial V2 Update #1

High
Business logic

MultiInvoker doesn't pay keepers refund for l1 calldata

The MultiInvoker contract did not include the L1 calldata fee in the keeper refund because it inherited from the base Kept contract, which returns zero for calldata fee. As a result, keepers might not be sufficiently incentivised to execute orders.

Perennial V2 Update #1

Medium
Business logic

Settlement fee of unused markets is still charged in Vault

A vault charges the fixed settlement fee of every registered market, including markets whose weight has been set to zero to retire them. Because those fees are deducted from the amount users can claim, each settlement leaks funds from vault users.

Perennial V2 Update #1

Medium
Business logic

It is possible to open and liquidate your own position in 1 transaction to overcome efficiency and liquidity removal limits at almost no cost

The protocol's margin check only verified the current position's margined amount, while the largest settled position was checked against the lower maintained amount. This allowed a user to reduce their position, withdraw collateral to the liquidation edge, commit a favourable oracle price, and liquidate their own position in one transaction, bypassing efficiency and liquidity removal limits.

Perennial V2 Update #1

Medium
Business logic

Pending keeper and position fees are not accounted for in vault collateral calculation which can be abused to liquidate vault when it's small

The vault calculates its collateral using market collateral values that exclude pending keeper and position fees, while the underlying market includes those fees in health checks. An attacker could make many small deposits to inflate fees, artificially increasing the vault's actual leverage and potentially liquidating it.

Perennial V2 Update #1

Medium
Business logic

commitRequested() front-run malicious invalid oralce

The commit and commitRequested functions both update the same last-committed publish time and reject any price whose publish time is not newer. An attacker can front-run a keeper's commitRequested call with a crafted commit call, which advances that timestamp and makes the keeper's transaction revert, leaving the oracle version uncommitted.

Perennial V2 Update #1

Medium
Business logic

`_accumulateFunding()` maker will get the wrong amount of funding fee

The funding fee calculation for the maker side in `_accumulateFunding()` is incorrect, causing the maker to receive the entire funding fee instead of a proportional share when the skew between long and short positions exceeds the maker's position. An attacker could exploit this to unfairly gain funding fees at the expense of other participants.

Perennial V2 Update #1

Medium
Business logic

Invalid oracle versions can cause desync of global and local positions making protocol lose funds and being unable to pay back all users

The protocol's global and local position settlement can follow different paths when an oracle version is invalid, causing a temporary desync in profit and loss accounting. This can lead to incorrect collateral balances, allowing some users to withdraw more than deposited and leaving the last user unable to withdraw all funds.

Perennial V2 Update #1

High
Business logic

PythOracle:if price.expo is less than 0, wrong prices will be recorded

The PythOracle contract's _recordPrice function mishandles prices with negative exponents, recording them as positive exponents instead. This causes a massive deviation in recorded prices, potentially leading to incorrect payoffs.

Perennial V2 Update #1

High
Business logic

PythOracle `commit()` function doesn't require (nor stores) pyth price publish timestamp to be after the previous commit's publish timestamp, which makes it possible to manipulate price to unfairly liquidate users and possible stealing protocol funds

The PythOracle contract's commit() function does not enforce that the Pyth price publish timestamp is later than the previous commit's publish timestamp, unlike commitRequested(). This allows an attacker to commit prices out of order, potentially causing unfair liquidations or loss of protocol funds.

Perennial V2 Update #1

Medium