Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

CVE-2022-0543 PoC — Redis 代码注入漏洞

Source
Associated Vulnerability
Title:Redis 代码注入漏洞 (CVE-2022-0543)
Description:Redis Labs Redis是美国Redis Labs公司的一套开源的使用ANSI C编写、支持网络、可基于内存亦可持久化的日志型、键值(Key-Value)存储数据库,并提供多种语言的API。 Redis 存在代码注入漏洞,攻击者可利用该漏洞远程执行代码。
Description
CVE-2022-0543 - Redis RCE Vulnerability home lab for Red Teaming, Penetration Testing Training with just one DOCKER
Readme
# CVE-2022-0543 — Redis Lua Sandbox Escape (Remote Code Execution)

---

## CVE‑2022‑0543 — Redis Lua Sandbox Escape คืออะไร?

<p align="center">
  <img width="500" height="500" alt="20220543" src="https://github.com/user-attachments/assets/084ad041-8a1e-438e-8480-3a3f78f534dd" />
</p>

ช่องโหว่นี้เกิดเฉพาะบน **Redis ที่ติดตั้งผ่าน Debian / Ubuntu package** เท่านั้น  
เพราะ Redis ถูกคอมไพล์พร้อม Lua engine แบบ dynamic module (`lua-cjson`, `lua-bitop`) ทำให้ผู้โจมตีสามารถเรียกใช้:

```
package.loadlib()
```

เพื่อโหลดฟังก์ชัน IO ของระบบ และรันคำสั่งใน Host ซึ่งทำให้เกิด **Remote Code Execution (RCE)**

---

## Lab นี้จำลองอะไร?

- Redis เวอร์ชันที่มีช่องโหว่
- Lua engine เปิด `package.loadlib`
- เปิด Redis แบบไม่มี password
- Flag สร้างใหม่ทุกครั้งที่ container start
- PoC ทำงานได้จริง

---

## วิธีใช้งาน Lab

### 1) Build

```
docker compose build
```

### 2) Run

```
docker compose up -d
```

### 3) Test

```
redis-cli -h localhost -p 6379 ping
```

---

## การใช้ PoC

PoC:
```
https://github.com/0x7eTeam/CVE-2022-0543
```

---

# English Version

## What is CVE‑2022‑0543?

This is a **Debian-specific Redis RCE** caused by improper Lua sandboxing.  
The Redis Debian package loads Lua modules dynamically, exposing:

```
package.loadlib()
```

allowing a full escape → host OS command execution.

---

## What This Lab Simulates

- Vulnerable Redis
- Lua engine with unrestricted loadlib  
- Redis exposed without password  
- Auto flag generator  
- PoC works exactly as real-world exploitation  

---

## Usage

### Build

```
docker compose build
```

### Start

```
docker compose up -d
```

### Test

```
redis-cli -h localhost -p 6379 ping
```

---

## PoC Usage

PoC:
```
https://github.com/0x7eTeam/CVE-2022-0543
```

---

## Notes

- For education only  
- Do not use on production  
- This lab is intentionally vulnerable  

File Snapshot

[4.0K] /data/pocs/f6bececbe2ea4d01dc2cd5d92405a1d36777fe6b ├── [ 293] docker-compose.yml ├── [2.3K] README.md └── [4.0K] redis-vuln ├── [1.3K] Dockerfile ├── [ 544] entrypoint.sh └── [ 154] redis.conf 2 directories, 5 files
Shenlong Bot has cached this for you
Remarks
    1. It is advised to access via the original source first.
    2. If the original source is unavailable, please email f.jinxu#gmail.com for a local snapshot (replace # with @).
    3. Shenlong has snapshotted the POC code for you. To support long-term maintenance, please consider donating. Thank you for your support.