AIRT 靶场 | Lab03 : RAG Exploitation
- 做好准备
激活 python312 环境
(base) $ conda activate python312
安装对应的软件包,并确认安装成功
# apt-get install uidmap
# command -v newuidmap
/usr/bin/newuidmap
# command -v newgidmap
/usr/bin/newgidmap
# apt-get install aardvark-dns
# command -v aardvark-dns
# apt-get install passt
# command -v pasta
/usr/bin/pasta
# pasta --version
pasta 0.0~git20250503.587980c-2+deb13u1
Copyright Red Hat
GNU General Public License, version 2 or later
<https://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
修复容器启动死锁:移除健康检查、降级依赖条件、为 curl 拉取模型预留 15 秒缓冲
(python312) $ sed -i '/healthcheck:/,/retries: 5/d' docker-compose.yml
(python312) $ sed -i 's/condition: service_healthy/condition: service_started/g' docker-compose.yml
(python312) $ sed -i 's/curl -X/sleep 15 \&\& curl -X/g' docker-compose.yml
- 重新构建并后台启动所有服务
(python312) $ podman compose up -d --build
>>>> Executing external compose provider "/usr/bin/podman-compose". Please see podman-compose(1) for how to disable this message. <<<<
STEP 1/9: FROM python:3.11-slim
Resolved "python" as an alias (/etc/containers/registries.conf.d/shortnames.conf)
Trying to pull docker.io/library/python:3.11-slim...
Getting image source signatures
Copying blob bbe7053e6def done |
Copying blob 37fb86c2a767 done |
Copying blob 53daecf7856e done |
Copying blob 7efbce397249 done |
Copying config 896edfbcbf done |
Writing manifest to image destination
STEP 2/9: WORKDIR /app
--> 3f27f14b3b67
STEP 3/9: COPY requirements.txt .
--> 207c62265571
STEP 4/9: RUN pip install --no-cache-dir -r requirements.txt
Collecting flask==3.1.* (from -r requirements.txt (line 1))
...
[notice] A new release of pip is available: 24.0 -> 26.3
[notice] To update, run: pip install --upgrade pip
--> bc28253dce9a
STEP 5/9: COPY app.py .
--> 414d2b655d67
STEP 6/9: COPY ingest.py .
--> 9aa724f5c907
STEP 7/9: RUN mkdir -p /app/data
--> c6fee05629ef
STEP 8/9: EXPOSE 5000
--> 3015c9ba920f
STEP 9/9: CMD ["python", "app.py"]
COMMIT lab03-rag-exploitation_rag-app
--> ce32cd38bb5c
Successfully tagged localhost/lab03-rag-exploitation_rag-app:latest
ce32cd38bb5c4dae5aace5abe414b9f1fd0ae9d75f7ab0ce11c27ad229ece94f
4d30936cd343d3aa2798cc154963465f74c7994831a5ffdf100cfc64b608a502
Resolving "ollama/ollama" using unqualified-search registries (/etc/containers/registries.conf)
Trying to pull docker.io/ollama/ollama:latest...
Getting image source signatures
Copying blob bcd29a192d4b done |
Copying blob 7a48b8f0e5c7 done |
Copying blob 44e04c92ea2a done |
Copying blob 0f9ace102f52 done |
Copying config 6c437ef9d3 done |
Writing manifest to image destination
b351ab34ba9c7dc3d6b8ebb7542d542c2cedfc045742059907f1a58cebfcf107
lab03-ollama
Resolving "chromadb/chroma" using unqualified-search registries (/etc/containers/registries.conf)
Trying to pull docker.io/chromadb/chroma:latest...
Getting image source signatures
Copying blob 80c0cfe87a89 done |
Copying blob 342ce2461d56 done |
Copying blob 4f4fb700ef54 done |
Copying blob 3c4c083c1d6b done |
Copying blob 95ebd62fd043 done |
Copying config a221f3391b done |
Writing manifest to image destination
e224bf7e690a273726c5cd467c8bd0fa0a217ec847a70b7d6f3405de3aa40669
lab03-chromadb
Resolving "curlimages/curl" using unqualified-search registries (/etc/containers/registries.conf)
Trying to pull docker.io/curlimages/curl:latest...
Getting image source signatures
Copying blob 76790e7f0590 done |
Copying config 08dd542089 done |
Writing manifest to image destination
b5caecb24eb7987a52bdb74a1bf76f2646c546eb24db1131072c43bb7ff34ef2
lab03-ollama-setup
cd09a1f88c24753eacd8952f3e9ba6a99a2c459fa8f84bdb99e0c030f810a2c0
lab03-rag-app
查看所有容器
(python312) $ podman ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b351ab34ba9c docker.io/ollama/ollama:latest serve 2 hours ago Up About a minute 0.0.0.0:11434->11434/tcp lab03-ollama
e224bf7e690a docker.io/chromadb/chroma:latest run /config.yaml 2 hours ago Up About a minute 0.0.0.0:8000->8000/tcp lab03-chromadb
b5caecb24eb7 docker.io/curlimages/curl:latest 2 hours ago Exited (0) 45 seconds ago lab03-ollama-setup
cd09a1f88c24 localhost/lab03-rag-exploitation_rag-app:latest python app.py 2 hours ago Up About a minute 0.0.0.0:5000->5000/tcp lab03-rag-app
前端页面打开正常,但是对话框输入无响应
其他作者也遇到同样问题
- 参考文章
https://xz.aliyun.com/news/92361
AI靶场攻防录
https://blog.csdn.net/asmartrman/article/details/159857621
【AI大模型安全-AIRT靶场】
https://blog.csdn.net/m0_73812072/article/details/162893458
AI安全实战系列(三):(待解决问题)Lab03 RAG Exploitation RAG 检索增强攻击
https://github.com/goldroad/airt_wuya
Web 管理器[八方网域-无涯]
这是一个集合所有 lab 并设置面板页面的仓库
About the author
- 酷愛計算機技術Ardently Love Computer Technology 長期關註反洗錢反欺詐Long-term Focus on Anti-Money Laundering and Anti-Fraud 精通支付結算的技術、系統、流程和製度Proficient in the Technology, System, Process and Institution of Payment and Settlement
Comments
Join the discussionNo comments yet. Be the first to comment.