Wrong logic around areOperatorsImported
The areOperatorsImported function used a logical AND instead of OR when comparing operator implementation and selector, so it could return true even if only one field matched. An attacker could exploit this to cause the owner to skip importing a corrected operator, potentially leading to token loss.
Submitted by 0x1f8b, also found by 0xliumin and kenzo
The logic related to the areOperatorsImported method is incorrect and can cause an operator not to be updated because the owner thinks it is already updated, and a vulnerable or defective one can be used.
Proof of Concept
The operators mapping is made up of a key bytes32 name and a value made up of two values: implementation and selector, both of which identify the contract and function to be called when an operator is invoked.
The areOperatorsImported method tries to check if the operators to check already exist, however, the check is not done correctly, since && is used instead of ||.
If the operator with name A and value {implementation=0x27f8d03b3a2196956ed754badc28d73be8830a6e,selector="performSwapVulnerable"} exists, and the owner try to check if the operator with name A and value {implementation=0x27f8d03b3a2196956ed754badc28d73be8830a6e,selector="performSwapFixed"} exists, that function will return true, and the owner may decide not to import it , producing unexpected errors. Because operators manage the tokens, this error can produce a token lost.
Recommended Mitigation Steps
Change && by ||
maximebrugel (Nested Finance) confirmed and resolved:
harleythedog (judge) commented:
Good catch, I agree with severity.
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
Impact
Because operators manage tokens, this error could cause the owner to not update a vulnerable operator, potentially leading to token loss.
What the attacker needed
Owner must attempt to import an operator; operator with same name but different selector exists
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.
This is a smart contract bug where a function that checks if an operator is already imported uses the wrong logical operator. It uses AND instead of OR, so it says 'yes' even when only part of the operator matches. This could make the owner think a fixed operator is already in place, but the old vulnerable one is still used, risking lost tokens.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.