Manuscript Offprint

arXiv:2609.06612

MechAudit-40: White-Box Auditing across 40 LLM Attack Mechanisms

Zhen Guo, Shanghao Shi, Shamim Yazdani, Ning Zhang, Reza Tourani

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Zhen Guo

Saint Louis University

zhen.guo.2@slu.edu

Shanghai Shi

Washington University in St. Louis

shanghai@wustl.edu

Shamim Yazdani

Saint Louis University

shamim.yazdani@slu.edu

Ning Zhang

Washington University in St. Louis

zhang.ning@wustl.edu

Reza Tourani

Saint Louis University

reza.tourani@slu.edu

Abstract

While LLM attacks span prompt optimization, multi-turn context manipulation, retrieval poisoning, and model backdoors, white-box defenses are typically evaluated on isolated attack families. Consequently, whether heterogeneous attacks leave internal representation shifts that generalize to unseen threat mechanisms remains unknown. We present MECHAUDIT-40, a systematic evaluation of 40 attack mechanisms across five open-weight model architectures. Threat-specific success criteria, 100,000 matched clean-attack representation pairs, predefined categories, and grouped holdouts isolate genuine attack-induced displacement from target scale, corpus bias, and data-leakage shortcuts.

Across this testbed, attacks induce structured multi-depth trajectories rather than isolated layer spikes. While raw peaks are non-portable across architectures, target-calibrated profiles preserve transferable geometric signatures: under complete mechanism holdout, hidden states alone recover the threat category of unseen attacks with 82.5% accuracy. Guided by this finding, we design MECHAUDIT, a runtime auditor that operates under strict zero-oracle constraints without requiring clean baseline traces or attack metadata. MECHAUDIT detects 81.1% of held-out attack executions at a 0.70% false-positive rate and maintains 78.1% recall when an entire functional category is withheld. In matched comparisons, MECHAUDIT is the only detector that avoids mechanism-level coverage collapse, maintaining over 50% recall across all 40 mechanisms. Internal representations thus support cross-mechanism attack-exposure auditing against calibrated benign references, but decouple from downstream task compromise and parameter integrity.

1 Introduction

White-box auditing for large language models (LLMs) faces a fundamental generalization mismatch. While recent defenses monitor intermediate hidden states to detect adversarial interactions [34, 66, 70], their empirical validation is predominantly confined to isolated attack families (e.g., discrete jail-

breaks) or specific model architectures. In production deployments, however, adversaries exploit diverse and structurally distinct attack surfaces, ranging from gradient-optimized adversarial suffixes [68] and indirect prompt injections [15] to retrieval-corpus poisoning [7, 69] and backdoor trigger activations [47, 59, 60]. Because existing detectors are fitted to narrow threat primitives, they suffer severe performance degradation when exposed to previously unseen attack mechanics [53]. To systematically address this generalization gap, we formalize the problem of attack-exposure auditing: determining whether a single inference execution exhibits representation-level anomalies indicative of adversarial interaction relative to a calibrated benign reference distribution. Consequently, a foundational open challenge is whether a unified representation auditor can maintain reliable detection coverage when complete attack primitives and threat categories are withheld during training.

We investigate this problem in a defensive auditing setting where the evaluator possesses white-box visibility to instrument target-model hidden states during inference. Adversaries operate strictly within the access tiers and manipulation budgets established by their respective source formulations, spanning black-box query access, contextual state manipulation, and training-time poisoning. Our study evaluates cross-mechanism and cross-category generalization across calibrated, open-weight target models. In accordance with standard baseline threat models, our empirical evaluations assume non-adaptive adversaries; analyzing adaptive, monitor-aware evasion strategies remains an orthogonal research direction outside our present claims.

Evaluating cross-mechanism transfer requires a structured sampling frame that spans diverse optimization procedures and intervention surfaces. To prevent over-indexing on standard jailbreak templates, we formalize eight distinct threat categories: objective-driven direct-input optimization and feedback-guided iterative search [4, 68]; semantic restructuring and carrier transformation [27, 62, 63]; multi-turn context manipulation [48, 58]; indirect prompt and agent-channel injection [15, 35]; persistent retrieval and memory poisoning [7, 69]; and model-parameter and training backdoors [47, 59, 60]. Prior to analyzing behavioral outcomes or intermediate representations, we select five representative mechanisms per category, establishing a balanced registry of 40 mechanisms. This design prevents over-represented attack families from distorting aggregate detection metrics and supports controlled category-holdout evaluations. We emphasize that this testbed is constructed for balanced cross-category benchmarking rather than estimating real-world empirical attack prevalence.

Because the registry mechanisms target disparate security properties, MECHAUDIT-40 establishes threat-specific success criteria across diverse open-weight instruction-tuned architectures. Our empirical testbed leverages an extensive corpus of judged execution traces for behavioral validation alongside matched clean-attack internal representation pairs for white-box auditing. To prevent data leakage and benchmark contrivance, grouped train-test partitions strictly isolate related execution traces, ensuring that prompts, dialogue contexts, and optimization seeds do not co-occur across splits.

Leveraging this controlled testbed, we examine whether adversarial perturbations induce internal representation shifts that generalize across disparate mechanisms. By analyzing normalized layer-wise activation differences between matched clean and attacked executions under strict mechanism holdouts, we find that multi-depth hidden-state trajectories preserve distinct mechanism-associated structural signatures across the attack registry. In leave-one-mechanism-out experiments, layer-wise activation profiles reliably recover the category of unseen mechanisms far above chance expectations. Furthermore, this transferability is distributed across the collective multi-depth trajectory rather than localized to isolated peak layers, whose exact depths and activation magnitudes vary across architectures and attack formulations.

Guided by these representational dynamics, we design MECHAUDIT, a target-calibrated auditing framework for single-trace runtime inspection. While offline signature discovery leverages matched clean-attack representation pairs to train detector components, online deployment inspects solely the observed runtime execution against a pre-calibrated benign reference distribution. MECHAUDIT compresses multi-depth hidden states via a fixed random projection [1], feeding a composite scoring rule that couples a cross-mechanism ExtraTrees classifier [13] with a benign-only Mahalanobis distance estimator [26]. This unified architecture is held constant across all evaluated attack classes, requiring only target-specific benign calibration and threshold selection. At runtime, MECHAUDIT operates under strict zero-oracle constraints, requiring no matched clean baseline, attack category metadata, or downstream outcome labels.

Across our extensive validation testbed, MECHAUDIT demonstrates robust generalization to unseen threats, sustaining high detection recall alongside an operational, sub-percent false-positive rate under both complete mechanism- and category-level holdouts. In particular, MECHAUDIT preserves reliable detection coverage across every mechanism in the evaluation registry; in contrast, prior specialized baselines (e.g., PIShield [70], Sentinel [34]) fail to generalize beyond their specific training distributions.

References (63)