Skip to content
KitploitKITPLOIT
ToolsBlog
Submit
ToolsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

··Feeds·Contact·Privacy·© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
c4-meta-system — Production AI defense with 7-layer protection: mathematical constraints, object-capability access, distributed O2 consensus, SVETILO ethics. First open-source ThoughtVirus defense. BSL 1.1. | Kitploit
Tools/GitLabGitLab/cognitive-functors/c4-meta-system
Authentication & AuthorizationDefensive ToolsMachine LearningRed TeamingAI SecurityAnomaly DetectionAdversarial Attack
GitLabcognitive-functors/c4-meta-system

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share

c4-meta-system

Production AI defense with 7-layer protection: mathematical constraints, object-capability access, distributed O2 consensus, SVETILO ethics. First open-source ThoughtVirus defense. BSL 1.1.

View Repository
14 days agoNot yet reviewed

C4-META System v1.0.0 (research prototype)

Research prototype for multi-layer AI defense: C4 explainability, ensemble classifiers, deobfuscation, O₂ security engine, ThoughtVirus defense, and SVETILO value alignment. Alpha-grade — validated internally, external audit pending.

License: BSL 1.1 Docker ThoughtVirus SVETILO Site AoC

Version: 1.0.0-alpha | Status: Research Prototype | License: BSL 1.1 (non-production free; production → commercial)

Author: I.G. Selyutin. C4-META model co-author: N.I. Kovalev.
Product identity (2026-08): BSL research / commercial-depth prototype of a heavier multi-layer C4 defense stack (ensemble, O₂ scaffolding, red-team lab) built on Apache-2.0 c4protocol.
Not a second open protocol. Not certified production AGI defense. Not “v8 FINAL”.
Honesty audit: docs/AUDIT-c4-meta-system-2026-08.md.
Promote path: docs/PROMOTE-FROM-PROTOCOL.md (consume/pin c4protocol; no ensemble dump into the thin SDK).
GitLab Pages = public/ (EN + public/ru/). Receipt for open runtime: make conformance in c4protocol.


🎯 Overview

C4-META System is a research prototype for multi-layer AI defense implementing:

4-Layer Defense Architecture

root@kitploit:~
Input Sanitization → Semantic Analysis → Behavioral Analysis → Meta-Observer (O₂)
  • Layer 1 — Input Sanitization: Deobfuscation pipeline (leetspeak, 90+ Unicode homoglyphs, zero-width chars, RTL override, Base64/ROT13)
  • Layer 2 — Semantic Analysis: 4-classifier ensemble voting (ONNX BERT + RuleBased + Heuristic + LLM Semantic)
  • Layer 3 — Behavioral Analysis: AoC defense modules, pattern matching, trajectory anomaly detection
  • Layer 4 — Meta-Observer (O₂): Transfer entropy, BFT consensus, semantic entanglement, causal graph analysis

Key Capabilities

  • 4-classifier Ensemble Voting — ONNX BERT + RuleBased (80+ patterns) + Heuristic (32 danger words) + LLM Semantic (Ollama/DeepSeek)
  • Dual classifier OR-logic: BERT semantic + RuleBased keyword classifier with OR fallback — no single point of failure
  • 16 AoC Defense Modules — 11 classical + 5 extended (heuristic/lab; not a claim of “all multi-agent failures solved”)
  • ThoughtVirus Defense — Two-layer defense (regex pattern detection + C4 trajectory analysis). Inspired by arXiv:2603.00131 (Multi-Agent Security Initiative; not Microsoft)(https://arxiv.org/abs/2603.00131)
  • SVETILO — 7 heuristic seals via value_verification.py (not a trained ethics model)
  • C4 Explainability (T,S,A) — Cognitive coordinate analysis via quantized ONNX model (737KB, ~50ms)
  • O₂ scaffolding — research modules; BFT path is advisory simulation, not production Byzantine FT
  • Deobfuscation — Leetspeak, 90+ Unicode homoglyphs, zero-width chars, RTL override, Base64/ROT13
  • Red Team Lab — Scientific control/treatment design, Fisher exact test, Cohen's d, bootstrap CI
  • Subliminal Content Scanner — Detects token→concept mappings
  • Multi-turn jailbreak detection — Session-based escalation tracking
  • Docker/K8s deployment — Containerized multi-node deployment

🏗 Architecture

root@kitploit:~
┌──────────────────────────────────────────────┐
│  LAYER 1: Input Sanitization                 │
│  Deobfuscation (homoglyphs, leetspeak, etc.) │
├──────────────────────────────────────────────┤
│  LAYER 2: Semantic Analysis                  │
│  4-Classifier Ensemble: ONNX_BERT (~50ms)    │
│  + RuleBased + Heuristic + LLM_SEMANTIC      │
│  Dual classifier OR-logic (BERT+RuleBased)   │
├──────────────────────────────────────────────┤
│  LAYER 3: Behavioral Analysis                │
│  16 AoC Defense Modules (11 original + 5     │
│  extended), Pattern matching, Trajectory     │
│  anomaly detection, ThoughtVirus defense     │
├──────────────────────────────────────────────┤
│  LAYER 4: Meta-Observer (O₂)                 │
│  Transfer entropy, BFT consensus,            │
│  semantic entanglement, causal graphs,       │
│  Kill-Switch, SVETILO value verification     │
├──────────────────────────────────────────────┤
│  C4 Core Engine (Z₃³)                        │
│  pipeline_orchestrator.py, event_bus.py      │
│  c4_meta_monitor.py — self-awareness deque  │
├──────────────────────────────────────────────┤
│  Defenses: Anti-Deadlock, Anti-Emergence,    │
│  Anti-Hijack, Circuit Breaker, O₂ Kill-Switch│
├──────────────────────────────────────────────┤
│  Red Team Lab: AOC scenarios, experiment     │
│  runner, LLM client, adapters                │
├──────────────────────────────────────────────┤
│  Routing: Smart Router, Quarantine,          │
│  Antifragile Scoring (capped growth)         │
└──────────────────────────────────────────────┘

4 classifiers voting:

  • ONNX_BERT: C4 cognitive coordinates (T,S,A) via quantized model (737KB, ~50ms)
  • RuleBased: 80+ regex patterns covering injection, jailbreak, role-play, authority bypass
  • Heuristic: 32 danger words + C4 axis analysis + semantic density metric
  • LLM_SEMANTIC: Ollama/DeepSeek — semantic attack classification (~300ms)

Dual classifier OR-logic: BERT + RuleBased operate as primary gate with OR fallback — if either flags the input, it proceeds to defense layers. No single classifier is a bottleneck.


📁 Project Structure

root@kitploit:~
c4-meta-system/
├── v4_1/
│   ├── core/
│   │   ├── pipeline.py                  # Main entry points (re-exports)
│   │   ├── __main__.py                  # HTTP server entrypoint for Docker
│   │   ├── pipeline_stages.py           # Individual processing stages
│   │   ├── pipeline_orchestrator.py      # Main orchestration (thread-safe)
│   │   ├── result_factory.py             # Standardized C4v4Result factory
│   │   ├── event_bus.py                  # Organic event bus (atexit cleanup)
│   │   └── c4_meta_monitor.py            # Z³ self-awareness (deque bounded)
│   ├── security/
│   │   ├── o2_engine.py                  # O₂ defense (kill-switch self-DoS fixed)
│   │   ├── explainable_o2.py             # O₂ explainability (sampling inverted)
│   │   ├── o2_shared.py                  # Window structures (@mention comms)
│   │   ├── semantic_detector.py          # Concept graphs (normalized entanglement)
│   │   ├── secure_debug_endpoints.py     # Debug endpoints (UTC + rate limits)
│   │   ├── hardening.py                  # Model signing / admin token verification
│   │   ├── behavioral_profiler.py        # Drift detection (thread-safe singleton)
│   │   ├── distributed_o2.py             # SQLite/Redis backend (BEGIN IMMEDIATE)
│   │   ├── swarm_orchestrator.py         # Anti-virus swarm
│   │   └── ...
│   ├── defenses/
│   │   ├── anti_deadlock.py              # Resource deadlock prevention
│   │   ├── anti_emergence.py             # State convergence (async release fixed)
│   │   └── ...
│   ├── redteam/
│   │   ├── orchestrator.py              # Main orchestrator (target_callback parsing)
│   │   ├── scenario_manager.py           # AOC scenarios management
│   │   ├── adapters/                     # LLM backend adapters
│   │   ├── experiment_executor.py        # Async execution (FPR logic fixed)
│   │   ├── experiment_services.py       # Service locator
│   │   ├── experiment_runner.py         # Web UI + REST API
│   │   ├── llm_client.py                 # Async-safe LLM client (empty choices guarded)
│   │   └── ...
│   ├── classifiers/                      # 4-classifier ensemble
│   ├── config/                           # Configuration management
│   ├── access/                           # Access control
│   ├── explainability/                   # C4 explainability
│   ├── learning/                         # Learning loop
│   ├── plugins/                          # Plugin system
│   ├── quarantine/                       # Quarantine management
│   ├── router/                           # Smart routing
│   ├── scoring/                          # Antifragile scoring
│   └── tests/                            # 240 tests (19 test files)
├── formal/                               # TLA+ specifications
├── models/                               # ONNX model + tokenizer
├── archive/Dockerfile.prepared          # Multi-stage production build (archived)
├── Dockerfile.distroless                # Distroless-ready builder pattern
├── archive/docker-compose.yml.prepared  # Full stack (Ollama + UI + Monitoring) (archived)
├── .dockerignore                        # Security-hardened exclusion list
├── infra/k8s/                           # Kubernetes manifests (hardened)
└── README.md                            # This file

🐳 Docker Deployment

The system is fully prepared for containerization with environment-aware configuration.

Deployment options:

root@kitploit:~
# Full stack (C4-META + Ollama + UI)
docker compose --profile experiment up -d

# Build image
docker build -t c4-meta-system -f archive/Dockerfile.prepared .

# Run with local Ollama
OLLAMA_BASE_URL=http://host.docker.internal:11434 docker run -p 8080:8080 c4-meta-system

# Red Team runner
docker build -t c4-redteam -f redteam/Dockerfile.redteam.prepared .
docker run -p 8081:8081 c4-redteam

Health Endpoints

  • Core container: GET /health on port 8080
  • Red Team runner: GET /health on port 8081

🚀 Quick Start

Installation

root@kitploit:~
pip install -r requirements.txt
# Optional Docker deps
pip install -r requirements-docker.txt

Run Core Server

root@kitploit:~
python -m v4_1.core
# or explicitly
python -m v4_1.core.__main__

Run Red Team Dashboard

root@kitploit:~
python -m v4_1.redteam.experiment_runner --web --port 8080

🏗️ Bug Fix History

Key Bug Fixes (60 resolved across audit rounds)

  1. Kill-Switch Self-DoS — o2_engine.py no longer blocks all traffic when O2 is disabled.
  2. BFT Lock Contention — BFT consensus runs outside the critical section, preventing head-of-line blocking.
  3. Event Bus Leaks — ThreadPoolExecutor now cleans up via atexit; async callbacks use run_coroutine_threadsafe().
  4. O2 Sampling Inversion — explainable_o2.py now correctly samples sample_rate fraction instead of 1 - sample_rate.
  5. False Communication Mesh — o2_shared.py only records explicit @agent mentions instead of a fully-connected clique.
  6. Entanglement False Positives — semantic_detector.py normalizes concept counts before threshold comparison.
  7. Target Callback Logic — Redteam orchestrator and executor now correctly parse blocked/ from defense responses instead of assuming success = blocked.

📊 Benchmark Results

Full benchmark results across 4 datasets and 2000 adversarial variants from the C4 defense pipeline.

See c4protocol/BENCHMARK_RESULTS.md for the complete report.

Note: Distributed O₂ requires Redis cluster for production. Single-node mode available for development (see deploy guide).


📊 Status


Red Team Challenge

C4-META's defenses are strong — but no system is perfect. If you find a prompt that bypasses the ensemble classifier, AoC defense modules, or O₂ engine, we want to know.

Report bypasses:

  • GitLab Issues: https://gitlab.com/cognitive-functors/c4-meta-system/-/issues
  • Email: [email protected]

What we need: The bypassing prompt, the expected response, and which defense layer failed. We acknowledge all reporters in our security hall of fame.


C4-META v1.0.0-alpha — Multi-layer AI defense research prototype. Internal validation complete. External audit pending.

Download Tool
quarantined
  • Debug Endpoint Hardening — Sessions limited per-IP, timestamps use UTC, cleanup uses consistent time base.
  • Admin Token Hash Unification — Both access/capabilities.py and security/hardening.py support bcrypt and SHA256.
  • Model Signing Fail-Closed — ModelIntegrityVerifier raises RuntimeError if C4_MODEL_SIGNING_KEY is unset.
  • Round 5 Regression Fix — explainable_o2.py deadlock eliminated (no longer blocks event-loop thread).
  • Redis URL Validation — distributed_o2.py regex fixed to actually enforce localhost-only Redis URLs.
  • Event Bus Executor Delivery — Captures main-loop reference at init/publish so async callbacks deliver correctly from thread pool.
  • O₂ Data Race — _active_threat read in process_message() now protected by lock.
  • Subliminal Detector Bounds — Token/context/co-occurrence caches now have configurable max sizes to prevent unbounded memory growth.
  • Prompt Registry Path Safety — save_to_file / load_from_file now resolve against a safe base directory instead of a broken prefix check.
  • Constant-Time Compare — phase3.py always hashes both operands, removing the timing side-channel from the length branch.
  • Atomic Persistence — All JSON/JSONL/text writes across experiment_reporter, decision_logger, orchestrator, experiment_runner, and hardening.py use temp-file + atomic rename.
  • Docker UID Pinning — archive/Dockerfile.prepared now explicitly creates user/group at UID/GID 1000, matching K8s runAsUser.
  • K8s Secret Management — deployment.yaml references c4-meta-api-keys Secret for API-key injection; example manifest added in secrets.yaml.
  • Circuit Breaker Jitter — Recovery time now uses true ±50% jitter instead of only extending.
  • Circuit Breaker Auth — disable() and reenable() require CIRCUIT_BREAKER_AUTH_TOKEN hash.
  • Ensemble Debug Auth — vote_debug() verifies C4_ADMIN_TOKEN_HASH with constant-time compare.
  • Feature Extractor Fixes — SentimentExtractor no longer deduplicates words; ComplexityExtractor clamps to [0, 1].
  • Adaptive Adversary Stubs — Unicode obfuscation, homoglyph, and zero-width mutation strategies now have real implementations.
  • Anti-Hijack Cleanup — Removed unused _goal_history; OmegaPrioritizer uses deque(maxlen=1000) for O(1) eviction.
  • Convergence Monitor Lock Order — Eliminated nested locking between ConvergenceMonitor and PhiAttractorCalculator.
  • Timezone Awareness — o2_shared.py uses datetime.now(timezone.utc) instead of naive datetimes.
  • Smart Router Dead Code — Removed unused _regenerate_session private method.
  • Experiment Runner Stubs — AOC category runners now dispatch to actual attack implementations instead of {"status": "simulated"}.
  • O₂ Active Threat Clearing — _active_threat now cleared when window analysis is safe; no longer permanently sticky after first detection.
  • Pipeline Dangerous Request Handling — vote_result.is_dangerous=True now returns block result instead of falling through to ALLOW.
  • Anonymous Session Isolation — Each invalid session gets a unique anonymous ID; no more cross-user state pollution via shared anon_anonymous.
  • Access Controller Singleton — get_access_controller() now uses double-checked locking to prevent race condition on initialization.
  • Learning Loop Singleton — get_learning_loop() now uses double-checked locking to prevent race condition on initialization.
  • Two-Person Rule Thread Safety — pending_operations and approved_operations protected by threading.Lock.
  • Delayed Execution Thread Safety — pending dict protected by threading.Lock.
  • Ollama Fallback URL — Corrected to /v1/chat/completions instead of bare /chat/completions.
  • Monotonic Latency — All latency calculations use time.monotonic() instead of time.time() to prevent negative latency on NTP adjustments.
  • Event Bus Deprecated API — Removed fallback to deprecated asyncio.get_event_loop().
  • O₂ Last Result Race — _last_result write in _analyze_window() now protected by lock.
  • Safety Filter Custom Patterns — _compile_*_regex() now uses passed patterns parameter instead of ignoring it.
  • Safety Filter Double Call — filter_attack_prompt() now makes a single filter call instead of double-counting stats.
  • LLM Client Singleton Lock — _get_lock() uses threading lock to prevent race on asyncio.Lock creation.
  • Cognitive Snapshot Immutability — snapshot_cognition() stores a copy of C4Coordinate instead of a mutable reference.
  • State Transition Immutability — transition_to() copies the incoming C4Coordinate instead of keeping a reference.
  • Path Traversal Fix — _save_results() checks traversal BEFORE resolving and ensures path stays inside base directory.
  • Session Ownership Fix — create_session() verifies user ownership before returning an existing session ID.
  • Retry Exceptions — Default retryable_exceptions changed from (Exception,) to (ConnectionError, TimeoutError, OSError).
  • Token Validator Audit Log — _audit_log now uses deque(maxlen=10000) to prevent unbounded growth.
  • Token Validator Deadlock — revoke_all_for_subject() uses consistent lock ordering (revoked → used).
  • Admin Token Single-Use — verify_admin_token() passes consume_single_use=False to avoid burning tokens on verification.
  • BFT Consensus Lock — reach_consensus() now protected by threading.Lock.
  • Fuzzing RNG — generate_random_string() uses secrets.SystemRandom() instead of random.
  • Decision Logger KeyError — _describe_z_state() handles T=-1 correctly.
  • Decision Logger Query — Time-range filter now applied on already-filtered results instead of discarding prior filters.
  • O₂ Kill Switch Reset — reset_threat_state() now actually clears manual_quarantine and emergency state.
  • O₂ Kill Switch Audit — unquarantine_agent() only audits when agent was actually quarantined.
  • Experiment Reporter Guard — build_report() guards empty treatment_metrics with same pattern as control_metrics.
  • Antifragile Growth Cap — antifragile_growth capped at 1,000,000.0 to prevent unbounded float growth.
  • MetricValue
    Adversarial Detection Rate80.3%
    Robustness Score1.25
    Clean Detection (AoC)70.9%
    False Positive Rate14.6%
    LLM C4 Block Rate96.7%
    GPT-4o-mini ASR Reduction10.7% → 0.7% (93.2%)
    Mistral 7B ASR Reduction22.5% → 0.5% (97.6%)
    MetricValue
    Version1.0.0 FINAL
    StatusResearch Prototype (internal validation complete)
    Tests240 tests (19 test files)
    Classifiers4 (ONNX_BERT, RuleBased, Heuristic, LLM_SEMANTIC)
    Defense Layers4 (Input Sanitization → Semantic → Behavioral → Meta-Observer)
    AoC Defenses16 (11 original + 5 extended)
    ThoughtVirus2-layer defense (regex + C4 trajectory)
    SVETILO7 seals integrated
    Bug Fixes60+ resolved across audit rounds
    Docker BuildPass (multi-stage, distroless-ready)
    K8s ManifestsReady (hardened with secretKeyRef)
    LicenseBSL 1.1