Open c4-bot-10 opened 8 months ago
confirmed
141345 marked the issue as primary issue
141345 marked the issue as sufficient quality report
Fixed main branch, meanwhile this contest was happenning
https://github.com/Abracadabra-money/abracadabra-money-contracts
0xCalibur (sponsor) confirmed
thereksfour marked the issue as satisfactory
thereksfour marked the issue as selected for report
thereksfour changed the severity to 3 (High Risk)
Hi,
The impact is that oracle ALWAYS returns price = 0. I argue that this is in line with Medium severity (like 3/4 dups submitted it) because:
@0xCalibur if you can weight in on any assumptions of integration with the Oracle setup it would be helpful.
There was a mistake, not returning the value in _getReserves. We turned on "error on warnings" during compilation on Foundry config to avoid such issues in the future. This could have been avoided easily.
This fact reduces the severity of this issue, will downgrade it to M
A price of 0 is considered invalid in Chainlink and most other feeds, the assumed behavior would be to revert. Admin can replace the feed at that time. Loss of funds seems very unlikely, it would have to be that the first time the issue is discovered it is when price of 0 is assumed legitimate and used to handle funds - is that in line with required likelihood for High?
thereksfour changed the severity to 2 (Med Risk)
Lines of code
https://github.com/code-423n4/2024-03-abracadabra-money/blob/1f4693fdbf33e9ad28132643e2d6f7635834c6c6/src/oracles/aggregators/MagicLpAggregator.sol#L34
Vulnerability details
The
MagicLpAggregator
contract contains a flaw within the_getReserves
function where it fails to return the reserve values fetched from thepair
contract. This oversight results in thelatestAnswer
function always returning zero, which can have severe implications for any systems that depend on this contract for accurate liquidity pool pricing data.Impact
The missing return statement in the
_getReserves
function leads to thelatestAnswer
function always returning zero. This affects any dependent systems or contracts that rely on accurate price data from theMagicLpAggregator
contract, as they will receive incorrect information, potentially leading to financial loss or system failure.Proof of Concept
The
_getReserves
function in the provided code snippet does not return the fetched reserves:https://github.com/code-423n4/2024-03-abracadabra-money/blob/1f4693fdbf33e9ad28132643e2d6f7635834c6c6/src/oracles/aggregators/MagicLpAggregator.sol#L33C5-L35C6
Due to the missing return statement, the latestAnswer function uses uninitialized variables for
baseReserve
andquoteReserve
, which default to zero:https://github.com/code-423n4/2024-03-abracadabra-money/blob/1f4693fdbf33e9ad28132643e2d6f7635834c6c6/src/oracles/aggregators/MagicLpAggregator.sol#L42C1-L44C69
Tools Used
Manual Review
Recommended Mitigation Steps
Update
_getReserves()
Assessed type
Other