Skip to content
KitploitKITPLOIT
工具漏洞利用博客
Log in
提交
工具漏洞利用博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

··订阅源·联系·隐私·© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
deleting-the-trace — 针对使用工具的LLM代理的控制令牌思维链抑制与解析器宽松攻击实验 | Kitploit
工具/GitHubGitHub/usama1002/deleting-the-trace
漏洞分析漏洞利用机器学习论文与研究AI 安全对抗性攻击
GitHubusama1002/deleting-the-trace

deleting-the-trace

针对使用工具的LLM代理的控制令牌思维链抑制与解析器宽松攻击实验

查看仓库
161天前尚未审核

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享

针对使用工具代理的控制令牌注入攻击

针对使用工具的语言模型代理的两种输入级攻击研究的代码和记录测量结果。第一种攻击将模型自身通道控制令牌的短字符串附加到不可信输入中;分词器将其读取为已关闭的推理通道,因此模型不输出思维链,直接进行工具调用。这删除了监控器所依赖的推理轨迹,并且在模型原本会拒绝的请求上,将拒绝转化为已完成的动作。第二个结果是,相同的工具调用生成是否实际触发由测试框架解析器而非模型决定,因此代理的鲁棒性是模型及其解码和解析测试框架的联合属性。

每个实验都以全精度(bfloat16)运行,通过发布的工具沙箱进行贪婪解码,results/ 下记录的 JSON 完全由这里的脚本生成。

论文:“控制令牌注入抑制思维链并击败使用工具代理中基于推理的监督”。

发现

  1. 控制令牌注入抑制推理通道,同时不安全的工具调用仍然触发,击败内容读取思维链监控器,并绕过模型自身的拒绝。空推理绊线能捕获基本攻击,但被一行良性诱饵击败。
  2. 测试框架解析器的宽松程度以模型无关的方式控制工具调用的触发。一个容忍截断的解析器会触发缺少结束令牌的调用,而严格解析器会丢弃它;在固定一个模型及其贪婪解码的情况下,两个已发布的解析器产生相反的安全结果。

要求

  • 一个 CUDA GPU,具有足够内存以 bfloat16 运行目标模型(运行在单个 NVIDIA H200,141 GB 上产生)。
  • Python 3.12、带 CUDA 的 PyTorch,以及 requirements.txt 中固定的包(aicomp-sdk 3.1.2、transformers 5.16.1、gymnasium 0.29、openai、openai-harmony)。
  • 在 Hugging Face 上访问目标模型:openai/gpt-oss-20b、google/gemma-4-26B-A4B-it、deepseek-ai/DeepSeek-R1-Distill-Qwen-7B、Qwen/Qwen3-4B-Thinking-2507。

设置:

root@kitploit:~
python3 -m venv --system-site-packages .venv
source .venv/bin/activate
pip install -r requirements.txt

# download the target models (needs an authenticated Hugging Face CLI)
hf download openai/gpt-oss-20b
hf download google/gemma-4-26B-A4B-it
hf download deepseek-ai/DeepSeek-R1-Distill-Qwen-7B
hf download Qwen/Qwen3-4B-Thinking-2507

gpt-oss-20b 在 transformers 4.57 或 5.16 下运行;gemma-4-26B-A4B-it 是一个多模态模型,需要 transformers 5.16。gpt-oss 推理抑制测量在两个版本下相同。

运行实验

所有实验脚本都导入共享测试框架,因此请在路径中包含 experiments 来运行它们。每个脚本将其输出写入 results/。

root@kitploit:~
export PYTHONPATH=experiments

# reproduction gate: the forge empties the gpt-oss analysis channel while the call still fires
python scripts/h200_gate.py

# E1: chain-of-thought suppression at scale
python experiments/e1_cot_suppression.py

# E2: monitor evasion and refusal bypass (generate traces, then score three monitors)
python experiments/e2b_generate.py
JUDGE=gemma python experiments/e2b_judge.py

# E3: parser leniency
python experiments/e3a_parser_leniency.py                 # deterministic, no model
MODEL=gpt_oss python experiments/e3b_end2end.py
MODEL=gemma   python experiments/e3b_end2end.py
python experiments/e3c_gemma_parser_ab.py                 # same model, two parsers

# E4: generality across reasoning models
MODEL=deepseek-ai/DeepSeek-R1-Distill-Qwen-7B TAG=deepseek python experiments/e4_generality.py
MODEL=Qwen/Qwen3-4B-Thinking-2507 TAG=qwen3 python experiments/e4_generality.py

# E5: defenses
python experiments/e5_defenses.py                         # input sanitization
python experiments/e5_d2_parser_hardening.py              # parser hardening, deterministic

# W1 to W3: ablation, token-level grounding, indirect delivery, cross-stack parser
python experiments/w1_forge_variants.py
python experiments/w1_tokenlevel.py
python experiments/w2_indirect.py
python experiments/w3_truncation_sweep.py

# adaptive empty-reasoning evasion (raw traces, effort sweep, decoy attack, monitor matrix)
python experiments/ad_traces_effort.py
python experiments/ad_decoy.py
python experiments/ad_decoy_judge.py

# regenerate the results figure from the logged JSON
python scripts/make_results_fig.py

仓库结构

root@kitploit:~
experiments/harness.py            shared harness: build an agent, run a message through the
                                  sandbox gym env, and read back the reasoning channel, the
                                  fired tool events, and the predicates
experiments/e1_*.py               chain-of-thought suppression at scale
experiments/e2*_*.py              monitor evasion and refusal bypass (generate, then judge)
experiments/e3*_*.py              parser leniency: deterministic, end-to-end, and A/B
experiments/e4_*.py               generality across reasoning models
experiments/e5_*.py               defenses: sanitization and parser hardening
experiments/w1_*.py               ablation of the injected string and token-level grounding
experiments/w2_*.py               indirect delivery and broader action types
experiments/w3_*.py               truncation robustness of the attack
experiments/ad_*.py               adaptive empty-reasoning evasion and raw traces
experiments/*_probe.py, *_debug.py supporting probes used while building the study
scripts/h200_gate.py              the reproduction gate
scripts/make_results_fig.py       the results figure
results/*.json                    logged measurements produced by the scripts above

关键结果

可复现性说明

解码是贪婪的,因此每个输入的每个比率是确定性的,报告的区间反映有限的任务样本。种子 123 和八跳交互循环与发布的沙箱匹配。目标模型修订版和 transformers 版本固定在 requirements.txt 中,并在每个脚本中说明。

许可证

MIT 许可证。参见 LICENSE。

下载工具
实验测量
E1 (gpt-oss-20b)推理通道从 52.5 到 0 个令牌(55 个任务中 55 个为空),不安全动作触发率 100%
E2 监控器规避规则和语言模型监控器在无注入时检测率 100%,有注入时 0%;39.6% 的拒绝转化为已完成的泄露
E3c 解析器 A/B (Gemma)相同模型和贪婪解码:regex 解析器触发 24/24,原生处理器解析器触发 0/24
E4 通用性gpt-oss 通过输入注入易受攻击;Qwen3-Thinking 在闭通道原语下合规性从 0.08 到 1.00;DeepSeek 鲁棒
E5 防御替换为空格的净化器中和攻击;朴素删除在良性输入上失败;解析器加固丢弃截断调用
自适应空推理绊线捕获空伪造,但被一行良性诱饵击败,触发率 100%