update_emergency_council_7_D_0_C_1_C_58() updates nft manager instead of emergency council
The function intended to update the emergency council instead updates the nft manager. An attacker could not directly exploit this, but the admin calling it would change the wrong sensitive address, potentially disrupting the system.
ABAIKUNANBAEV Follow with Q7, DadeKuma and 12 others
Originally disclosed on Code4rena
Submitted by ABAIKUNANBAEV, also found by Q7, DadeKuma, ZanyBonzy, Rhaydden, Nikki, nslavchev, Testerbot, eta, d4r3d3v1l, prapandey031, zhaojohnson, oakcobalt, wasm_it, and shaflow2
Inside of lib.rs, there is a function update_emergency_council_7_D_0_C_1_C_58() that is needed to update the emergency council that can disable the pools. However, in the current implementation, nft_manager is updated instead.
Proof of Concept
This is the current functionality of update_emergency_council_7_D_0_C_1_C_58():
https://github.com/code-423n4/2024-08-superposition/blob/main/pkg/seawater/src/lib.rs#L1111-1124
pub fn update_emergency_council_7_D_0_C_1_C_58(
&mut self,
manager: Address,
) -> Result<(), Revert> {
assert_eq_or!(
msg::sender(),
self.seawater_admin.get(),
Error::SeawaterAdminOnly
);
self.nft_manager.set(manager);
Ok(())
}
As you can see, the function updates nft_manager contract instead of emergency_council that is needed to be updated. Above this function there is another function that updates nft_manager:
https://github.com/code-423n4/2024-08-superposition/blob/main/pkg/seawater/src/lib.rs#L1097-1107
pub fn update_nft_manager_9_B_D_F_41_F_6(&mut self, manager: Address) -> Result<(), Revert> {
assert_eq_or!(
msg::sender(),
self.seawater_admin.get(),
Error::SeawaterAdminOnly
);
self.nft_manager.set(manager);
Ok(())
}
As you can see here, in both of the functions nft_manager is updated which is an unexpected behavior and the contract cannot update the emergency_council that handles emergency situations:
https://github.com/code-423n4/2024-08-superposition/blob/main/pkg/seawater/src/lib.rs#L117-118
// address that's able to activate and disable emergency mode functionality
emergency_council: StorageAddress,
Recommended Mitigation Steps
Change update_emergency_council_7_D_0_C_1_C_58() to update emergency_council.
af-afk (Superposition) confirmed via duplicate issue #64
The Warden and its duplicates have correctly identified that the mechanism exposed for updating the
emergency_councilwill incorrectly update thenft_managerinstead.I initially wished to retain a medium risk severity rating for this vulnerability due to how the
emergency_councilis configured during the contract’s initialization and its value changing being considered a rare event; however, a different highly sensitive variable is altered instead incorrectly (nft_manager) which would have significant consequences to the system temporarily.Based on the above, I believe that a high-risk rating is appropriate due to the unexpected effects invocation of the function would result in.
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 error: the function body sets nft_manager instead of emergency_council.
Impact
Calling the function would incorrectly change the nft_manager address, which could have significant consequences to the system temporarily, while the emergency council remains unchanged.
What the attacker needed
Admin calls the function
The fix
The function should be changed to update emergency_council instead of nft_manager.
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 has special addresses that control important actions. One address is supposed to be changeable by an admin, but the code mistakenly changes a different address instead. This means the intended change never happens and an unintended change occurs, which could cause problems if the admin tries to update the emergency council.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.