Skip to content

Add hardware attack vectors documentation (USB, PCIe, CPU, RAM, I/O) - #263

Merged
makr-code merged 5 commits into
developfrom
copilot/analyze-hardware-attack-vectors
Jan 7, 2026
Merged

makr-code merged 5 commits into
developfrom
copilot/analyze-hardware-attack-vectors

Conversation

Copilot AI commented Jan 7, 2026 •

Copy link
Copy Markdown
Contributor

Documents hardware-level attack vectors and countermeasures for ThemisDB production deployments. Addresses requirement for comprehensive hardware security guidance.

Attack Vectors Documented

Physical Interfaces:

  • USB: BadUSB, Rubber Ducky, USB Killers, hardware keyloggers
  • PCIe/DMA: Direct memory access exploits, Option ROM attacks, Thunderbolt/USB4 tunneling
  • I/O: IPMI/BMC vulnerabilities, Serial/UART, JTAG debug ports

Microarchitecture:

  • CPU: Spectre, Meltdown, MDS (RIDL/Fallout/ZombieLoad), L1TF, Retbleed
  • RAM: Cold Boot attacks, Rowhammer/RAMBleed/TRRespass, DMA-based extraction
  • Firmware: UEFI Bootkits, Intel ME/AMD PSP exploits

Protection Measures

System-Level:

# IOMMU for DMA isolation
GRUB_CMDLINE_LINUX="intel_iommu=on iommu=pt"

# CPU vulnerability mitigations
GRUB_CMDLINE_LINUX="spectre_v2=on spec_store_bypass_disable=on l1tf=full,force mds=full,nosmt"

# USB device whitelisting
usbguard generate-policy > /etc/usbguard/rules.conf

Application-Level (ThemisDB):

// Secure memory allocation for encryption keys
class SecureMemory {
    static void* allocateSecure(size_t size) {
        void* ptr = sodium_malloc(size);
        if (ptr) sodium_mlock(ptr, size);  // Lock in RAM, prevent swapping
        return ptr;
    }
    
    static void secureWipe(void* ptr, size_t size) {
        sodium_memzero(ptr, size);
    }
};

Configuration:

security:
  hardware:
    require_iommu: true
    verify_microcode_version: true
    tpm_enabled: true
    disable_swap: true
    lock_sensitive_memory: true

Compliance Mapping

  • BSI IT-Grundschutz: M 1.14, M 1.15, M 4.68
  • ISO 27001: A.11.1, A.11.2, A.12.6
  • NIST SP 800-53: PE-3, PE-5, SI-16
  • PCI DSS 4.0: Requirement 9 (physical access control)

Files

  • docs/de/security/security_hardware_attack_vectors.md (1,245 lines, German)
  • docs/en/security/security_hardware_attack_vectors.md (899 lines, English)
  • Updated security README files and main SECURITY.md with references

Includes 30+ practical code examples (Bash hardening scripts, C++ memory protection, systemd services, audit rules, SIEM integration).

Original prompt

Wie sehen Angriffsvektoren auf Ebene der Hardware aus? USB, PCIe, usw. CPU, RAM, andere IO


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Analyze hardware attack vectors such as USB and PCIe Add hardware attack vectors documentation (USB, PCIe, CPU, RAM, I/O) Jan 7, 2026
Copilot AI requested a review from makr-code January 7, 2026 08:14
@makr-code
makr-code marked this pull request as ready for review January 7, 2026 14:37
@makr-code
makr-code merged commit 3d5409f into develop Jan 7, 2026
@makr-code makr-code added this to the v1.0.2 milestone Mar 11, 2026
Copilot AI added a commit that referenced this pull request May 11, 2026
…HMAC/embedding stubs

- GGUFMetadata (stub #259): add HmacFn type alias + setHmacFn() static API;
  sign()/verify() delegate to injected fn when set, fall back to XOR stub;
  fail-closed on fn exception; source comments updated from #173 → #259

- FlareRetrieval (stub #260): add EmbeddingQueryFn type alias + setEmbeddingQueryFn()
  static API + buildQueryEmbedding() method; string buildQuery() path retained
  as documented fallback; fail-closed on fn exception

- TensorRAGPipeline (stub #261): add EmbeddingQueryFn + setEmbeddingQueryFn()
  static API; step() populates RAGDecision::flare_query_embedding when fn set
  and FLARE triggers; fail-closed on fn exception

- STUB_INVENTORY.md: 21 new entries (#259–#277, with #263 as a/b/c subtypes);
  header updated to 272 entries / 238 resolved / 34 active; source ID conflicts
  for AR-01 (#172→#265), AR-02 (#177→#266), mmap-bridge (#176→#270),
  fingerprint-graph (#174→#276) noted and source comments updated

- All three bridges follow the gpu_tensor.cpp pattern: static function-local
  mutex + static function-local std::function storage; thread-safe getter/setter

Co-authored-by: Copilot <[email protected]>

Co-authored-by: makr-code <[email protected]>
Copilot AI added a commit that referenced this pull request Aug 26, 2026
…ng (W9-16..W9-17)

W9-16: Batch-close braces_imbalance false positives
- Verified all 20 braces_imbalance CRITICAL entries with a C++ state-machine
  parser that skips raw string literals, block/line comments, and char/string
  literals — all 20 files structurally balanced (depth=0 at EOF)
- grafana_metrics.cpp raw count of -3 fully explained by R"()" JSON payloads
- CRITICAL residual updated: 155 → 135 (20 scanner FPs closed)
- MODULE_GAPS.md: W9-16 verification table added

W9-17: Speculative decode bridges
- setTokenizerFn(fn) / clearTokenizerFn() implemented in
  inference_engine_enhanced.cpp (mutex-guarded, matches TargetLogitsFn pattern)
- trySpeculativeGeneration() remote draft path updated: TokenizerFn called
  before byte-modulo fallback; fail-closed on exception or empty return
- STUB #263 note: 'Removal Plan' → 'Production Injection Point'
- STUB #262 note: 'Removal Plan' → 'Production Injection Point'
  (TargetLogitsFn was already wired in prior work; note corrected)
- Tests SD-BRG-01..SD-BRG-07 added:
  tests/llm/test_wave9_speculative_decode_bridges.cpp
- STUB_INVENTORY.md: entries 322/323 added as resolved (316 → 323 total)
- ROADMAP.md: W9-16/W9-17 marked [x]

Co-authored-by: makr-code <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants