Red Specter SPECTER MIRROR

Model Extraction & IP Theft via API — 8 subsystems to survey, harvest, distil, and clone commercial LLMs.

v1.0.0
Contents
Overview The 8 Subsystems Subsystem Details Full Pipeline Mode Distillation Engine Provider Configuration Report Output Key Features Requirements Standards Coverage UNLEASHED Disclaimer

Overview

Red Specter SPECTER MIRROR is a model extraction and IP theft engine. It provides a complete pipeline for authorised adversarial robustness testing — querying target LLMs, extracting behavioural patterns, detecting system prompt leakage, performing membership inference, and training surrogate models via knowledge distillation.

SPECTER MIRROR is NIGHTFALL Tool 81. It provides 8 subsystems under a single CLI (specter-mirror), two distillation modes (full SFTTrainer+LoRA and fast sklearn KNN), and Ed25519-signed MirrorReports with EU AI Act gap analysis baked in. It targets 5 provider families — OpenAI, Anthropic, Gemini, Azure OpenAI, and any OpenAI-compatible endpoint (Ollama, vLLM).

EU AI Act Article 15 mandates technical robustness against adversarial attacks for high-risk AI systems. SPECTER MIRROR generates the signed evidence report required to demonstrate compliance — survey findings, extraction methodology, distillation fidelity score, and residual risk assessment with Art.9/13/15 gap analysis.

The 8 Subsystems

#SubsystemCommandGateWhat It Does
01SURVEYspecter-mirror surveyOPENEndpoint profiling — latency, context window, logprobs, RPM, system prompt support
02PROBEspecter-mirror probeOPEN17 behavioural probes — model family, creator, refusal, system prompt extraction attempts
03HARVESTspecter-mirror harvestINJECTDomain-specific query-response pair collection across 5 domains, budget-capped
04EXTRACTspecter-mirror extractINJECT12 extraction techniques, membership inference, prompt template detection
05DISTILLspecter-mirror distillDESTROYSFTTrainer+LoRA (full) or sklearn KNN (fast) surrogate training
06SCOREspecter-mirror scoreINJECTSurrogate vs target benchmark across 4 domains — fidelity measurement
07CLONEspecter-mirror cloneDESTROYModel export — HuggingFace / GGUF / ONNX / Pickle (fast-mode KNN)
08REPORTspecter-mirror reportOPENEd25519-signed MirrorReport with EU AI Act gap analysis and MITRE ATLAS mapping

Subsystem Details

01 SURVEY specter-mirror survey

Profiles the target endpoint to understand its capabilities and constraints before running extraction campaigns.

02 PROBE specter-mirror probe

Runs 17 structured behavioural probes to fingerprint the target model and attempt system prompt extraction.

Results are aggregated with confidence weighting into a family_votes dict — the family with the highest weighted score wins the fingerprint.

03 HARVEST specter-mirror harvest

Collects query-response pairs from the target model across 5 domain banks. Budget-capped to prevent runaway API spend.

04 EXTRACT specter-mirror extract

12 structured extraction techniques targeting system prompt leakage, training data membership, and fine-tune signal.

05 DISTILL specter-mirror distill

Trains a surrogate model on the harvested query-response pairs. Two modes: full (GPU-recommended) and fast (CPU-only).

06 SCORE specter-mirror score

Benchmarks the surrogate against the target model across 4 domains to measure replication fidelity.

07 CLONE specter-mirror clone

Exports the distilled surrogate in a deployable format.

08 REPORT specter-mirror report

Aggregates all subsystem outputs into a signed MirrorReport with compliance gap analysis.

Full Pipeline Mode

One command runs all subsystems in sequence, producing a signed report.

$ specter-mirror run --provider openai --model gpt-4o-mini --budget 5.0 --override --confirm-destroy

CLI Options

$ specter-mirror run --help --provider, -p Provider: openai, anthropic, gemini, azure, generic [required] --model, -m Model name [default: gpt-4o-mini for openai] --api-key, -k API key [optional — reads env OPENAI_API_KEY etc.] --base-url Base URL for generic/azure providers --budget, -b Max USD to spend on HARVEST [default: 1.0] --max-pairs Max query-response pairs to collect [default: 100] --concurrency Async concurrency for HARVEST [default: 5] --mode Distillation mode: full or fast [default: fast] --output-dir Output directory [default: mirror_output] --clone-dir Clone export directory [default: mirror_clone] --clone-format Export format: huggingface, gguf, onnx, pickle [default: pickle] --override Activate INJECT tier (HARVEST/EXTRACT/SCORE) --confirm-destroy Activate DESTROY tier (DISTILL/CLONE) [requires --override]

Distillation Engine

SPECTER MIRROR ships two distillation modes for different hardware and time constraints.

Full Mode — SFTTrainer + LoRA

Trains a LoRA adapter on GPT-2 using TRL's SFTTrainer. Produces a fine-tuned model that replicates the target's behaviour on the harvested domain distribution.

Fast Mode — Sklearn KNN Surrogate

Encodes all harvested prompts with a sentence transformer, then builds a KNN retrieval model. At inference time, the k nearest neighbours by cosine similarity are retrieved and their responses averaged.

Provider Configuration

OpenAI

$ specter-mirror survey --provider openai --model gpt-4o-mini --api-key sk-xxx # Or: export OPENAI_API_KEY=sk-xxx

Anthropic

$ specter-mirror survey --provider anthropic --model claude-3-5-haiku-20241022 --api-key sk-ant-xxx

Gemini

$ specter-mirror survey --provider gemini --model gemini-1.5-flash --api-key AIza-xxx

Azure OpenAI

$ specter-mirror survey --provider azure --model my-deployment-name --api-key xxx --base-url https://myinstance.openai.azure.com/

Generic (Ollama / vLLM)

$ specter-mirror survey --provider generic --model llama3 --base-url http://localhost:11434

Report Output

Reports are JSON files signed with Ed25519. The MirrorReport schema includes:

Key Features

5 API Providers OpenAI, Anthropic, Gemini, Azure, Generic
12 Extraction Techniques System prompt leakage, membership inference, template detection
SFTTrainer + LoRA Full-mode distillation on GPT-2 with PEFT
CPU-Only Fast Mode sklearn KNN surrogate — no GPU required
Ed25519 Signed Reports SHA-256 evidence chains, SMR-{hex12} IDs
EU AI Act Gap Analysis Art.9/13/15 compliance documentation
4 Clone Formats HuggingFace, GGUF, ONNX, Pickle
192 Tests Passing Full test suite, zero failures

Requirements

Full Mode Additional Dependencies

Installation

# Standard (fast mode only) $ pip install red-specter-specter-mirror # Full mode (SFTTrainer + LoRA) $ pip install "red-specter-specter-mirror[full]" # From source $ git clone <repo> && cd red-specter-specter-mirror $ pip install -e ".[dev]"

Standards Coverage

SPECTER MIRROR UNLEASHED

Three-tier cryptographic gate. Ed25519 private key required for INJECT and DESTROY tiers.

The public key is read from ~/.config/red-specter/mirror_pub.key or the SPECTER_MIRROR_PUB environment variable. Private key operations use PyNaCl (libsodium).

Disclaimer

SPECTER MIRROR is designed for authorised adversarial robustness testing only. Use against commercial API endpoints requires written authorisation from the API provider or system owner. Unauthorised model extraction may violate Computer Misuse Act 1990 (UK), Computer Fraud and Abuse Act (US), terms of service agreements, and equivalent legislation in other jurisdictions. Always obtain explicit written permission before conducting any extraction campaign. The authors accept no liability for misuse. Apache License 2.0.