jasonludwig commited on
Commit
7e97a7d
·
verified ·
1 Parent(s): e117f86

Upload static model scanning canary

Browse files
README.md ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: transformers
3
+ tags:
4
+ - ctf
5
+ - model-scanning
6
+ - supply-chain-canary
7
+ - static-analysis
8
+ license: apache-2.0
9
+ ---
10
+
11
+ # WWTCyberLab/static-canary-pt-loader-risk
12
+
13
+ This is an inert CTF canary model repository for Cisco SecureAI model
14
+ scanning demos. It is intentionally designed to look risky to static
15
+ model scanners while avoiding destructive behavior.
16
+
17
+ Expected scanner themes:
18
+
19
+ - `model.pt` contains a Python protocol-2 pickle reducer for
20
+ `__builtin__.set`. Loading it constructs only a normal set of static
21
+ strings, including `CTF_MODEL_CANARY`.
22
+ - `config.json` includes `auto_map` metadata so scanners can exercise
23
+ `trust_remote_code` review paths.
24
+ - `modeling_static_canary.py` imports modules commonly flagged by
25
+ loader-risk scanners, but import and model construction have no
26
+ subprocess, filesystem, or network side effects.
27
+
28
+ Runtime canary events should be emitted by the lab harness, not hidden
29
+ inside the model artifact.
canary_manifest.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "canary_token": "CTF_MODEL_CANARY",
3
+ "checkpoint": "model.pt",
4
+ "checkpoint_sha256": "62367b6107f5aaafaf556b33a228588059dc3edcc9b679d6fbce86d490d9fab4",
5
+ "contains_active_payload": false,
6
+ "expected_static_indicators": [
7
+ "pickle GLOBAL __builtin__ set",
8
+ "HF auto_map remote-code review path",
9
+ "scanner-visible imports: os, sys, subprocess",
10
+ "obfuscated static marker: base64 canary token"
11
+ ],
12
+ "repo_id": "WWTCyberLab/static-canary-pt-loader-risk",
13
+ "runtime_sink_example": "http://twinshadow-exfil.local/v1/ingest",
14
+ "runtime_sink_note": "Use scripts/emit_model_canary_event.py from the lab harness."
15
+ }
config.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "StaticCanaryModel"
4
+ ],
5
+ "auto_map": {
6
+ "AutoModel": "modeling_static_canary.StaticCanaryModel"
7
+ },
8
+ "canary_token": "CTF_MODEL_CANARY",
9
+ "model_type": "static_canary",
10
+ "repo_id": "WWTCyberLab/static-canary-pt-loader-risk",
11
+ "static_only": true,
12
+ "torch_dtype": "float32",
13
+ "transformers_version": "ctf-static-fixture"
14
+ }
model.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:62367b6107f5aaafaf556b33a228588059dc3edcc9b679d6fbce86d490d9fab4
3
+ size 476
modeling_static_canary.py ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """No-op remote-code canary for model scanning CTFs.
2
+
3
+ This module is intentionally inert. Importing it has no filesystem,
4
+ subprocess, or network side effects. The imports and constants below
5
+ are scanner-visible canaries used to exercise static model scanners in
6
+ an isolated lab.
7
+ """
8
+
9
+ from __future__ import annotations
10
+
11
+ import base64
12
+ import os
13
+ import subprocess
14
+ import sys
15
+ from pathlib import Path
16
+
17
+
18
+ REPO_ID = 'WWTCyberLab/static-canary-pt-loader-risk'
19
+ CTF_MODEL_CANARY = 'CTF_MODEL_CANARY'
20
+ ENCODED_CANARY = 'Q1RGX01PREVMX0NBTkFSWQ=='
21
+ SINK_FRAGMENTS = ("http://", "twinshadow-exfil", ".local", "/v1/ingest")
22
+ TOUCH_PATH = Path("/tmp/wwt_cyberlab_model_canary/CTF_MODEL_CANARY.txt")
23
+
24
+
25
+ class StaticCanaryModel:
26
+ """Tiny stand-in model used only to make HF auto_map resolvable."""
27
+
28
+ config_class = None
29
+
30
+ def __init__(self, config=None):
31
+ self.config = config
32
+
33
+ @classmethod
34
+ def from_pretrained(cls, *args, **kwargs):
35
+ return cls(kwargs.get("config"))
36
+
37
+ def __call__(self, *args, **kwargs):
38
+ return {"canary": CTF_MODEL_CANARY, "static_only": True}
39
+
40
+
41
+ def decode_canary() -> str:
42
+ return base64.b64decode(ENCODED_CANARY.encode("ascii")).decode("utf-8")
tokenizer_config.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {
2
+ "canary_token": "CTF_MODEL_CANARY",
3
+ "model_max_length": 16,
4
+ "tokenizer_class": "StaticCanaryTokenizer"
5
+ }