A targeted security audit was conducted on the Algo Ssstablecoinsss smart contracts on ZKsync Era, focusing on finding HIGH-02: deeply insolvent positions reverting on liquidation due to uncapped 10% bonus subtraction.
| Severity | Count | Resolved | Acknowledged |
|---|---|---|---|
| Critical | 0 | 0 | 0 |
| High | 1 | 0 | 0 |
| Medium | 0 | 0 | 0 |
| Low | 0 | 0 | 0 |
| Informational | 0 | 0 | 0 |
| Total | 1 | 0 | 0 |
| File Path | Logic Overview | SWC / Risk Focus |
|---|---|---|
src/dsc_engine.vy |
Liquidation and collateral redemption math | SWC-101 (Arithmetic Underflow) / Bad Debt |
Severity: High
Status: Confirmed / PoC Verified
Vulnerability Class: SWC-101 (Arithmetic Underflow / Bad Debt Freeze)
Affected File(s): src/dsc_engine.vy:L112-L135, src/dsc_engine.vy:L249-L252
The liquidation mechanism is designed to incentivize third-party liquidators to repay delinquent debt in exchange for seized collateral plus a 10% liquidation bonus (LIQUIDATION_BONUS = 10%).
In dsc_engine.vy, liquidate() computes the collateral to seize based on debt covered plus 10%:
Inside _redeem_collateral():
If market prices drop rapidly such that the borrower's total deposited collateral is less than token_amount_from_debt_covered + bonus_collateral:
The unsigned integer subtraction underflows. In Vyper 0.4.0, unsigned integer underflow reverts automatically.
The following test executed via uv run mox test tests/unit/test_pocs.py -s proves that an insolvent position reverts on liquidation:
PoC Verification Log Output:
Permanent Protocol Bad Debt: Deeply insolvent positions cannot be liquidated. Any liquidator attempting to liquidate the position receives a revert.
Unbacked Stablecoins: The insolvent debt remains active on the protocol ledger, while the remaining collateral sits permanently locked and cannot be liquidated or recovered.
In liquidate(), cap the redeemed collateral at the user's available collateral balance. If available collateral is insufficient to cover the full 10% bonus, transfer all remaining collateral to the liquidator rather than reverting:
Moccasin / Titanoboa Unit Test: test_poc_insolvent_position_cannot_be_liquidated passed in 3.55s.
This security review does not guarantee 100% security against zero-day vulnerabilities. Continuous monitoring, bug bounties, and formal verification are recommended prior to mainnet deployment.
The contest is live. Earn rewards by submitting a finding.
Submissions are being reviewed by our AI judge. Results will be available in a few minutes.
View all submissionsThe contest is complete and the rewards are being distributed.