目标达成 感谢每一位支持者 — 我们达成了 100% 目标!

目标: 1000 元 · 已筹: 1359 元

100%

CVE-2024-21513 PoC — LangChain 安全漏洞

来源
关联漏洞
标题: LangChain 安全漏洞 (CVE-2024-21513)
Description:LangChain是美国LangChain公司的通过可组合性使用 LLM 构建应用程序。 LangChain 0.0.15版本至0.0.21之前版本存在安全漏洞,该漏洞源于容易受到任意代码执行攻击,攻击者可以利用此漏洞执行任意Python代码。
Description
PoC for CVE-2024-21513
介绍
# CVE-2024-21513
PoC for CVE-2024-21513
Original exploit documented by Snyk Security Research

## Exploit
CVE-2024-21513 is a vulnerability in langchain-experimental where unvalidated SQL query results were passed to Python's eval(), enabling remote code execution through SQL-based input injection. 

## PoC Structure

This PoC is a very basic Flask App with inline HTML where users can enter coordinates into a SQLite DB.

If a user enters a malicious payload in the y value, a vulnerable LangChain-Experimental feature will fetch the y value based on the x value and pass the result to eval() which causes it to be executed. 

This PoC has a hard-coded LLM that returns the SQL query for finding where x = 10. 

### Example: 
1) Add multiple regular coordinates to the DB
2) Add the point (10, print("You've been pwned!)) to the DB through the same form
3) Check to see if the points are all there by checking the /debug route
4) Ask for data where x = 10 in the /query function (what you ask doesn't matter, the SQL result is always the same)

## File Structure
```
.
├── Dockerfile
├── README.md
├── app
│   ├── db.py
│   ├── exploit.db
│   ├── llm.py
│   ├── main.py
│   └── requirements.txt
└── docker-compose.yml
```
## How to Run This
This exploit is containerized so that it doesn't impact anything on your actual dev environment. 

I assume that you have Docker and/or Docker Compose already installed (ensure that WSL2 config is on in Docker if you are using WSL)
### Steps to Run: 
1) `git clone https://github.com/nskath/CVE-2024-21513`
2) `cd CVE-2024-21513`
3) `docker-compose up --build`
4) Visit `localhost:5000 (127.0.0.1:5000)`

## Video of Exploit: 

https://github.com/user-attachments/assets/7ad27115-411a-467f-b649-2b3508b6f5df


文件快照

登录后查看神龙缓存的 POC 文件快照

登录查看
备注
    1. 建议优先通过来源进行访问。
    2. 本地 POC 快照面向订阅用户开放;当原始来源失效或无法访问时,本地镜像作为订阅权益的一部分提供。
    3. 持续抓取、验证、维护这份 POC 档案需要不少投入,因此本地快照已纳入付费订阅。您的订阅是让这份资料能继续走下去的关键,由衷感谢。 查看订阅方案 →