V8 cipher-agnostic byte-amplification detector — initial release (2026-05-13)
Browse files- LICENSE +191 -0
- README.md +200 -0
- inference_example.py +136 -0
- model.joblib +3 -0
- predict.py +164 -0
- release-cert.json +162 -0
LICENSE
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Apache License
|
| 2 |
+
Version 2.0, January 2004
|
| 3 |
+
http://www.apache.org/licenses/
|
| 4 |
+
|
| 5 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
| 6 |
+
|
| 7 |
+
1. Definitions.
|
| 8 |
+
|
| 9 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
| 10 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
| 11 |
+
|
| 12 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
| 13 |
+
the copyright owner that is granting the License.
|
| 14 |
+
|
| 15 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
| 16 |
+
other entities that control, are controlled by, or are under common
|
| 17 |
+
control with that entity. For the purposes of this definition,
|
| 18 |
+
"control" means (i) the power, direct or indirect, to cause the
|
| 19 |
+
direction or management of such entity, whether by contract or
|
| 20 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
| 21 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
| 22 |
+
|
| 23 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
| 24 |
+
exercising permissions granted by this License.
|
| 25 |
+
|
| 26 |
+
"Source" form shall mean the preferred form for making modifications,
|
| 27 |
+
including but not limited to software source code, documentation
|
| 28 |
+
source, and configuration files.
|
| 29 |
+
|
| 30 |
+
"Object" form shall mean any form resulting from mechanical
|
| 31 |
+
transformation or translation of a Source form, including but
|
| 32 |
+
not limited to compiled object code, generated documentation,
|
| 33 |
+
and conversions to other media types.
|
| 34 |
+
|
| 35 |
+
"Work" shall mean the work of authorship, whether in Source or
|
| 36 |
+
Object form, made available under the License, as indicated by a
|
| 37 |
+
copyright notice that is included in or attached to the work
|
| 38 |
+
(an example is provided in the Appendix below).
|
| 39 |
+
|
| 40 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
| 41 |
+
form, that is based on (or derived from) the Work and for which the
|
| 42 |
+
editorial revisions, annotations, elaborations, or other modifications
|
| 43 |
+
represent, as a whole, an original work of authorship. For the purposes
|
| 44 |
+
of this License, Derivative Works shall not include works that remain
|
| 45 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
| 46 |
+
the Work and Derivative Works thereof.
|
| 47 |
+
|
| 48 |
+
"Contribution" shall mean any work of authorship, including
|
| 49 |
+
the original version of the Work and any modifications or additions
|
| 50 |
+
to that Work or Derivative Works thereof, that is intentionally
|
| 51 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
| 52 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
| 53 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
| 54 |
+
means any form of electronic, verbal, or written communication sent
|
| 55 |
+
to the Licensor or its representatives, including but not limited to
|
| 56 |
+
communication on electronic mailing lists, source code control systems,
|
| 57 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
| 58 |
+
Licensor for the purpose of tracking or improving the Work, but
|
| 59 |
+
excluding communication that is conspicuously marked or otherwise
|
| 60 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
| 61 |
+
|
| 62 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
| 63 |
+
on behalf of whom a Contribution has been received by Licensor and
|
| 64 |
+
subsequently incorporated within the Work.
|
| 65 |
+
|
| 66 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
| 67 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 68 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 69 |
+
copyright license to reproduce, prepare Derivative Works of,
|
| 70 |
+
publicly display, publicly perform, sublicense, and distribute the
|
| 71 |
+
Work and such Derivative Works in Source or Object form.
|
| 72 |
+
|
| 73 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
| 74 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 75 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 76 |
+
(except as stated in this section) patent license to make, have made,
|
| 77 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
| 78 |
+
where such license applies only to those patent claims licensable
|
| 79 |
+
by such Contributor that are necessarily infringed by their
|
| 80 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
| 81 |
+
with the Work to which such Contribution(s) was submitted. If You
|
| 82 |
+
institute patent litigation against any entity (including a
|
| 83 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
| 84 |
+
or a Contribution incorporated within the Work constitutes direct
|
| 85 |
+
or contributory patent infringement, then any patent licenses
|
| 86 |
+
granted to You under this License for that Work shall terminate
|
| 87 |
+
as of the date such litigation is filed.
|
| 88 |
+
|
| 89 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
| 90 |
+
Work or Derivative Works thereof in any medium, with or without
|
| 91 |
+
modifications, and in Source or Object form, provided that You
|
| 92 |
+
meet the following conditions:
|
| 93 |
+
|
| 94 |
+
(a) You must give any other recipients of the Work or
|
| 95 |
+
Derivative Works a copy of this License; and
|
| 96 |
+
|
| 97 |
+
(b) You must cause any modified files to carry prominent notices
|
| 98 |
+
stating that You changed the files; and
|
| 99 |
+
|
| 100 |
+
(c) You must retain, in the Source form of any Derivative Works
|
| 101 |
+
that You distribute, all copyright, patent, trademark, and
|
| 102 |
+
attribution notices from the Source form of the Work,
|
| 103 |
+
excluding those notices that do not pertain to any part of
|
| 104 |
+
the Derivative Works; and
|
| 105 |
+
|
| 106 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
| 107 |
+
distribution, then any Derivative Works that You distribute must
|
| 108 |
+
include a readable copy of the attribution notices contained
|
| 109 |
+
within such NOTICE file, excluding those notices that do not
|
| 110 |
+
pertain to any part of the Derivative Works, in at least one
|
| 111 |
+
of the following places: within a NOTICE text file distributed
|
| 112 |
+
as part of the Derivative Works; within the Source form or
|
| 113 |
+
documentation, if provided along with the Derivative Works; or,
|
| 114 |
+
within a display generated by the Derivative Works, if and
|
| 115 |
+
wherever such third-party notices normally appear. The contents
|
| 116 |
+
of the NOTICE file are for informational purposes only and
|
| 117 |
+
do not modify the License. You may add Your own attribution
|
| 118 |
+
notices within Derivative Works that You distribute, alongside
|
| 119 |
+
or as an addendum to the NOTICE text from the Work, provided
|
| 120 |
+
that such additional attribution notices cannot be construed
|
| 121 |
+
as modifying the License.
|
| 122 |
+
|
| 123 |
+
You may add Your own copyright statement to Your modifications and
|
| 124 |
+
may provide additional or different license terms and conditions
|
| 125 |
+
for use, reproduction, or distribution of Your modifications, or
|
| 126 |
+
for any such Derivative Works as a whole, provided Your use,
|
| 127 |
+
reproduction, and distribution of the Work otherwise complies with
|
| 128 |
+
the conditions stated in this License.
|
| 129 |
+
|
| 130 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
| 131 |
+
any Contribution intentionally submitted for inclusion in the Work
|
| 132 |
+
by You to the Licensor shall be under the terms and conditions of
|
| 133 |
+
this License, without any additional terms or conditions.
|
| 134 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
| 135 |
+
the terms of any separate license agreement you may have executed
|
| 136 |
+
with Licensor regarding such Contributions.
|
| 137 |
+
|
| 138 |
+
6. Trademarks. This License does not grant permission to use the trade
|
| 139 |
+
names, trademarks, service marks, or product names of the Licensor,
|
| 140 |
+
except as required for describing the origin of the Work and
|
| 141 |
+
reproducing the content of the NOTICE file.
|
| 142 |
+
|
| 143 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
| 144 |
+
agreed to in writing, Licensor provides the Work (and each
|
| 145 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
| 146 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
| 147 |
+
implied, including, without limitation, any warranties or conditions
|
| 148 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
| 149 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
| 150 |
+
appropriateness of using or redistributing the Work and assume any
|
| 151 |
+
risks associated with Your exercise of permissions under this License.
|
| 152 |
+
|
| 153 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
| 154 |
+
whether in tort (including negligence), contract, or otherwise,
|
| 155 |
+
unless required by applicable law (such as deliberate and grossly
|
| 156 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
| 157 |
+
liable to You for damages, including any direct, indirect, special,
|
| 158 |
+
incidental, or consequential damages of any character arising as a
|
| 159 |
+
result of this License or out of the use or inability to use the
|
| 160 |
+
Work (including but not limited to damages for loss of goodwill,
|
| 161 |
+
work stoppage, computer failure or malfunction, or any and all
|
| 162 |
+
other commercial damages or losses), even if such Contributor
|
| 163 |
+
has been advised of the possibility of such damages.
|
| 164 |
+
|
| 165 |
+
9. Accepting Warranty or Support. While redistributing the Work or
|
| 166 |
+
Derivative Works thereof, You may accept upon your own behalf the
|
| 167 |
+
responsibility to provide, and accept charging a fee for, accepting
|
| 168 |
+
warranty, support, indemnity, or other liability obligations and/or
|
| 169 |
+
rights consistent with this License. However, in accepting such
|
| 170 |
+
obligations, You may act only on Your own behalf and on Your sole
|
| 171 |
+
responsibility, not on behalf of any other Contributor, and only
|
| 172 |
+
if You agree to indemnify, defend, and hold each Contributor
|
| 173 |
+
harmless for any liability incurred by, or claims asserted against,
|
| 174 |
+
such Contributor by reason of your accepting any such warranty
|
| 175 |
+
or support.
|
| 176 |
+
|
| 177 |
+
END OF TERMS AND CONDITIONS
|
| 178 |
+
|
| 179 |
+
Copyright 2026 NullRabbit Labs Ltd
|
| 180 |
+
|
| 181 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 182 |
+
you may not use this file except in compliance with the License.
|
| 183 |
+
You may obtain a copy of the License at
|
| 184 |
+
|
| 185 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 186 |
+
|
| 187 |
+
Unless required by applicable law or agreed to in writing, software
|
| 188 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 189 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
| 190 |
+
implied. See the License for the specific language governing
|
| 191 |
+
permissions and limitations under the License.
|
README.md
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
tags:
|
| 6 |
+
- cybersecurity
|
| 7 |
+
- blockchain
|
| 8 |
+
- network-security
|
| 9 |
+
- validator-security
|
| 10 |
+
- anomaly-detection
|
| 11 |
+
- byte-amplification
|
| 12 |
+
- sui
|
| 13 |
+
- solana
|
| 14 |
+
- scikit-learn
|
| 15 |
+
library_name: scikit-learn
|
| 16 |
+
pretty_name: V8 cipher-agnostic byte-amplification detector
|
| 17 |
+
---
|
| 18 |
+
|
| 19 |
+
# V8 cipher-agnostic byte-amplification detector
|
| 20 |
+
|
| 21 |
+
## What it is
|
| 22 |
+
|
| 23 |
+
V8 is a reference detector trained against `corpus_v1.0`–`corpus_v1.5` under NullRabbit's pre-registration discipline. The model is one demonstrable outcome of that methodology; **the methodology is the contribution.**
|
| 24 |
+
|
| 25 |
+
This is the work of the substrate paper (in preparation): an iterative leak-surface peeling pattern applied across multiple training cycles, with each cycle pre-registered, audited on close, and retracted in writing when a leak fires. V8 is the cycle that landed `cipher-agnostic-v2` — a manifest of seven byte-amplification features that detect the attack mechanism without relying on any chain-protocol-specific signal. Cross-chain transfer follows from that property: V8 trained on Sui detects Solana byte-amplification attacks at the wire because the wire shape is the same.
|
| 26 |
+
|
| 27 |
+
The model itself is a calibrated histogram gradient-boosting classifier (`CalibratedClassifierCV(HistGradientBoostingClassifier, method='isotonic', cv=5)`) over seven features, calibrated for operating-point selection. Single-bundle scoring; not a packet-level streaming detector.
|
| 28 |
+
|
| 29 |
+
V8 is published as the data-layer artefact of NullRabbit Labs' research on **autonomous defence for decentralised networks**. The governance layer is published separately (see Related).
|
| 30 |
+
|
| 31 |
+
## Architecture
|
| 32 |
+
|
| 33 |
+
- Estimator: `CalibratedClassifierCV(HistGradientBoostingClassifier, method='isotonic', cv=5)`.
|
| 34 |
+
- Manifest: `cipher-agnostic-v2` (7 features). See `feature_names` in the joblib payload.
|
| 35 |
+
- Training corpus: 1,972 bundles drawn from `corpus_v1.0`–`corpus_v1.5` (897 attack + 1,075 benign).
|
| 36 |
+
- Fidelity filter: `lab` + `lab-tls-fronted`.
|
| 37 |
+
- Features version: `v1.1`.
|
| 38 |
+
- Seed: 42.
|
| 39 |
+
|
| 40 |
+
## Features
|
| 41 |
+
|
| 42 |
+
The `cipher-agnostic-v2` manifest names seven features computed from two bundle modalities:
|
| 43 |
+
|
| 44 |
+
| Feature | Source modality | Semantics |
|
| 45 |
+
|---|---|---|
|
| 46 |
+
| `resp.req_bytes_max` | `responses.parquet` | Maximum observed request size in the response time-series |
|
| 47 |
+
| `resp.resp_bytes_max` | `responses.parquet` | Maximum observed response size |
|
| 48 |
+
| `resp.amp_ratio_max` | `responses.parquet` | Maximum per-request response:request byte ratio |
|
| 49 |
+
| `resp.amp_ratio_mean` | `responses.parquet` | Mean response:request byte ratio |
|
| 50 |
+
| `resp.amp_ratio_median` | `responses.parquet` | Median response:request byte ratio |
|
| 51 |
+
| `pcap.unique_dst_ports` | `packets.pcap` | Distinct destination TCP ports observed (capped at 5) |
|
| 52 |
+
| `pcap.unique_src_ports` | `packets.pcap` | Distinct source TCP ports observed (capped at 5) |
|
| 53 |
+
|
| 54 |
+
**Cipher-agnostic** means the features are computable on encrypted wire traffic from packet sizes, timing, and cardinality — no cleartext payload bytes required. This is what makes the cardinality features pcap-derived and the response features parquet-derived work together at training time on cleartext lab captures and at inference time on TLS-fronted production traffic.
|
| 55 |
+
|
| 56 |
+
## Training data
|
| 57 |
+
|
| 58 |
+
The training corpus is **proprietary**. The training surface is NullRabbit's archived `corpus_v1.0`–`corpus_v1.10` (and beyond); the model was trained on the subset of v1.0–v1.5 at `fidelity_class ∈ {lab, lab-tls-fronted}`.
|
| 59 |
+
|
| 60 |
+
A curated, public sample of the corpus is available on Hugging Face as **[NullRabbit/nr-bundles-public](https://huggingface.co/datasets/NullRabbit/nr-bundles-public)** — 31 bundles spanning seven vulnerability families across Sui and Solana, CC-BY-4.0. The bundle format is open and specified at **[`nr-bundle-spec`](https://github.com/NullRabbitLabs/nr-bundle-spec)** (MIT). External researchers building their own corpus against the spec can reproduce the methodology, retrain V8-class detectors on their own data, and compare against this reference model.
|
| 61 |
+
|
| 62 |
+
## Intended use
|
| 63 |
+
|
| 64 |
+
- **Reference detector for byte-amplification attacks** on validator-infrastructure JSON-RPC endpoints. Trained on Sui `sui_F10_multi_get_objects_amp` and adjacent primitives; transfers cross-chain to Solana `SOL_F10_multi_get_accounts_amp` at 100% recall in the published cross-chain leave-one-primitive-out evaluation.
|
| 65 |
+
- **Methodology demonstration**: V8 is the worked example of how a pre-registered, audit-disciplined training cycle produces a detector whose limitations are characterised honestly. The card's Load-bearing limitations section is the methodology demonstration; the model is the artefact that supports it.
|
| 66 |
+
- **Reproducibility anchor**: train a parallel detector against your own bundle corpus and compare. The seven-feature manifest is the contract.
|
| 67 |
+
|
| 68 |
+
## Load-bearing limitations
|
| 69 |
+
|
| 70 |
+
This section is the most important part of the card. Each limitation is anchored in pre-registered evidence and surfaced because it would otherwise become a deployment-time surprise.
|
| 71 |
+
|
| 72 |
+
### Phase 1 close-gate scope
|
| 73 |
+
|
| 74 |
+
V8 is Phase-1-close-gate-cleared on **`sui_F10_multi_get_objects_amp` at `lab-tls-fronted` fidelity** — extractor-numerical-equivalence between the production extractor (IBSR `collect-payload` mode at post-term loopback vantage) and the offline reference extractor on all seven features, within `PHASE_1_TOLERANCE`. The model-side close-gate (`PHASE_1_SCORE_CLASS_MATCH` per Decision D-025) — which verifies that prediction-class equivalence holds across configuration shifts that move features into and out of the model's training distribution — is **still in flight** as of this card's date. The numerical-equivalence layer is unblocked; the deployment-claim-load-bearing model-side gate is not.
|
| 75 |
+
|
| 76 |
+
### Cardinality envelope
|
| 77 |
+
|
| 78 |
+
V8's `pcap.unique_*_ports` features are extracted with a cap-at-5 ceiling that aligns the IBSR and offline extractors above five distinct source/destination TCP ports per direction. **Below five distinct ports**, the two extractors diverge by +1 due to IBSR's broader observation coverage (TC-layer control-packet observation plus warmup-window timing). Score interpretation below the envelope is regime-conditional; the close-gate clearance is band-bounded at ≥5-port cardinality.
|
| 79 |
+
|
| 80 |
+
### Saturation envelope
|
| 81 |
+
|
| 82 |
+
The IBSR extractor's BPF ringbuf saturates at **~80 MB/sec sustained payload** (~3,400 RPCs/sec for F10-class amplification, default 16 MiB ringbuf). Above this rate, feature values under-count along axes the model is most sensitive to (the response-byte-distribution features). Production deployment beyond this saturation envelope will produce regressions in score that look like detection failure but are extraction failure.
|
| 83 |
+
|
| 84 |
+
### Out-of-training-distribution attack-shape mis-scoring
|
| 85 |
+
|
| 86 |
+
V8's training distribution covered F10 reproducer configurations at `--ids-per-request 5/10/25 --workers 1/2/8 --delay-ms 0`. The model has been observed to score **"benign"** on attack-shape configurations **outside** that distribution — specifically on the `--ids-per-request 1 --workers 1 --delay-ms 500` low-volume regime captured for the Phase 1 close-gate paired bundles. This is the gap that Decision D-025's `PHASE_1_SCORE_CLASS_MATCH` gate exists to close. **V8 is not a universal F10 detector. It is an F10 detector inside its training distribution.**
|
| 87 |
+
|
| 88 |
+
### Cross-chain transfer is class-specific
|
| 89 |
+
|
| 90 |
+
V8 transfers cleanly cross-chain to **`SOL_F10_multi_get_accounts_amp`** at 100% recall in the published cross-chain leave-one-primitive-out evaluation. **It does not transfer to other Solana classes.** The parallel V14 (`compute_amp` family) and V11 (`rate_limiter_bypass` family) binary detectors achieve **0% recall on SOL_F14** and **0% recall on SOL_P07** respectively when trained Sui-only and evaluated on Solana. Joint training (the multi-class softmax architecture detailed in companion research) is the architecturally-correct fix for those classes; no feature surgery on V8 will produce a model that detects SOL_F14 or SOL_P07.
|
| 91 |
+
|
| 92 |
+
### Binary detector — family-specific, not universal
|
| 93 |
+
|
| 94 |
+
V8 is a binary detector trained on the **byte-amplification family only** (Sui F10, Solana F10). Attacks from other vulnerability families — reconnaissance (`nmap_slow`), service_misconfig (`ssh_pwauth`, `grafana_anon`), auth_bypass (`admin_rpc_probe`), rate_limiter_bypass (`simulate_compute_flood`) — produce wire shapes V8 does not recognise as attack-shape. V8 will score them "benign". This is **correct behaviour for a family-specific detector**, not a failure mode. Production deployment must compose V8 with parallel family detectors (V9 recon, V10 auth, V11 app-DoS, V13 misconfig, V14 compute-amp) or use the multi-class softmax model published separately at `NullRabbit/multiclass-folded`.
|
| 95 |
+
|
| 96 |
+
### Empty-bundle mis-scoring
|
| 97 |
+
|
| 98 |
+
V8 was trained on bundles that observed at least some RPC traffic during the capture window. When `responses.parquet` is **missing or zero-rows** (typical for passive-workload bundles like `sui_BENIGN_passive_fullnode` and `solana_BENIGN_validator_passive`), the five `resp.*` features collapse to zero. V8's decision tree doesn't have rules covering that part of feature space and may produce a high attack-score on the all-zero vector. The `predict.py` helper shipped with this model (see How to use) applies a scoreability gate that refuses to predict on zero-rows-or-missing-responses bundles; the gate is the recommended mitigation.
|
| 99 |
+
|
| 100 |
+
### Disclosure context
|
| 101 |
+
|
| 102 |
+
The training corpus includes bundles for primitives at varying disclosure states. `SOL_F10_multi_get_accounts_amp` is publicly disclosed per [NR-2026-001](https://nullrabbit.ai). Other primitives represent methodology-class findings or are referenced in coordinated-disclosure channels with respective ecosystems. Disclosure-status information travels with the bundles in `nr-bundles-public`; this model card is the inference-layer cross-reference.
|
| 103 |
+
|
| 104 |
+
## Evaluation
|
| 105 |
+
|
| 106 |
+
- **Training-set decision agreement**: 100% (all 1,972 bundles).
|
| 107 |
+
- **Phase 1 close-gate clearance**: 7/7 features pass numerical-equivalence between production extractor and offline extractor on held-out + multi-window + low-cardinality + paired bundle sub-experiments (band-bounded as documented above).
|
| 108 |
+
- **Cross-chain leave-one-primitive-out**: 100% recall on `SOL_F10_multi_get_accounts_amp` zero-shot from Sui training.
|
| 109 |
+
|
| 110 |
+
Full evaluation evidence and audit trail lives in the substrate paper and in the `nr-substrate` working repo's `docs/PHASE-1-CLOSE-GATE-CLEARED-2026-05-06.md` + companion artefacts. The substrate paper is in preparation.
|
| 111 |
+
|
| 112 |
+
## How to use
|
| 113 |
+
|
| 114 |
+
### Recommended path: `predict.py` (scoreability-gated)
|
| 115 |
+
|
| 116 |
+
The repository ships with `predict.py` — a thin scoreability-gated inference helper that wraps the raw estimator with two production-side gates:
|
| 117 |
+
|
| 118 |
+
- **Scoreability gate**: refuses to score bundles where `responses.parquet` is missing or zero-rows. V8's training distribution doesn't cover all-zero feature vectors (see "Empty-bundle mis-scoring" in Load-bearing limitations above), so the gate returns an explicit `verdict: "unscoreable"` instead of a spurious attack score on passive-workload bundles.
|
| 119 |
+
- **Feature-coverage gate**: emits a `feature_coverage` flag (`"full"` when raw packets.pcap is present; `"resp_only"` when it isn't) so callers can downweight or ignore predictions where the two cardinality features defaulted to 0.
|
| 120 |
+
|
| 121 |
+
```python
|
| 122 |
+
from huggingface_hub import hf_hub_download
|
| 123 |
+
from predict import load_v8, score_bundle
|
| 124 |
+
|
| 125 |
+
model_path = hf_hub_download(
|
| 126 |
+
repo_id="NullRabbit/v8-cipher-agnostic", filename="model.joblib"
|
| 127 |
+
)
|
| 128 |
+
payload = load_v8(model_path)
|
| 129 |
+
|
| 130 |
+
record = score_bundle("/path/to/some/bundle_dir", payload)
|
| 131 |
+
if record["verdict"] == "unscoreable":
|
| 132 |
+
print(f"refused: {record['reason']}")
|
| 133 |
+
else:
|
| 134 |
+
print(f"V8 score: {record['v8_score']:.4f} ({record['verdict']}, "
|
| 135 |
+
f"coverage={record['feature_coverage']})")
|
| 136 |
+
```
|
| 137 |
+
|
| 138 |
+
`predict.py` depends on the bundle-spec reference parser:
|
| 139 |
+
|
| 140 |
+
```
|
| 141 |
+
pip install git+https://github.com/NullRabbitLabs/nr-bundle-spec.git
|
| 142 |
+
```
|
| 143 |
+
|
| 144 |
+
For a full worked example that loads a bundle from `nr-bundles-public` via the spec parser, applies the scoreability gate, and renders verdicts on attack + benign + passive-benign samples, see [`inference_example.py`](inference_example.py).
|
| 145 |
+
|
| 146 |
+
### Bypassing the gate
|
| 147 |
+
|
| 148 |
+
Callers with their own pre-filtering pipeline (or who explicitly want the raw model output) can load the estimator directly:
|
| 149 |
+
|
| 150 |
+
```python
|
| 151 |
+
import joblib
|
| 152 |
+
import numpy as np
|
| 153 |
+
|
| 154 |
+
payload = joblib.load(model_path)
|
| 155 |
+
model = payload["model"] # CalibratedClassifierCV
|
| 156 |
+
features = payload["feature_names"] # 7-feature contract
|
| 157 |
+
|
| 158 |
+
X = np.array([[...]]) # shape (n_samples, 7)
|
| 159 |
+
score = model.predict_proba(X)[:, 1]
|
| 160 |
+
```
|
| 161 |
+
|
| 162 |
+
**This path is the responsibility of the caller.** If you feed an all-zero feature vector to `model.predict_proba`, V8 will return ~0.9977, which is spurious. The scoreability gate exists for exactly that case. See the Load-bearing limitations section.
|
| 163 |
+
|
| 164 |
+
## Methodology
|
| 165 |
+
|
| 166 |
+
NullRabbit's training cycles follow pre-registration discipline. Each cycle has a design document committed before the trainer runs. Audits run on close against sanity floors, per-feature ablation trails, and falsification holdouts. Where an audit fires, training halts, the design is re-registered, and the prior version is retracted in writing.
|
| 167 |
+
|
| 168 |
+
The **iterative leak-surface peeling pattern** is the methodology contribution: detection of a training-time leak (a feature whose discriminative signal turns out to come from a labelling artefact or capture-pipeline asymmetry rather than from the attack mechanism) triggers a corpus delta + re-train + re-audit, with each cycle narrowing the leak surface. V8 is the cycle that landed when the methodology's leak-surface was small enough that the manifest generalised across chains; the cycles before it (V1–V7) closed specific leaks named in the substrate paper's leak-surface appendix.
|
| 169 |
+
|
| 170 |
+
The corpus format and family taxonomy are open at `nr-bundle-spec`. The methodology is open (in preparation as the substrate paper). The specific corpus contents beyond `nr-bundles-public` are proprietary.
|
| 171 |
+
|
| 172 |
+
## Related
|
| 173 |
+
|
| 174 |
+
- **Bundle format spec**: [`nr-bundle-spec`](https://github.com/NullRabbitLabs/nr-bundle-spec) (MIT)
|
| 175 |
+
- **Reference public bundles**: [NullRabbit/nr-bundles-public](https://huggingface.co/datasets/NullRabbit/nr-bundles-public) (CC-BY-4.0)
|
| 176 |
+
- **Earned-autonomy paper** (governance layer for autonomous defence for decentralised networks): [Zenodo DOI 10.5281/zenodo.18406828](https://doi.org/10.5281/zenodo.18406828)
|
| 177 |
+
- **Substrate paper** (data-layer methodology, in preparation)
|
| 178 |
+
- **NullRabbit Labs**: [huggingface.co/NullRabbit](https://huggingface.co/NullRabbit)
|
| 179 |
+
- **Website**: [nullrabbit.ai](https://nullrabbit.ai)
|
| 180 |
+
|
| 181 |
+
## Citation
|
| 182 |
+
|
| 183 |
+
```bibtex
|
| 184 |
+
@misc{nullrabbit_v8_cipher_agnostic_2026,
|
| 185 |
+
author = {NullRabbit},
|
| 186 |
+
title = {V8 cipher-agnostic byte-amplification detector},
|
| 187 |
+
year = {2026},
|
| 188 |
+
month = may,
|
| 189 |
+
version = {1},
|
| 190 |
+
publisher = {Hugging Face},
|
| 191 |
+
url = {https://huggingface.co/NullRabbit/v8-cipher-agnostic},
|
| 192 |
+
note = {Reference binary detector for byte-amplification attacks on validator-infrastructure JSON-RPC endpoints. Trained on the bundle v1 corpus specified at nr-bundle-spec v0.1.0; curated public sample at NullRabbit/nr-bundles-public.},
|
| 193 |
+
}
|
| 194 |
+
```
|
| 195 |
+
|
| 196 |
+
## Contact
|
| 197 |
+
|
| 198 |
+
Research enquiries: simon@nullrabbit.ai
|
| 199 |
+
|
| 200 |
+
Spec compliance or format questions — open an issue at [`nr-bundle-spec`](https://github.com/NullRabbitLabs/nr-bundle-spec).
|
inference_example.py
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
# SPDX-License-Identifier: Apache-2.0
|
| 3 |
+
"""V8 cipher-agnostic byte-amplification detector — end-to-end inference example.
|
| 4 |
+
|
| 5 |
+
Three-artefact collaboration. This script:
|
| 6 |
+
|
| 7 |
+
1. Downloads a bundle from the public NullRabbit/nr-bundles-public dataset
|
| 8 |
+
on Hugging Face.
|
| 9 |
+
2. Downloads the V8 model and the scoreability-gated inference helper
|
| 10 |
+
(``predict.py``) from this repository.
|
| 11 |
+
3. Loads the bundle manifest via the bundle-spec reference parser
|
| 12 |
+
(NullRabbitLabs/nr-bundle-spec, MIT).
|
| 13 |
+
4. Calls ``predict.score_bundle()`` to apply the scoreability gate and
|
| 14 |
+
produce a verdict.
|
| 15 |
+
|
| 16 |
+
A worked demonstration of the **spec → corpus → model** path: bundles on
|
| 17 |
+
disk are conformant with an open spec; the spec's reference parser loads
|
| 18 |
+
them; the scoreability-gated inference helper produces verdicts.
|
| 19 |
+
|
| 20 |
+
Dependencies::
|
| 21 |
+
|
| 22 |
+
pip install huggingface_hub pyarrow scikit-learn joblib numpy
|
| 23 |
+
pip install git+https://github.com/NullRabbitLabs/nr-bundle-spec.git
|
| 24 |
+
|
| 25 |
+
Usage::
|
| 26 |
+
|
| 27 |
+
python inference_example.py
|
| 28 |
+
|
| 29 |
+
Three bundles are scored: a known-attack (sui_F10_multi_get_objects_amp),
|
| 30 |
+
a known-benign with traffic (sui_BENIGN_reproducer_pipeline), and a
|
| 31 |
+
known-benign without traffic (sui_BENIGN_passive_fullnode) — the third
|
| 32 |
+
demonstrates the scoreability gate refusing to predict on empty bundles.
|
| 33 |
+
"""
|
| 34 |
+
|
| 35 |
+
from __future__ import annotations
|
| 36 |
+
|
| 37 |
+
import importlib.util
|
| 38 |
+
import sys
|
| 39 |
+
from pathlib import Path
|
| 40 |
+
|
| 41 |
+
from huggingface_hub import hf_hub_download, snapshot_download
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
# ─── Constants ──────────────────────────────────────────────────────
|
| 45 |
+
|
| 46 |
+
V8_MODEL_REPO = "NullRabbit/v8-cipher-agnostic"
|
| 47 |
+
DATASET_REPO = "NullRabbit/nr-bundles-public"
|
| 48 |
+
|
| 49 |
+
# Three sample bundles: attack, scoreable benign, unscoreable benign.
|
| 50 |
+
SAMPLES = [
|
| 51 |
+
("crp_19d438471fec4229", "sui_F10_multi_get_objects_amp", "attack"),
|
| 52 |
+
("crp_8b85da89c4e34d4c", "sui_BENIGN_reproducer_pipeline", "benign"),
|
| 53 |
+
("crp_0598afb4d5e44fb9", "sui_BENIGN_passive_fullnode", "benign (passive)"),
|
| 54 |
+
]
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
def _load_module(name: str, path: str) -> "object":
|
| 58 |
+
spec = importlib.util.spec_from_file_location(name, path)
|
| 59 |
+
module = importlib.util.module_from_spec(spec) # type: ignore[arg-type]
|
| 60 |
+
sys.modules[name] = module
|
| 61 |
+
spec.loader.exec_module(module) # type: ignore[union-attr]
|
| 62 |
+
return module
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
def main() -> int:
|
| 66 |
+
print("=== V8 cipher-agnostic byte-amplification detector ===")
|
| 67 |
+
print(f" model repo: {V8_MODEL_REPO}")
|
| 68 |
+
print(f" dataset repo: {DATASET_REPO}")
|
| 69 |
+
print()
|
| 70 |
+
|
| 71 |
+
# Pull the V8 model + predict.py (the scoreability-gated helper).
|
| 72 |
+
model_path = hf_hub_download(repo_id=V8_MODEL_REPO, filename="model.joblib")
|
| 73 |
+
predict_path = hf_hub_download(repo_id=V8_MODEL_REPO, filename="predict.py")
|
| 74 |
+
|
| 75 |
+
# Load the helper as a module + load V8 via the helper.
|
| 76 |
+
predict = _load_module("v8_predict", predict_path)
|
| 77 |
+
payload = predict.load_v8(model_path)
|
| 78 |
+
|
| 79 |
+
print(f"V8 loaded: {type(payload['model']).__name__}, "
|
| 80 |
+
f"{len(payload['feature_names'])} features, "
|
| 81 |
+
f"manifest={payload['manifest_name']!r}")
|
| 82 |
+
print()
|
| 83 |
+
|
| 84 |
+
# Pull the three sample bundles.
|
| 85 |
+
dataset_root = Path(snapshot_download(
|
| 86 |
+
repo_id=DATASET_REPO, repo_type="dataset",
|
| 87 |
+
allow_patterns=[f"{cid}/*" for cid, _, _ in SAMPLES],
|
| 88 |
+
))
|
| 89 |
+
|
| 90 |
+
# Score each via the gated helper.
|
| 91 |
+
for corpus_id, primitive_id_expected, label in SAMPLES:
|
| 92 |
+
bundle_dir = dataset_root / corpus_id
|
| 93 |
+
record = predict.score_bundle(bundle_dir, payload)
|
| 94 |
+
print(f"--- {corpus_id} ({primitive_id_expected}) ---")
|
| 95 |
+
print(f" ground_truth label: {label}")
|
| 96 |
+
print(f" verdict: {record['verdict']}")
|
| 97 |
+
if record["verdict"] == "unscoreable":
|
| 98 |
+
print(f" reason: {record['reason']}")
|
| 99 |
+
print(f" n_responses_rows: {record.get('n_responses_rows', 0)}")
|
| 100 |
+
else:
|
| 101 |
+
print(f" V8 score: {record['v8_score']:.4f}")
|
| 102 |
+
print(f" feature_coverage: {record['feature_coverage']}")
|
| 103 |
+
print(f" n_responses_rows: {record['n_responses_rows']}")
|
| 104 |
+
print(f" features:")
|
| 105 |
+
for k, v in record["features"].items():
|
| 106 |
+
print(f" {k:<28s} {v:>12.4f}")
|
| 107 |
+
print()
|
| 108 |
+
|
| 109 |
+
print("=" * 72)
|
| 110 |
+
print("Notes on V8 deployment")
|
| 111 |
+
print("=" * 72)
|
| 112 |
+
print("""
|
| 113 |
+
- predict.score_bundle() is the recommended consumption surface. The
|
| 114 |
+
scoreability gate refuses to predict on bundles where responses.parquet
|
| 115 |
+
is missing or zero-rows. Callers who want raw model output without the
|
| 116 |
+
gate should load model.joblib directly via joblib.load.
|
| 117 |
+
|
| 118 |
+
- feature_coverage=resp_only means raw packets.pcap is absent (as in the
|
| 119 |
+
public nr-bundles-public bundles). V8's two cardinality features default
|
| 120 |
+
to 0, which under-scores attacks relative to the model's training
|
| 121 |
+
expectation. For full-coverage inference, produce your own bundles per
|
| 122 |
+
nr-bundle-spec with raw pcap retained.
|
| 123 |
+
|
| 124 |
+
- V8 is a binary detector for the byte-amplification family. Attacks from
|
| 125 |
+
other vulnerability families (reconnaissance, service_misconfig,
|
| 126 |
+
auth_bypass, rate_limiter_bypass with simulateTransaction shape) will
|
| 127 |
+
score "benign" — this is correct behaviour, not a failure. Use the
|
| 128 |
+
multi-class softmax model NullRabbit/multiclass-folded for unified
|
| 129 |
+
attack-family detection.
|
| 130 |
+
""".strip())
|
| 131 |
+
print("=" * 72)
|
| 132 |
+
return 0
|
| 133 |
+
|
| 134 |
+
|
| 135 |
+
if __name__ == "__main__":
|
| 136 |
+
raise SystemExit(main())
|
model.joblib
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4bf2fc158fbc0bf22dbfc4317c11e252c0e0c4706472a6da647077031d7d27b7
|
| 3 |
+
size 3063106
|
predict.py
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
# SPDX-License-Identifier: Apache-2.0
|
| 3 |
+
"""V8 cipher-agnostic byte-amplification detector — scoreability-gated inference.
|
| 4 |
+
|
| 5 |
+
This is the **recommended consumption surface** for V8. It wraps the raw
|
| 6 |
+
``CalibratedClassifierCV`` estimator with two production-side gates:
|
| 7 |
+
|
| 8 |
+
1. **Scoreability gate**: refuses to score bundles where
|
| 9 |
+
``responses.parquet`` is missing or zero-rows. V8's training
|
| 10 |
+
distribution doesn't cover all-zero feature vectors and the
|
| 11 |
+
underlying estimator produces spurious high attack-scores on them
|
| 12 |
+
(typical for passive-workload bundles where the validator listens
|
| 13 |
+
without serving RPC). The gate returns an explicit "unscoreable"
|
| 14 |
+
verdict instead.
|
| 15 |
+
|
| 16 |
+
2. **Feature-coverage gate**: notes when the raw ``packets.pcap`` is
|
| 17 |
+
absent (as in the public ``nr-bundles-public`` bundles) and emits
|
| 18 |
+
a coverage flag with the score so callers can downweight or
|
| 19 |
+
ignore the prediction. V8's two cardinality features default to
|
| 20 |
+
0 when raw pcap is absent, which under-scores attacks relative
|
| 21 |
+
to the model's training expectation.
|
| 22 |
+
|
| 23 |
+
Callers who want raw model output without these gates should load
|
| 24 |
+
``model.joblib`` directly via ``joblib.load`` — see the "Bypassing the
|
| 25 |
+
gate" section of the model card.
|
| 26 |
+
|
| 27 |
+
Usage::
|
| 28 |
+
|
| 29 |
+
from predict import score_bundle, load_v8
|
| 30 |
+
|
| 31 |
+
payload = load_v8("/path/to/model.joblib") # or from hf_hub_download
|
| 32 |
+
record = score_bundle("/path/to/some/bundle_dir", payload)
|
| 33 |
+
if record["verdict"] == "unscoreable":
|
| 34 |
+
print(f"refused: {record['reason']}")
|
| 35 |
+
else:
|
| 36 |
+
print(f"V8 score: {record['v8_score']:.4f} ({record['verdict']})")
|
| 37 |
+
"""
|
| 38 |
+
|
| 39 |
+
from __future__ import annotations
|
| 40 |
+
|
| 41 |
+
from pathlib import Path
|
| 42 |
+
from typing import Any
|
| 43 |
+
|
| 44 |
+
import joblib
|
| 45 |
+
import numpy as np
|
| 46 |
+
import pyarrow.parquet as pq
|
| 47 |
+
|
| 48 |
+
# nr-bundle-spec — the reference parser. Pip-install via
|
| 49 |
+
# pip install git+https://github.com/NullRabbitLabs/nr-bundle-spec.git
|
| 50 |
+
from bundle_spec import BundleManifest
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
V8_FEATURES = [
|
| 54 |
+
"pcap.unique_dst_ports",
|
| 55 |
+
"pcap.unique_src_ports",
|
| 56 |
+
"resp.amp_ratio_max",
|
| 57 |
+
"resp.amp_ratio_mean",
|
| 58 |
+
"resp.amp_ratio_median",
|
| 59 |
+
"resp.req_bytes_max",
|
| 60 |
+
"resp.resp_bytes_max",
|
| 61 |
+
]
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
def load_v8(model_path: str | Path) -> dict[str, Any]:
|
| 65 |
+
"""Load the V8 lineage-dict payload from a joblib file."""
|
| 66 |
+
return joblib.load(model_path)
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
def _extract_features(bundle_dir: Path) -> tuple[dict[str, float], int, bool]:
|
| 70 |
+
"""Extract V8 features + diagnostic flags from a bundle.
|
| 71 |
+
|
| 72 |
+
Returns (features, n_responses_rows, has_packets_pcap).
|
| 73 |
+
"""
|
| 74 |
+
features = {name: 0.0 for name in V8_FEATURES}
|
| 75 |
+
|
| 76 |
+
responses_path = bundle_dir / "responses.parquet"
|
| 77 |
+
n_resp_rows = 0
|
| 78 |
+
if responses_path.is_file():
|
| 79 |
+
table = pq.read_table(responses_path)
|
| 80 |
+
n_resp_rows = table.num_rows
|
| 81 |
+
if n_resp_rows > 0:
|
| 82 |
+
req = table.column("request_size_bytes").to_numpy()
|
| 83 |
+
resp = table.column("response_size_bytes").to_numpy()
|
| 84 |
+
features["resp.req_bytes_max"] = float(req.max())
|
| 85 |
+
features["resp.resp_bytes_max"] = float(resp.max())
|
| 86 |
+
with np.errstate(divide="ignore", invalid="ignore"):
|
| 87 |
+
ratios = np.where(req > 0, resp / req, 0.0)
|
| 88 |
+
features["resp.amp_ratio_max"] = float(ratios.max())
|
| 89 |
+
features["resp.amp_ratio_mean"] = float(ratios.mean())
|
| 90 |
+
features["resp.amp_ratio_median"] = float(np.median(ratios))
|
| 91 |
+
|
| 92 |
+
has_packets_pcap = (bundle_dir / "packets.pcap").is_file()
|
| 93 |
+
# If raw pcap is present, callers can implement the cardinality
|
| 94 |
+
# feature extraction; this helper does not parse pcaps. The two
|
| 95 |
+
# pcap.unique_*_ports features stay at 0.0 — emitting a coverage
|
| 96 |
+
# warning to the caller is the gate's job.
|
| 97 |
+
return features, n_resp_rows, has_packets_pcap
|
| 98 |
+
|
| 99 |
+
|
| 100 |
+
def score_bundle(
|
| 101 |
+
bundle_dir: str | Path, payload: dict[str, Any]
|
| 102 |
+
) -> dict[str, Any]:
|
| 103 |
+
"""Score a bundle through V8, with the scoreability gate applied.
|
| 104 |
+
|
| 105 |
+
Returns a record with:
|
| 106 |
+
- ``verdict``: one of ``"attack"``, ``"benign"``, ``"unscoreable"``.
|
| 107 |
+
- ``v8_score``: P(attack) in [0, 1], or ``None`` if unscoreable.
|
| 108 |
+
- ``reason``: human-readable explanation when unscoreable.
|
| 109 |
+
- ``feature_coverage``: ``"full"`` or ``"resp_only"`` (raw pcap absent).
|
| 110 |
+
- ``corpus_id``, ``primitive_id``, ``ground_truth``: from manifest.
|
| 111 |
+
- ``features``: the 7 feature values as scored (zeros where absent).
|
| 112 |
+
- ``n_responses_rows``: number of rows in responses.parquet.
|
| 113 |
+
"""
|
| 114 |
+
bundle_dir = Path(bundle_dir)
|
| 115 |
+
|
| 116 |
+
manifest_path = bundle_dir / "manifest.json"
|
| 117 |
+
if not manifest_path.is_file():
|
| 118 |
+
return {
|
| 119 |
+
"verdict": "unscoreable",
|
| 120 |
+
"reason": f"manifest.json not found at {manifest_path}",
|
| 121 |
+
"v8_score": None,
|
| 122 |
+
}
|
| 123 |
+
manifest = BundleManifest.model_validate_json(manifest_path.read_text())
|
| 124 |
+
|
| 125 |
+
features, n_resp_rows, has_packets_pcap = _extract_features(bundle_dir)
|
| 126 |
+
|
| 127 |
+
# Scoreability gate
|
| 128 |
+
if n_resp_rows == 0:
|
| 129 |
+
return {
|
| 130 |
+
"verdict": "unscoreable",
|
| 131 |
+
"reason": (
|
| 132 |
+
"responses.parquet is missing or zero-rows; V8 cannot score "
|
| 133 |
+
"bundles with no observed RPC traffic. Use a non-amplification-"
|
| 134 |
+
"family detector for passive-workload bundles, or compose with "
|
| 135 |
+
"the multi-class softmax model NullRabbit/multiclass-folded."
|
| 136 |
+
),
|
| 137 |
+
"v8_score": None,
|
| 138 |
+
"corpus_id": manifest.corpus_id,
|
| 139 |
+
"primitive_id": manifest.primitive_id,
|
| 140 |
+
"n_responses_rows": 0,
|
| 141 |
+
"feature_coverage": "none",
|
| 142 |
+
}
|
| 143 |
+
|
| 144 |
+
# Score
|
| 145 |
+
X = np.array([[features[name] for name in V8_FEATURES]])
|
| 146 |
+
score = float(payload["model"].predict_proba(X)[0, 1])
|
| 147 |
+
verdict = "attack" if score >= 0.5 else "benign"
|
| 148 |
+
coverage = "full" if has_packets_pcap else "resp_only"
|
| 149 |
+
|
| 150 |
+
return {
|
| 151 |
+
"verdict": verdict,
|
| 152 |
+
"v8_score": score,
|
| 153 |
+
"reason": None,
|
| 154 |
+
"corpus_id": manifest.corpus_id,
|
| 155 |
+
"primitive_id": manifest.primitive_id,
|
| 156 |
+
"ground_truth": (
|
| 157 |
+
manifest.ground_truth_label.value
|
| 158 |
+
if hasattr(manifest.ground_truth_label, "value")
|
| 159 |
+
else str(manifest.ground_truth_label)
|
| 160 |
+
),
|
| 161 |
+
"features": features,
|
| 162 |
+
"n_responses_rows": n_resp_rows,
|
| 163 |
+
"feature_coverage": coverage,
|
| 164 |
+
}
|
release-cert.json
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"audited_at": "2026-05-13T13:53:36Z",
|
| 3 |
+
"model_repo": "NullRabbit/v8-cipher-agnostic",
|
| 4 |
+
"checks": [
|
| 5 |
+
{
|
| 6 |
+
"check": "joblib_loads",
|
| 7 |
+
"ok": true
|
| 8 |
+
},
|
| 9 |
+
{
|
| 10 |
+
"check": "lineage_dict_shape",
|
| 11 |
+
"ok": true
|
| 12 |
+
},
|
| 13 |
+
{
|
| 14 |
+
"check": "predict_py_exists",
|
| 15 |
+
"ok": true
|
| 16 |
+
},
|
| 17 |
+
{
|
| 18 |
+
"check": "predict_py_compiles",
|
| 19 |
+
"ok": true
|
| 20 |
+
},
|
| 21 |
+
{
|
| 22 |
+
"check": "inference_example_exists",
|
| 23 |
+
"ok": true
|
| 24 |
+
},
|
| 25 |
+
{
|
| 26 |
+
"check": "inference_example_compiles",
|
| 27 |
+
"ok": true
|
| 28 |
+
},
|
| 29 |
+
{
|
| 30 |
+
"check": "apache_2_0_license_text_present",
|
| 31 |
+
"ok": true
|
| 32 |
+
},
|
| 33 |
+
{
|
| 34 |
+
"check": "readme_cites_cipher_agnostic_v2",
|
| 35 |
+
"ok": true
|
| 36 |
+
},
|
| 37 |
+
{
|
| 38 |
+
"check": "readme_cites_calibrated_classifier",
|
| 39 |
+
"ok": true
|
| 40 |
+
},
|
| 41 |
+
{
|
| 42 |
+
"check": "readme_cites_1972_bundles",
|
| 43 |
+
"ok": true
|
| 44 |
+
},
|
| 45 |
+
{
|
| 46 |
+
"check": "readme_cites_897_attack",
|
| 47 |
+
"ok": true
|
| 48 |
+
},
|
| 49 |
+
{
|
| 50 |
+
"check": "readme_cites_1075_benign",
|
| 51 |
+
"ok": true
|
| 52 |
+
},
|
| 53 |
+
{
|
| 54 |
+
"check": "readme_cites_seed_42",
|
| 55 |
+
"ok": true
|
| 56 |
+
},
|
| 57 |
+
{
|
| 58 |
+
"check": "readme_cites_v1.1_features_version",
|
| 59 |
+
"ok": true
|
| 60 |
+
},
|
| 61 |
+
{
|
| 62 |
+
"check": "readme_anchor_autonomous_defence",
|
| 63 |
+
"ok": true
|
| 64 |
+
},
|
| 65 |
+
{
|
| 66 |
+
"check": "readme_anchor_cipher_agnostic",
|
| 67 |
+
"ok": true
|
| 68 |
+
},
|
| 69 |
+
{
|
| 70 |
+
"check": "readme_anchor_byte_amplification",
|
| 71 |
+
"ok": true
|
| 72 |
+
},
|
| 73 |
+
{
|
| 74 |
+
"check": "readme_anchor_iterative_leak_surface_peeling",
|
| 75 |
+
"ok": true
|
| 76 |
+
},
|
| 77 |
+
{
|
| 78 |
+
"check": "readme_substrate_paper_in_preparation",
|
| 79 |
+
"ok": true
|
| 80 |
+
},
|
| 81 |
+
{
|
| 82 |
+
"check": "readme_zenodo_doi_present",
|
| 83 |
+
"ok": true
|
| 84 |
+
},
|
| 85 |
+
{
|
| 86 |
+
"check": "readme_cross_links_nr_bundles_public",
|
| 87 |
+
"ok": true
|
| 88 |
+
},
|
| 89 |
+
{
|
| 90 |
+
"check": "readme_cross_links_nr_bundle_spec",
|
| 91 |
+
"ok": true
|
| 92 |
+
},
|
| 93 |
+
{
|
| 94 |
+
"check": "readme_has_load_bearing_limitations_section",
|
| 95 |
+
"ok": true
|
| 96 |
+
},
|
| 97 |
+
{
|
| 98 |
+
"check": "readme_has_cardinality_envelope",
|
| 99 |
+
"ok": true
|
| 100 |
+
},
|
| 101 |
+
{
|
| 102 |
+
"check": "readme_has_saturation_envelope",
|
| 103 |
+
"ok": true
|
| 104 |
+
},
|
| 105 |
+
{
|
| 106 |
+
"check": "readme_has_cross_chain_class_specific",
|
| 107 |
+
"ok": true
|
| 108 |
+
},
|
| 109 |
+
{
|
| 110 |
+
"check": "readme_has_phase_1_close_gate",
|
| 111 |
+
"ok": true
|
| 112 |
+
},
|
| 113 |
+
{
|
| 114 |
+
"check": "readme_has_family_specific_clarification",
|
| 115 |
+
"ok": true
|
| 116 |
+
},
|
| 117 |
+
{
|
| 118 |
+
"check": "readme_has_empty_bundle_mis_scoring",
|
| 119 |
+
"ok": true
|
| 120 |
+
},
|
| 121 |
+
{
|
| 122 |
+
"check": "readme_apache_2_0_license",
|
| 123 |
+
"ok": true
|
| 124 |
+
},
|
| 125 |
+
{
|
| 126 |
+
"check": "readme_recommends_predict_py",
|
| 127 |
+
"ok": true
|
| 128 |
+
},
|
| 129 |
+
{
|
| 130 |
+
"check": "readme_has_bypassing_the_gate_section",
|
| 131 |
+
"ok": true
|
| 132 |
+
},
|
| 133 |
+
{
|
| 134 |
+
"check": "gate_attack_bundle_scores_attack",
|
| 135 |
+
"ok": true,
|
| 136 |
+
"verdict": "attack",
|
| 137 |
+
"v8_score": 0.9976744186046511,
|
| 138 |
+
"primitive_id": "sui_F10_multi_get_objects_amp"
|
| 139 |
+
},
|
| 140 |
+
{
|
| 141 |
+
"check": "gate_scoreable_benign_scores_benign",
|
| 142 |
+
"ok": true,
|
| 143 |
+
"verdict": "benign",
|
| 144 |
+
"v8_score": 0.0,
|
| 145 |
+
"primitive_id": "sui_BENIGN_reproducer_pipeline"
|
| 146 |
+
},
|
| 147 |
+
{
|
| 148 |
+
"check": "gate_zero_rows_responses_returns_unscoreable",
|
| 149 |
+
"ok": true,
|
| 150 |
+
"verdict": "unscoreable",
|
| 151 |
+
"reason": "responses.parquet is missing or zero-rows; V8 cannot score bundles with no observed RPC traffic. Use a non-amplification-family detector for passive-workload bundles, or compose with the multi-class softmax model NullRabbit/multiclass-folded."
|
| 152 |
+
},
|
| 153 |
+
{
|
| 154 |
+
"check": "gate_missing_responses_returns_unscoreable",
|
| 155 |
+
"ok": true,
|
| 156 |
+
"verdict": "unscoreable"
|
| 157 |
+
}
|
| 158 |
+
],
|
| 159 |
+
"n_checks": 36,
|
| 160 |
+
"n_ok": 36,
|
| 161 |
+
"release_ok": true
|
| 162 |
+
}
|