Phoenix-Protocol-Group / phoenix-contracts

Source code of the smart contracts of the Phoenix DeFi hub DEX protocol
GNU General Public License v3.0
10 stars 6 forks source link

PHOAM-011: Admin can halt swaps by setting maximum spread values out of bounds #339

Closed gangov closed 1 month ago

gangov commented 2 months ago

Location

./contracts/pool/src/contract.rs:527
./contracts/pool_stable/src/contract.rs:510

Description A pool administrator can halt all swaps by setting an invalid max_allowed_spread_bps value. This is possible because the privileged update_config function does not perform range checks on the max_allowed_spread_bps parameter of type i64, allowing it to take forbidden (e.g., negative) values.

An invalid max_allowed_spread_bps value will cause the following check in the swap function to revert on every call, thereby halting swaps.

Recommendation Ensure that the new max_allowed_spread_bps falls within a valid swap spread range.