{
  "schema_version": "1.0",
  "url": "https://cerinamroth.com/disclosures/zisk-signed-rem-sign-soundness/",
  "title": "ZisK zkVM Signed-Remainder Soundness Flaw — Cerin Amroth",
  "description": "A signed-remainder constraint flaw in the ZisK zero-knowledge virtual machine. Fixed upstream; vendor-rated Critical. Advisory GHSA-qjgg-fcj3-p9x3.",
  "date_modified": "2026-09-25",
  "representations": {
    "json": "https://cerinamroth.com/data/pages/disclosures/zisk-signed-rem-sign-soundness.json",
    "markdown": "https://cerinamroth.com/data/pages/disclosures/zisk-signed-rem-sign-soundness.md"
  },
  "headings": [
    {
      "level": 1,
      "id": null,
      "text": "ZisK: a missing sign constraint in signed remainder"
    },
    {
      "level": 2,
      "id": null,
      "text": "Why the sign matters"
    },
    {
      "level": 2,
      "id": null,
      "text": "Where the constraint was missing"
    },
    {
      "level": 2,
      "id": null,
      "text": "The candidate witness"
    },
    {
      "level": 2,
      "id": null,
      "text": "How the fix handles zero"
    },
    {
      "level": 2,
      "id": null,
      "text": "Disclosure timeline"
    },
    {
      "level": 2,
      "id": null,
      "text": "Correction to the original report"
    }
  ],
  "links": [
    {
      "text": "Cerin Amroth",
      "url": "https://cerinamroth.com/"
    },
    {
      "text": "Home",
      "url": "https://cerinamroth.com/"
    },
    {
      "text": "ML",
      "url": "https://cerinamroth.com/ml/"
    },
    {
      "text": "JWST",
      "url": "https://cerinamroth.com/jwst/"
    },
    {
      "text": "Security",
      "url": "https://cerinamroth.com/policy/"
    },
    {
      "text": "Contact",
      "url": "https://cerinamroth.com/#contact"
    },
    {
      "text": "← all disclosures",
      "url": "https://cerinamroth.com/disclosures/"
    },
    {
      "text": "GHSA-qjgg-fcj3-p9x3",
      "url": "https://github.com/0xPolygonHermez/zisk/security/advisories/GHSA-qjgg-fcj3-p9x3"
    },
    {
      "text": "PR #1228",
      "url": "https://github.com/0xPolygonHermez/zisk/pull/1228"
    },
    {
      "text": "arith.pil",
      "url": "https://github.com/0xPolygonHermez/zisk/blob/6182c8be9f4ec6baf7ee9771dd0668324f7112ed/state-machines/arith/pil/arith.pil#L131-L216"
    },
    {
      "text": "lookup-table generator",
      "url": "https://github.com/0xPolygonHermez/zisk/blob/6182c8be9f4ec6baf7ee9771dd0668324f7112ed/state-machines/arith/pil/arith_table.pil#L144-L163"
    },
    {
      "text": "a working malicious witness for a related quotient-sign flaw",
      "url": "https://github.com/codygunton/zisk/pull/12"
    },
    {
      "text": "vendor advisory",
      "url": "https://github.com/0xPolygonHermez/zisk/security/advisories/GHSA-qjgg-fcj3-p9x3"
    },
    {
      "text": "PR description",
      "url": "https://github.com/0xPolygonHermez/zisk/pull/1228"
    },
    {
      "text": "our key",
      "url": "https://cerinamroth.com/.well-known/cerinamroth-pubkey.asc"
    },
    {
      "text": "security@cerinamroth.com",
      "url": "mailto:security@cerinamroth.com"
    }
  ],
  "structured_data": [
    {
      "@context": "https://schema.org",
      "@type": "TechArticle",
      "headline": "ZisK: a missing sign constraint in signed remainder",
      "description": "A signed-remainder constraint flaw in the ZisK zero-knowledge virtual machine. Fixed upstream; vendor-rated Critical. Advisory GHSA-qjgg-fcj3-p9x3.",
      "url": "https://cerinamroth.com/disclosures/zisk-signed-rem-sign-soundness/",
      "mainEntityOfPage": "https://cerinamroth.com/disclosures/zisk-signed-rem-sign-soundness/",
      "datePublished": "2026-09-17T00:00:00Z",
      "dateModified": "2026-09-25T00:00:00Z",
      "image": "https://cerinamroth.com/brand/cerin-amroth-card-brand.png?v=ceed00050b87",
      "author": {
        "@type": "Person",
        "name": "Paul Jordan Anderson",
        "url": "https://cerinamroth.com/disclosures/zisk-signed-rem-sign-soundness/#author"
      },
      "publisher": {
        "@type": "Organization",
        "@id": "https://cerinamroth.com/#organization",
        "name": "Cerin Amroth Research",
        "url": "https://cerinamroth.com/"
      },
      "inLanguage": "en",
      "isPartOf": {
        "@type": "WebSite",
        "name": "Cerin Amroth Research",
        "url": "https://cerinamroth.com/"
      },
      "about": "0xPolygonHermez/zisk",
      "citation": "https://github.com/0xPolygonHermez/zisk/security/advisories/GHSA-qjgg-fcj3-p9x3"
    },
    {
      "@context": "https://schema.org",
      "@type": "BreadcrumbList",
      "itemListElement": [
        {
          "@type": "ListItem",
          "position": 1,
          "name": "Home",
          "item": "https://cerinamroth.com/"
        },
        {
          "@type": "ListItem",
          "position": 2,
          "name": "Security disclosures",
          "item": "https://cerinamroth.com/disclosures/"
        },
        {
          "@type": "ListItem",
          "position": 3,
          "name": "ZisK: a missing sign constraint in signed remainder",
          "item": "https://cerinamroth.com/disclosures/zisk-signed-rem-sign-soundness/"
        }
      ]
    }
  ],
  "content_markdown": "[Cerin Amroth](https://cerinamroth.com/) · Security Disclosures [Home](https://cerinamroth.com/)[ML](https://cerinamroth.com/ml/)[JWST](https://cerinamroth.com/jwst/)[Security](https://cerinamroth.com/policy/)[Contact](https://cerinamroth.com/#contact)\n\n \n\n[← all disclosures](https://cerinamroth.com/disclosures/)\n\n \n\n# ZisK: a missing sign constraint in signed remainder\n\nAuthor Paul Jordan Anderson · Project 0xPolygonHermez/zisk · Class CWE-682 (Incorrect Calculation), under-constrained circuit · Severity Critical (vendor-rated) · Reported 2026-06-06 · Fixed 2026-07-29 · Advisory [GHSA-qjgg-fcj3-p9x3](https://github.com/0xPolygonHermez/zisk/security/advisories/GHSA-qjgg-fcj3-p9x3)\n\nZisK's arithmetic circuit checked the magnitude of a signed remainder without fully constraining its sign. For a negative dividend, the checked relations allowed a nonzero remainder to be encoded as positive. For example, `REM(-7, 3)` should return `-1`; the reported assignment encodes `+1`.\n\n \n\nThe ZisK team accepted the report as Critical and confirmed that [PR #1228](https://github.com/0xPolygonHermez/zisk/pull/1228) had already fixed it. The patch closed both this remainder-sign finding and Cody Gunton's independently reported quotient-sign flaw. The PR now credits both reports.\n\n \n\nAffected revision: `6182c8be` · Fix: `683e6d9` · Patched version listed by the advisory: `1.1.0-alpha`\n\n \n\nValidation scope: this report checked the relevant constraints, lookup-table membership and witness-code components. It did not generate an end-to-end forged proof or demonstrate an exploit against a deployed application.\n\n \n\n## Why the sign matters\n\n \n\nA zero-knowledge virtual machine lets a verifier check a program's execution without rerunning it. Its constraints must therefore distinguish the correct computation from an incorrect one.\n\n \n\nFor ordinary signed division, RISC-V rounds the quotient toward zero. A nonzero remainder must have the dividend's sign, and its magnitude must be smaller than the divisor's. Thus:\n\n \n\n```\n-7 = 3 × (-2) + (-1)\n```\n\n \n\nChecking only the magnitudes gives `7 = 3 × 2 + 1`. That equation cannot distinguish a remainder of `-1` from `+1`. The circuit must also bind the output sign.\n\n \n\n## Where the constraint was missing\n\n \n\nAt the affected revision, [`arith.pil`](https://github.com/0xPolygonHermez/zisk/blob/6182c8be9f4ec6baf7ee9771dd0668324f7112ed/state-machines/arith/pil/arith.pil#L131-L216) represented signs with four boolean flags: `na` for the quotient, `nb` for the divisor, `np` for the dividend and `nr` for the remainder. The [lookup-table generator](https://github.com/0xPolygonHermez/zisk/blob/6182c8be9f4ec6baf7ee9771dd0668324f7112ed/state-machines/arith/pil/arith_table.pil#L144-L163) rejected invalid combinations.\n\n \n\nThe table required `np == nr` in the division-by-zero case:\n\n \n\n```\n// arith_table.pil:150, at 6182c8be\nif (div_by_zero && (!div || nb || np != nr || signed != na)) continue;\n```\n\n \n\nOn the ordinary signed path, its sign filter was weaker:\n\n \n\n```\n// arith_table.pil:163\nif (!np & nr) continue;\n```\n\n \n\nThis enforces `nr <= np`. A non-negative dividend forces `nr = 0`, but a negative dividend permits either sign.\n\n \n\nAllowing both signs is necessary for one case: exact division. For `-6 / 3`, the remainder is zero, so its negative flag must be clear. The missing constraint was the distinction between zero and positive. Nothing required the remainder to be zero when a negative dividend was paired with `nr = 0`.\n\n \n\n## The candidate witness\n\n \n\nFor `REM(-7, 3)`, the report examined this assignment:\n\n \n\n```\ndiv = 1, signed = 1, div_by_zero = 0\nna = 1, nb = 0, np = 1, nr = 0\n|quotient| = 2, |remainder| = 1\n```\n\n \n\nThe magnitude identity holds (`2 × 3 + 1 = 7`), the remainder bound holds (`1 < 3`), and the lookup table accepts the flags. With `nr = 0`, the output-sign selector encodes `+1` rather than `-1`.\n\n \n\nThe report also replayed table membership and chunk range checks against the project's witness code. It did not independently solve all chunked two's-complement identities in `arith.pil:131–209` or run the complete proving pipeline. Those limits distinguish the evidence presented here from an end-to-end proof forgery.\n\n \n\nThe flaw concerns signed `REM` and `REMW` with a negative dividend and nonzero remainder. An incorrect sign could change a guest program's subsequent arithmetic or control flow. The vendor rated the soundness finding Critical; this report does not establish exploitation of any deployed application.\n\n \n\n## How the fix handles zero\n\n \n\nOn July 27, Cody Gunton published [a working malicious witness for a related quotient-sign flaw](https://github.com/codygunton/zisk/pull/12): `DIV(1, -1)` could be represented as `+1`. ZisK opened PR #1228 on July 29, crediting his report, and merged it on July 30. The fix closed the remainder-sign issue as well.\n\n \n\nCommit `683e6d9` introduces `result_is_zero` and `remainder_is_zero`, ties those flags to the corresponding values, and distinguishes a negative remainder from zero:\n\n \n\n```\n// arith.pil\nremainder_is_zero * div * sum_all_ds === 0;\n\n// arith_table.pil\nif (neg_dividend == 1 && remainder_is_zero == 0 && neg_remainder != 1) continue;\nif (neg_dividend == 1 && remainder_is_zero == 1 && neg_remainder != 0) continue;\n```\n\n \n\nThe original report proposed requiring the dividend and remainder signs to match directly. That proposal was too strict: it would reject valid exact divisions with a negative dividend and zero remainder. The shipped fix handles both cases correctly.\n\n \n\nThe fix commit is included in `v1.1.0-alpha` and `v1.2.0-alpha`. The [vendor advisory](https://github.com/0xPolygonHermez/zisk/security/advisories/GHSA-qjgg-fcj3-p9x3) identifies `1.1.0-alpha` as the patched version.\n\n \n\n## Disclosure timeline\n\n  \n- June 5, 2026: identified and checked at `6182c8be`. \n- June 6: reported privately by email and GitHub Security Advisory, with a proposed 90-day disclosure window. \n- July 27: Cody Gunton published the related quotient-sign finding. \n- July 29–30: ZisK opened and merged PR #1228, fixing both issues. \n- August 18 and 26: releases `v1.1.0-alpha` and `v1.2.0-alpha` included the fix. \n- September 17: ZisK accepted and published GHSA-qjgg-fcj3-p9x3 as Critical, confirming the existing fix. This was the first recorded response to this report. No CVE was assigned at publication. \n- September 18: the [PR description](https://github.com/0xPolygonHermez/zisk/pull/1228) was updated to credit the independently reported remainder-sign finding alongside the quotient-sign report. \n\n \n\n## Correction to the original report\n\n \n\nThe advisory's reference to RISC Zero's CVE-2025-52484 was imprecise. That finding involved register confusion, not a missing remainder-sign constraint. It is a related example of incorrect execution being accepted, not the same mechanism. The clarification was sent to ZisK after the report.\n\n \n\nReported by Paul Jordan Anderson, Cerin Amroth Research. Contact: jordan@cerinamroth.com. The disclosure was unconditional; no bounty program covered this report.\n\n Coordinated disclosure. Published only after a fix shipped or the disclosure window closed. · Verify signatures against [our key](https://cerinamroth.com/.well-known/cerinamroth-pubkey.asc). · [security@cerinamroth.com](mailto:security@cerinamroth.com)\n  © 2026 Cerin Amroth Security Research, LLC · CERIN AMROTH SECURITY RESEARCH™\n",
  "content_sha256": "f4225f6a042327cce2248fce95c10b66444a2a88fa49289be335c5d9927ecd1a"
}
