trailofbits/anamorpher

GitHub: trailofbits/anamorpher

一款用于生成和可视化针对多模态 AI 系统的图像缩放攻击工具,可在图片缩放时触发隐藏的提示词注入。

Stars: 1040 | Forks: 91

# Anamorpher Anamorpher(得名于 [变形](https://en.wikipedia.org/wiki/Anamorphosis))是一款用于制作和可视化针对多模态 AI 系统的图像缩放攻击的工具。它提供了前端界面和 Python API,用于生成仅在缩小尺寸时才会暴露多模态提示词注入的图像。有关此攻击向量的更多信息,请参阅 [“利用图像缩放攻击生产环境中的 AI 系统”](https://blog.trailofbits.com/2025/08/21/weaponizing-image-scaling-against-production-ai-systems/)。 Anamorpher 目前处于活跃的 Beta 开发阶段。我们欢迎反馈和贡献! ## 功能 - 为使用特定双三次、双线性和最近邻下采样算法实现的系统生成 Payload - 通过包含 OpenCV、PyTorch、TensorFlow 和 Pillow 实现的前端界面比较 Payload 有效性 - 利用 Python API 的模块化设计,加入您自己的自定义图像下采样实现
Comparison showing hidden prompt Demo of attack in action
Frontend Demo Gemini CLI Attack Demo
## 环境要求 - **Python 3.11+** - [uv](https://docs.astral.sh/uv/)(推荐)或 pip ## 设置 1. 安装依赖: ``` uv sync ``` 2. 运行后端: ``` uv run python backend/app.py ``` 3. 在 Web 浏览器中打开 `frontend/index.html` ## 警告与已知限制 - 由于这些系统的概率特性,结果可能会有所不同。为获得一致的评估,请将每个示例运行 5 次。 - 额外的图像变换可能会干扰注入的有效性。 - 由于不同实现间抗锯齿的稳健性不同、缩放库中的默认参数不同,以及影响插值行为的特定实现优化,并非所有 Payload 都能针对双三次和双线性下采样算法的每个实现和参数集生效。 - 这一点在更广泛的生产环境 AI 系统中同样适用,因为系统的缩放行为可能会发生变化。 ## 维护者 - [Kikimora Morozova](https://github.com/kiki-morozova) - [Suha Sabi Hussain](https://github.com/suhacker1) ## 参考资料 - [**Weaponizing image scaling against production AI systems**](https://blog.trailofbits.com/2025/08/21/weaponizing-image-scaling-against-production-ai-systems/) - [**Adversarial Preprocessing: Understanding and Preventing Image-Scaling Attacks in Machine Learning**](https://www.usenix.org/conference/usenixsecurity20/presentation/quiring) - [**Seeing is Not Believing: Camouflage Attacks on Image Scaling Algorithms**](https://www.usenix.org/conference/usenixsecurity19/presentation/xiao)
标签:AI安全, Chat Copilot, DLL 劫持, Gemini, meg, OpenCV, Pillow, Python, PyTorch, TensorFlow, 信息安全, 凭据扫描, 双三次插值, 双线性插值, 图像处理, 图像缩放攻击, 多模态AI, 大语言模型, 对抗性攻击, 对抗样本生成, 无后门, 畸变隐藏, 逆向工具