The protocol allows multiple shorts to be consolidated into a single short for improved risk management. However, it lacks validation to prevent the inclusion of the same short multiple times in the array. This vulnerability enables users to combine the same short repeatedly, posing a significant risk to protocol integrity and functionality.
Allowing the user to input the same ID twice into the combineShorts function can lead to instability in the protocol. This action immediately doubles the collateral and ercDebt values in the short records while setting their status to Status.CANCELLED. Additionally, it becomes possible to revert this status if a bid matches the short order. In the best-case scenario, users may lose their funds held in the shortRecord. In the worst-case scenario, a malicious attacker could exploit this to drain funds from the protocol by doubling the collateral and settling the debt.
Notice how the values of the debt and collateral are doubled, also the status goes from 0 (PartialFill) to 2 (Cancelled) and back to 0.
The inclusion of the same short multiple times in the ids array can potentially disrupt the expected behavior of the protocol and may lead to unintended consequences.
Manual Review, Foundry tests
Check the ids[i] to not be equal to ids[0]. Only the first occurrence of the same ID in the ids array should be considered valid. Including the same ID more than once in the array should be prevented to avoid potential issues or reverts in the transaction.
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.