Skip to content
Audit finding Advanced

Wrong LP price calculated

The LP token price calculation read the total supply directly from current storage rather than a time-averaged value. An attacker could use a flash loan to manipulate that supply and change the calculated LP token price.

Canto

Originally disclosed on Code4rena

TotalSupply amount is read directly from storage.

Attacker can manipulate that amount using a flash loan and change the calculated LP token price. This is also an issue during regular calculation because the TVL is calculated based on time-averaged values but total supply is a current block value which will result consistently incorrect results.

https://github.com/Canto-Network/lending-updates/blob/06a77049bb1bb41b32c1eed1fcdcc23587696f62/src/Swap/BaseV1-periphery.sol#L544

STATUS: Mitigated

The original report as published on Code4rena. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the price formula mixed a time-averaged TVL with a spot total supply read straight from storage, so the two inputs were not measured over the same window.

Impact

An attacker could manipulate the calculated LP token price within a single transaction, which the project mitigated.

What the attacker needed

Ability to take a flash loan

The fix

The total supply used in the price calculation should be time-averaged in the same way as the TVL, so both inputs cover the same window; the text says the issue was mitigated.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A liquidity pool token represents a share of a pool of two assets. Its price should be hard to move in a single transaction, but here one part of the calculation used a live number that anyone can change temporarily by borrowing a large amount and repaying it in the same transaction (a flash loan). That let the attacker push the price around.

More from Canto

View all

The newest disclosed reports for this program.

Similar reports

Same bug class and techniques, clearest first.