CVE-2022-0543 - Redis RCE Vulnerability home lab for Red Teaming, Penetration Testing Training with just one DOCKER# 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
[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