Typo in price1 calculation.
The price1 calculation in a smart contract used the stable0 value instead of stable1, causing the pairFor function to return an incorrect address. This would most likely cause a revert, but in an extreme scenario could return a wrong price.
Canto
Originally disclosed on Code4rena
price1 calculation used stable0 value instead of stable1. It will cause pairFor function to return wrong address and most likely cause a revert. In extreme scenario it could return wrong price.
https://github.com/Canto-Network/lending-updates/blob/8f1e624a74ea67e63400209dded2bb716d92e472/src/Swap/BaseV1-periphery.sol#L539
STATUS: Mitigated
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 a copy-paste or variable mix-up where stable0 was used instead of stable1 in the price1 calculation.
Impact
Most likely causes a revert, but in an extreme scenario could return a wrong price.
What the attacker needed
None
The fix
The issue was mitigated according to the report status.
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 smart contract is a program that runs on a blockchain. A typo in the code made it use the wrong variable when calculating a price, which could make the function fail or, in rare cases, give an incorrect price.
What is Smart contracts?
Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.