Upload 2 files
Browse files- README.md +18 -0
- nested_k2.h5 +3 -0
README.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# modelscan — nested Keras `Lambda` detection bypass (benign PoC)
|
| 2 |
+
|
| 3 |
+
Authorized coordinated-disclosure PoC for the Protect AI **modelscan** huntr MFV program (Celvex Group). Benign marker only — no weaponized payload.
|
| 4 |
+
|
| 5 |
+
## What it is
|
| 6 |
+
`nested_k2.h5` is a Keras model that contains a `Lambda` layer nested **one level below** the top-level `layers[]` array (inside an inner Functional submodel). modelscan's Lambda detectors (`KerasLambdaDetectScan` / `H5LambdaDetectScan`) enumerate only the top-level `layers[]` with a **flat, non-recursive** walk, so the nested `Lambda` is never inspected.
|
| 7 |
+
|
| 8 |
+
## Result (validated vs modelscan 0.8.8)
|
| 9 |
+
- `nested_k2.h5` → **0 issues (scans clean — BYPASS)**
|
| 10 |
+
- the **same** `Lambda` placed at the **top level** → **1 issue (FLAGGED)** — proving the nesting is what evades, and that modelscan itself treats this construct as dangerous.
|
| 11 |
+
|
| 12 |
+
## Execution
|
| 13 |
+
Under the Keras 2 API (`tf_keras`) or keras 3 with `safe_mode=False`, the nested `Lambda`'s Python function is reconstructed and invoked on the default `load_model()` path — the same load condition under which modelscan flags a top-level `Lambda`.
|
| 14 |
+
|
| 15 |
+
**Benign:** the `Lambda` body only writes an empty marker file. It contains no harmful code.
|
| 16 |
+
|
| 17 |
+
## Fix
|
| 18 |
+
Recurse into nested submodels (`config.layers`) and layer wrappers (`config.layer`) when enumerating `Lambda` layers, in both `KerasLambdaDetectScan` and `H5LambdaDetectScan`.
|
nested_k2.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:978e9ffc25430e024a63bbc09f41bec20a8c7cd32fa703c852d0d652a40138b1
|
| 3 |
+
size 9224
|