一款支持文本/图像/音频的全模态LLM安全测试扫描器

admin 2026-01-27 14:47:54 网络安全文章 来源:ZONE.CI 全球网 0 阅读模式

文章总结: 本文介绍了开源工具AgenticSecurity,这是一款支持文本、图像及音频的全模态LLM安全扫描器。它能执行多步越狱、模糊测试及基于强化学习的攻击,帮助开发者通过API集成主动检测AI系统的安全漏洞。文章详细说明了安装步骤、使用方法及多模态探测接口,旨在提升AI部署的安全性,文末附带安全知识推广。 综合评分: 75 文章分类: AI安全,安全工具,漏洞分析,渗透测试


cover_image

一款支持文本/图像/音频的全模态 LLM 安全测试扫描器

原创

0xSecDebug 0xSecDebug

0xSecDebug

2026年1月27日 12:00 陕西

Agentic Security

    请勿利用文章内的相关技术从事非法渗透测试,由于传播、利用此文所提供的信息而造成的任何直接或者间接的后果及损失,均由使用者本人负责,作者不为此承担任何责任。工具和内容均来自网络,仅做学习和记录使用,安全性自测,如有侵权请联系删除

    一款开源的代理工作流程和大型语言模型(LLM)漏洞扫描器, 保护人工智能系统免受越狱、模糊攻击和多模态攻击。

特色

    代理安全为你配备了强大的工具,保护大型语言模型免受新兴威胁。你可以这样做:

  • 多模态攻击 🖼️🎙️ 检测文本、图像和音频输入的漏洞,确保你的大型语言模型对多种威胁具备韧性。
  • 多步越狱 🌀 模拟复杂迭代攻击序列,以发现LLM安全机制的弱点。
  • 综合模糊检测 🧪 对任何随机输入的大型语言模型进行压力测试,以识别边缘案例和意外行为。
  • API集成与压力测试 🌐 无缝连接LLM API,并通过高流量的真实攻击场景突破其极限。
  • 基于强化学习的攻击 📡 利用强化学习打造适应性强化、智能探针,随着模型防御进化。

为何重要:这些功能帮助开发者、研究人员和安全团队主动识别并缓解人工智能系统中的风险,确保部署更安全可靠。

📦 安装

要开始使用Agentic Security,只需使用pip安装该包:

pip install agentic_security

⛓️ 快速入门

agentic_security
2024-04-13 13:21:31.157 | INFO     | agentic_security.probe_data.data:load_local_csv:273 - Found 1 CSV files
2024-04-13 13:21:31.157 | INFO     | agentic_security.probe_data.data:load_local_csv:274 - CSV files: ['prompts.csv']
INFO:     Started server process [18524]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:8718 (Press CTRL+C to quit)
python -m agentic_security
# or
agentic_security --help
agentic_security --port=PORT --host=HOST

用户界面 🧙

LLM kwargs

代理安全使用明文HTTP规范,如:

POST https://api.openai.com/v1/chat/completions
Authorization: Bearer sk-xxxxxxxxx
Content-Type: application/json

{
     "model": "gpt-3.5-turbo",
&nbsp; &nbsp; &nbsp;"messages": [{"role":&nbsp;"user",&nbsp;"content":&nbsp;"<<PROMPT>>"}],
&nbsp; &nbsp; &nbsp;"temperature": 0.7
}

扫描时将替换为实际攻击向量,插入带有应用凭证的头值。<<PROMPT>>``Bearer XXXXX

添加大型语言模型集成模板

添加自有数据集

要添加你自己的数据集,可以放置一个或多个带有列的csv文件,这些数据将在启动时加载prompt``agentic_security

2024-04-13 13:21:31.157 | INFO &nbsp; &nbsp; | agentic_security.probe_data.data:load_local_csv:273 - Found 1 CSV files
2024-04-13 13:21:31.157 | INFO &nbsp; &nbsp; | agentic_security.probe_data.data:load_local_csv:274 - CSV files: ['prompts.csv']────────────────────────┼──────────┼─────────┼──────────┤

探针端点

以自定义集成为例,我们用它来进行集成测试。/v1/self-probe

POST https://agentic_security-preview.vercel.app/v1/self-probe
Authorization: Bearer XXXXX
Content-Type: application/json

{
&nbsp; &nbsp;&nbsp;"prompt":&nbsp;"<<PROMPT>>"
}

该终点随机模拟假LLM的拒绝。

@app.post("/v1/self-probe")
def self_probe(probe: Probe):
&nbsp; &nbsp; refuse = random.random() < 0.2
&nbsp; &nbsp; message = random.choice(REFUSAL_MARKS)&nbsp;if&nbsp;refuse&nbsp;else&nbsp;"This is a test!"
&nbsp; &nbsp; message = probe.prompt +&nbsp;" "&nbsp;+ message
&nbsp; &nbsp;&nbsp;return&nbsp;{
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;"id":&nbsp;"chatcmpl-abc123",
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;"object":&nbsp;"chat.completion",
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;"created": 1677858242,
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;"model":&nbsp;"gpt-3.5-turbo-0613",
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;"usage": {"prompt_tokens": 13,&nbsp;"completion_tokens": 7,&nbsp;"total_tokens": 20},
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;"choices": [
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;"message": {"role":&nbsp;"assistant",&nbsp;"content": message},
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;"logprobs": None,
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;"finish_reason":&nbsp;"stop",
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;"index": 0,
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp; &nbsp; &nbsp; ],
&nbsp; &nbsp; }

图像模态

要探测图像模态,可以使用以下HTTP请求:

POST http://0.0.0.0:9094/v1/self-probe-image
Authorization: Bearer XXXXX
Content-Type: application/json

[
&nbsp; &nbsp; {
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;"role":&nbsp;"user",
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;"content": [
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;"type":&nbsp;"text",
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;"text":&nbsp;"What is in this image?"
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; },
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;"type":&nbsp;"image_url",
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;"image_url": {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;"url":&nbsp;"data:image/jpeg;base64,<<BASE64_IMAGE>>"
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp; &nbsp; &nbsp; ]
&nbsp; &nbsp; }
]

用你的实际API密钥替换,是图像变量。XXXXX``<<BASE64_IMAGE>>

音频模式

要探测音频模态,可以使用以下HTTP请求:

POST http://0.0.0.0:9094/v1/self-probe-file
Authorization: Bearer&nbsp;$GROQ_API_KEY
Content-Type: multipart/form-data

{
&nbsp; &nbsp;&nbsp;"file":&nbsp;"@./sample_audio.m4a",
&nbsp; &nbsp;&nbsp;"model":&nbsp;"whisper-large-v3"
}

用你实际的API密钥替换,并确保参数指向正确的音频文件路径。$GROQ_API_KEY``file

📖 项目地址

https://github.com/msoedov/agentic_security

💻 威胁情报推送群

  如果师傅们想要第一时间获取到最新的威胁情报,可以添加下面我创建的钉钉漏洞威胁情报群,便于师傅们可以及时获取最新的IOC

 如果师傅们想要获取网络安全相关知识内容,可以添加下面我创建的网络安全全栈知识库,便于师傅们的学习和使用:

    覆盖渗透、安服、运营、代码审计、内网、移动、应急、工控、AI/LLM、数据、业务、情报、黑灰产、SOC、溯源、钓鱼、区块链等  方向,内容还在持续整理中……

点分享

点收藏

点在看

点点赞


免责声明:

本文所载程序、技术方法仅面向合法合规的安全研究与教学场景,旨在提升网络安全防护能力,具有明确的技术研究属性。

任何单位或个人未经授权,将本文内容用于攻击、破坏等非法用途的,由此引发的全部法律责任、民事赔偿及连带责任,均由行为人独立承担,本站不承担任何连带责任。

本站内容均为技术交流与知识分享目的发布,若存在版权侵权或其他异议,请通过邮件联系处理,具体联系方式可点击页面上方的联系我

本文转载自:0xSecDebug 0xSecDebug 0xSecDebug《一款支持文本/图像/音频的全模态 LLM 安全测试扫描器》

评论:0   参与:  0