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

Damaged Hazelnut Wolverine - Risk of Exceeding Maximum Buy Fee Due to Unupdated Buy Fee PID #251

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

Comments

@sherlock-admin3
Copy link
Contributor

Damaged Hazelnut Wolverine

Medium

Risk of Exceeding Maximum Buy Fee Due to Unupdated Buy Fee PID

Summary

The setBuyFeeParameters function allows the contract owner to update various parameters related to the dynamic adjustment of the buy fee. However, after updating these parameters, the Buy Fee PID is not automatically recalculated. This oversight can lead to situations where the effective buy fee exceeds the maximum allowable buy fee (buyFee_max), especially when other contracts like NumaPrinter rely on these parameters without triggering an update of the Buy Fee PID.

Root Cause

https://github.com/sherlock-audit/2024-12-numa-audit/blob/ae1d7781efb4cb2c3a40c642887ddadeecabb97d/Numa/contracts/NumaProtocol/VaultManager.sol#L200

The root cause of this issue is the lack of an automatic recalculation or update of the Buy Fee PID after the parameters affecting its calculation are changed. This can result in the effective buy fee (base fee plus PID adjustment) exceeding the specified maximum (buyFee_max).

Internal pre-conditions

The contract owner calls setBuyFeeParameters to update the parameters related to the buy fee adjustment.
The Buy Fee PID is not recalculated immediately after these updates.
Current buy fees + Current buy fee PID exceed new MAX FEES

External pre-conditions

External contracts or functions, such as those in NumaPrinter, call or rely on the buy fee parameters without invoking updateBuyFeePID.
The effective buy fee (base fee plus PID) is used in calculations or transactions.

Attack Path

The contract owner updates the buy fee parameters using setBuyFeeParameters.
The Buy Fee PID is not recalculated, potentially leading to a situation where the effective buy fee exceeds buyFee_max.
External contracts or functions use the outdated buy fee parameters, leading to transactions with an excessive buy fee.

Impact

Users may incur higher fees than Max fees

PoC

No response

Mitigation

Ensure the Buy Fee PID is recalculated immediately after

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