code-423n4 / 2021-04-vader-findings

1 stars 0 forks source link

Incorrect operator used in deploySynth() of Pools.sol #124

Open code423n4 opened 3 years ago

code423n4 commented 3 years ago

Handle

0xRajeev

Vulnerability details

Impact

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 ‘||’ 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.

Proof of Concept

https://github.com/code-423n4/2021-04-vader/blob/3041f20c920821b89d01f652867d5207d18c8703/vader-protocol/contracts/Pools.sol#L138

Tools Used

Manual Analysis

Recommended Mitigation Steps

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

strictly-scarce commented 3 years ago

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

0xBrian commented 3 years ago

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