Skip to content
Business logic Audit finding Beginner

Incorrect operator used in deploySynth() of Pools.sol

The deploySynth() function in Pools.sol used a logical OR instead of AND in a require statement, so the check that the token is neither VADER nor USDV could be bypassed. An attacker could deploy VADER or USDV as a Synth, breaking protocol assumptions and potentially causing loss of funds.

Vader Protocol contest

Originally disclosed on Code4rena

The deploySynth() function in Pools.sol is expected to perform a check on the token parameter to determine that it is neither VADER or USDV before calling Factory’s deploySynth() function.

However, the require() incorrectly uses the ‘||’ operator instead of ‘&&’ which allows both VADER and USDV to be supplied as the token parameters. This will allow an attacker to deploy either VADER or USDV as a Synth which will break assumptions throughout the entire protocol. Protocol will break and funds may be lost.

Recommend changing ‘||’ operator to ‘&&’ in the require statement: require(token != VADER && token != USDV);

strictly-scarce (vader) addressed:

Duplicate https://github.com/code-423n4/2021-04-vader-findings/issues/21

0xBrian commented:

https://github.com/vetherasset/vaderprotocol-contracts/pull/159/commits/2f69f8317ce98846fbe227a3bf6ca1b644d01ff2#diff-5de3130299a0ddc914d7a906802a4cc093ed18d7a89c52a4aafefc8a11ac3f54R193

The original report as published on Code4rena. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

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 simple coding mistake where the logical OR operator was used instead of AND in a require statement, inverting the intended check.

Impact

An attacker could deploy VADER or USDV as a Synth, which would break assumptions throughout the protocol and may lead to loss of funds.

What the attacker needed

Ability to call deploySynth()

The fix

The operator in the require statement should be changed from OR to AND, and the report indicates this was addressed.

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.

Smart contracts often use require statements to check conditions before continuing. Here, the condition was meant to ensure a token is not VADER and not USDV, but because the wrong logical operator was used, the check passed if either one was true, allowing forbidden tokens. This could let someone create a Synth with a token that should never be allowed, which might disrupt the system.

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.

More from Vader Protocol contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.