You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a prover uses a **zkVM** or an application-specific proof circuit to attest a claim, the verifier is only learning that the **guest program executed as written**. If the guest contains **unsafe deserialization**, **undefined behavior**, or **missing semantic constraints**, a malicious prover may generate a proof that verifies while the **public metrics or claimed invariant are false**.
216
+
217
+
### Unsafe deserialization inside proof guests
218
+
219
+
- Treat private witness/circuit bytes as **untrusted attacker input** even if they are hidden by the proof.
220
+
- Avoid deserializing them with unchecked helpers such as `rkyv::access_unchecked` unless the bytes were already validated out-of-band.
221
+
- Enum discriminants, relative pointers, lengths, and indexes loaded from untrusted serialized data must be validated before they influence control flow or memory access.
If a field such as `op.kind` is an enum and an attacker can inject an **out-of-range discriminant**, every downstream `match` on that value becomes suspicious.
233
+
234
+
### Jump-table / UB counter bypass
235
+
236
+
If Rust lowers a large `match` into a **jump table**, an invalid enum discriminant may produce **undefined control flow**. A dangerous pattern is:
237
+
238
+
1. One `match` updates **security-critical counters/constraints**.
239
+
2. A second `match` performs the **real instruction semantics**.
240
+
3. An out-of-range discriminant indexes past the first jump table and lands in code associated with the second one.
241
+
242
+
Result: the operation still executes, but the accounting path is skipped. In a zkVM this can forge proofs that report impossible metrics such as fewer gates, fewer expensive operations, or other falsified bounded resources.
243
+
244
+
Review checklist:
245
+
246
+
- Look for attacker-controlled enums deserialized from witness/private input.
247
+
- Inspect repeated `match` statements over the same opcode/kind field.
248
+
- Treat `unsafe` + unchecked deserialization + large opcode dispatch as a high-risk combination.
249
+
- Reverse engineer the emitted binary when needed; jump-table layout can matter more than the source.
250
+
251
+
### Missing semantic constraints in reversible/specialized interpreters
252
+
253
+
Do not just validate memory safety; also validate the **semantic rules** that the proof is meant to enforce.
254
+
255
+
For reversible/quantum-like instruction sets, ensure operands that must be distinct are actually constrained to be distinct. A Toffoli/CCX-like operation implemented as:
This creates a **deterministic reset primitive**, breaking reversibility assumptions and enabling cheaper non-intended computations. In proof systems that attest resource usage, this can let attackers satisfy functional checks while bypassing the cost model the verifier believes is being enforced.
275
+
276
+
### What to test in ZK systems
277
+
278
+
- Fuzz all guest parsers with malformed witness/private-input encodings.
279
+
- Assert enum range validation before opcode dispatch.
280
+
- Add semantic checks for operand aliasing and other invalid instruction forms.
281
+
- Compare reported/public counters against an independent reference implementation.
282
+
- Remember that a valid proof can still prove the **wrong statement** if the guest program is buggy.
221
283
222
284
## DeFi/AMM Exploitation
223
285
@@ -233,6 +295,16 @@ For multi-asset weighted pools that cache virtual balances and can be poisoned w
-[Trail of Bits - We beat Google's zero-knowledge proof of quantum cryptanalysis](https://blog.trailofbits.com/2026/04/17/we-beat-googles-zero-knowledge-proof-of-quantum-cryptanalysis/)
307
+
-[Google patched paper version](https://arxiv.org/abs/2603.28846v2)
308
+
-[Trail of Bits proof-of-concept repository](https://github.com/trailofbits/quantum-zk-proof-poc)
0 commit comments