Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ambitious Cedar Monkey - Chainlink oracle min/max answer is wrongly used #252

Open
sherlock-admin4 opened this issue Dec 31, 2024 · 0 comments

Comments

@sherlock-admin4
Copy link

Ambitious Cedar Monkey

Medium

Chainlink oracle min/max answer is wrongly used

Summary

nuAssetToEthRoundUp() can cause a DOS even when valid prices are returned from the oracle

Root Cause

https://github.com/sherlock-audit/2024-12-numa-audit/blob/main/Numa/contracts/libraries/OracleUtils.sol#L74-L78

File: nuAssetManager.sol
179:     function nuAssetToEthRoundUp(
180:         address _nuAsset,
181:         uint256 _amount
182:     ) public view returns (uint256 EthValue) {
183:         require(contains(_nuAsset), "bad nuAsset");
184:         nuAssetInfo memory info = getNuAssetInfo(_nuAsset);
185:         (address priceFeed, uint128 heartbeat) = (info.feed, info.heartbeat);
186:         return
187:    @>       tokenToEthRoundUp(


File: OracleUtils.sol
211:     function tokenToEthRoundUp(
212:         uint256 _amount,
213:         address _pricefeed,
214:         uint128 _chainlink_heartbeat,
215:         uint256 _decimals
216:     ) public view checkSequencerActive returns (uint256 EthValue) {
217:         (
218:             uint80 roundID,
219:             int256 price,

/// ...........
234:         );
235:         require(
236:    @>       ((price > int256(aggregator.minAnswer())) && 
237:                 (price < int256(aggregator.maxAnswer()))),
238:             "min/max reached"
239:         );

The problem is that the DEV wrongly assumes the minimum and maximum prices returned form the oracle are invalid and as such when the aggregator.minAnswer()/maxAnswer() are returned from the oracle, the function reverts

Internal pre-conditions

No response

External pre-conditions

No response

Attack Path

No response

Impact

This can lead to a DOS

PoC

No response

Mitigation

Consider includoing the min and max prices

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant