The flagShort
function is improperly assigning flags to the cUSD market, irrespective of the actual market of the short position. This issue is non-critical with a single market but turns exploitable with the addition of more markets.
In the final step of the flagShort
function we store the flaggerId
of the liquidator in the ShortRecord
structure of
the shorter. However, we do not use the short position in question, but always link the flag to the short position on the cusd
market. This isn’t problematic with one market but opens up avenues for exploitation when additional assets are introduced:
A scenario to consider:
A user establishes a significant short position in the AUD market.
The user’s collateral ratio declines.
The liquidator attempts to flag the position, but flags the cusd market
The position remains unflagged, and (early) liquidations are bypassed.
The bug leads to the generation of bad debt, threatening the protocol's financial health.
Manual Analysis
A direct fix is to modify the flagShort
function to associate the flag with the correct asset. Here’s the corrected code:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.