Open code423n4 opened 3 years ago
Makes strong assumption about the range of possible values - small differences between a and b will result in small differences between a/b and b/a - Extreme cases are handled by emergency. Agree on b/c check
medium severity - will only cause stop of deposits/withdrawals against curve, work around to put in emergency mode
A possibility of stopping deposits or withdrawals deserves high risk.
Handle
cmichel
Vulnerability details
Vulnerability Details
The
safetyCheck
function has several issues that impact how precise the checks are:only checks if the
a/b
anda/c
ratios are withinBASIS_POINTS
. By transitivityb/c
is only within2 * BASIS_POINTS
ifa/b
anda/c
are in range. For a more precise check whether both USDC and USDT are within range,b/c
must be checked as well.If
a/b
is within range, this does not imply thatb/a
is within range.Example:
lastRatio = 1.0
ratio: a = 1.0, b = 0.8
=>a/b = 1.25
,b/a = 0.8
Ifa/b
was used with a 20% range, it'd be out of range, butb/a
is in range._ratio
andlastRatio
are only from Curve. Only_updateRatios
checks the oracle.Recommended Mitigation Steps
In addition, check if
b/c
is withinBASIS_POINTS
.