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

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

CVE-2018-15133 PoC — Laravel Framework 安全漏洞

Source
Associated Vulnerability
Title:Laravel Framework 安全漏洞 (CVE-2018-15133)
Description:Laravel framework是软件开发者Taylor Otwell开发的一款基于PHP的Web应用程序开发框架。 Laravel framework 5.5.40及之前版本和5.6.x版本至5.6.29版本中存在安全漏洞。远程攻击者可借助应用程序的密钥利用该漏洞执行代码。
Readme
# CVE-2018-15133 - Laravel APP_KEY Unserialization Vulnerability

화이트햇스쿨 3기 28반 이예빈 가상화 - 취약한 도커 구성
https://github.com/yeahhbean/Laravel-CVE-2018-15133

## 개요

이 프로젝트는 **CVE-2018-15133** 취약점(라라벨 APP_KEY 역직렬화 취약점)을 검증(PoC)하기 위해 구성된 Docker 기반 환경입니다.  
Dockerfile과 docker-compose.yaml만으로 취약한 환경을 구축하고, exploit을 통해 정상적으로 PoC가 이루어짐을 확인했습니다.

- 취약 대상 : Laravel <= 5.7.27
- 주요 이슈 : APP_KEY가 노출될 경우 악성 페이로드를 통해 서버 명령어 실행 가능

---

## 구성 환경

- **PHP** 7.2.10-fpm
- **Nginx** (reverse proxy)
- **MySQL** 5.7
- **Laravel** 5.7.28 (취약 버전 포함)

Dockerfile과 docker-compose.yaml을 통해 자동으로 취약한 환경이 설치 및 구동됩니다.

---

## 파일 구성

| 파일명              | 설명                                |
| :------------------ | :---------------------------------- |
| Dockerfile          | PHP + Composer + Laravel 5.7 설치용 |
| docker-compose.yaml | 전체 서비스(Nginx, PHP, MySQL) 구성 |
| nginx/default.conf  | Nginx 리버스 프록시 설정 파일       |
| exploit.py          | APP_KEY 기반 PoC 코드               |

---

## 로컬 환경 동작

- 디렉토리 구조
  ![디렉토리 구조](https://github.com/yeahhbean/Laravel-CVE-2018-15133/blob/main/images/init_build.png?raw=true)

- 디렉토리 이동 cd C:\Users\Admin\Desktop\WHS\CVE
  ![디렉토리 이동](https://github.com/yeahhbean/Laravel-CVE-2018-15133/blob/main/images/init_build1.png?raw=true)

- 도커 이미지 빌드 docker-compose build
  ![도커 이미지 빌드](https://github.com/yeahhbean/Laravel-CVE-2018-15133/blob/main/images/docker_build.png?raw=true)

- 도커 컨테이너 실행 docker-compose up -d
  ![도커 컨테이너 실행](https://github.com/yeahhbean/Laravel-CVE-2018-15133/blob/main/images/docker_compose.png?raw=true)

- 컨테이너 접속 docker exec -it laravel_app bash
  ![컨테이너 접속](https://github.com/yeahhbean/Laravel-CVE-2018-15133/blob/main/images/laravel_app_APP_KEY.png?raw=true)

- 컨테이너에서 나와서 PoC 실행 exit python exploit.py
  ![PoC 결과 1](https://github.com/yeahhbean/Laravel-CVE-2018-15133/blob/main/images/exploit_1.png?raw=true)
  ![PoC 결과 2](https://github.com/yeahhbean/Laravel-CVE-2018-15133/blob/main/images/exploit_2.png?raw=true)
  ![PoC 결과 3](https://github.com/yeahhbean/Laravel-CVE-2018-15133/blob/main/images/exploit_3.png?raw=true)

- 브라우저 접속 웹 브라우저를 열고 http://localhost:8080
  ![로컬페이지](https://github.com/yeahhbean/Laravel-CVE-2018-15133/blob/main/images/localhost.png?raw=true)

---

## 구축 방법

```bash
# 1. 소스 다운로드 및 디렉토리 이동
cd [프로젝트 디렉토리]

# 2. Docker 이미지 빌드
docker-compose build

# 3. Docker 컨테이너 실행
docker-compose up -d

---

성공적으로 실행되면 http://localhost:8080에서 Laravel 기본 페이지를 확인할 수 있습니다.

---

## PoC (취약점 검증)

# 1. 컨테이너 안에서 Laravel APP_KEY 추출
docker exec -it laravel_app bash
cat /var/www/html/laravel/.env | grep APP_KEY

# 2. 추출된 APP_KEY를 이용하여 exploit.py에 입력 후 실행
python exploit.py

# 3. 정상적으로 Laravel 페이지 HTML이 반환되면, APP_KEY를 통한 페이로드가 성공적으로 전달되었음을 의미합니다.

---

## 주의 사항

- Laravel 5.7.28 이후 버전은 이 취약점이 패치되어 더 이상 작동하지 않습니다.

- PoC 코드(exploit.py)는 공개된 공격 방식을 참고하여 작성되었습니다.

---

## Reference

- https://nvd.nist.gov/vuln/detail/cve-2018-15133
- https://laravel.com/docs/5.7/releases#laravel-5.7.27

```
File Snapshot

[4.0K] /data/pocs/91bef4dc4f1f031b60c7b4eafbb0ddd1694e8ec0 ├── [ 663] docker-compose.yaml ├── [1.2K] Dockerfile ├── [1.1K] exploit.py ├── [4.0K] images │   ├── [158K] docker_build.png │   ├── [ 35K] docker_compose.png │   ├── [ 59K] exploit_1.png │   ├── [ 53K] exploit_2.png │   ├── [ 51K] exploit_3.png │   ├── [ 49K] init_build1.png │   ├── [129K] init_build.png │   ├── [ 24K] laravel_app_APP_KEY.png │   └── [ 33K] localhost.png ├── [4.0K] laravel │   ├── [4.0K] app │   │   ├── [4.0K] Console │   │   │   └── [ 848] Kernel.php │   │   ├── [4.0K] Exceptions │   │   │   └── [1.0K] Handler.php │   │   ├── [4.0K] Http │   │   │   ├── [4.0K] Controllers │   │   │   │   ├── [4.0K] Auth │   │   │   │   │   ├── [ 834] ForgotPasswordController.php │   │   │   │   │   ├── [ 943] LoginController.php │   │   │   │   │   ├── [1.8K] RegisterController.php │   │   │   │   │   ├── [ 952] ResetPasswordController.php │   │   │   │   │   └── [1.0K] VerificationController.php │   │   │   │   └── [ 361] Controller.php │   │   │   ├── [2.8K] Kernel.php │   │   │   └── [4.0K] Middleware │   │   │   ├── [ 464] Authenticate.php │   │   │   ├── [ 335] CheckForMaintenanceMode.php │   │   │   ├── [ 294] EncryptCookies.php │   │   │   ├── [ 523] RedirectIfAuthenticated.php │   │   │   ├── [ 340] TrimStrings.php │   │   │   ├── [ 429] TrustProxies.php │   │   │   └── [ 463] VerifyCsrfToken.php │   │   ├── [4.0K] Providers │   │   │   ├── [ 403] AppServiceProvider.php │   │   │   ├── [ 575] AuthServiceProvider.php │   │   │   ├── [ 380] BroadcastServiceProvider.php │   │   │   ├── [ 710] EventServiceProvider.php │   │   │   └── [1.5K] RouteServiceProvider.php │   │   └── [ 734] User.php │   ├── [1.6K] artisan │   ├── [4.0K] bootstrap │   │   ├── [1.6K] app.php │   │   └── [4.0K] cache │   ├── [1.5K] composer.json │   ├── [250K] composer.lock │   ├── [4.0K] config │   │   ├── [8.9K] app.php │   │   ├── [3.2K] auth.php │   │   ├── [1.6K] broadcasting.php │   │   ├── [2.6K] cache.php │   │   ├── [4.3K] database.php │   │   ├── [2.1K] filesystems.php │   │   ├── [1.5K] hashing.php │   │   ├── [2.6K] logging.php │   │   ├── [4.6K] mail.php │   │   ├── [2.6K] queue.php │   │   ├── [1.2K] services.php │   │   ├── [6.8K] session.php │   │   └── [1.0K] view.php │   ├── [4.0K] database │   │   ├── [4.0K] factories │   │   │   └── [ 804] UserFactory.php │   │   ├── [4.0K] migrations │   │   │   ├── [ 810] 2014_10_12_000000_create_users_table.php │   │   │   └── [ 683] 2014_10_12_100000_create_password_resets_table.php │   │   └── [4.0K] seeds │   │   └── [ 250] DatabaseSeeder.php │   ├── [4.0K] laravel │   │   ├── [4.0K] app │   │   │   ├── [4.0K] Console │   │   │   │   └── [ 848] Kernel.php │   │   │   ├── [4.0K] Exceptions │   │   │   │   └── [1.0K] Handler.php │   │   │   ├── [4.0K] Http │   │   │   │   ├── [4.0K] Controllers │   │   │   │   │   ├── [4.0K] Auth │   │   │   │   │   │   ├── [ 834] ForgotPasswordController.php │   │   │   │   │   │   ├── [ 943] LoginController.php │   │   │   │   │   │   ├── [1.8K] RegisterController.php │   │   │   │   │   │   ├── [ 952] ResetPasswordController.php │   │   │   │   │   │   └── [1.0K] VerificationController.php │   │   │   │   │   └── [ 361] Controller.php │   │   │   │   ├── [2.8K] Kernel.php │   │   │   │   └── [4.0K] Middleware │   │   │   │   ├── [ 464] Authenticate.php │   │   │   │   ├── [ 335] CheckForMaintenanceMode.php │   │   │   │   ├── [ 294] EncryptCookies.php │   │   │   │   ├── [ 523] RedirectIfAuthenticated.php │   │   │   │   ├── [ 340] TrimStrings.php │   │   │   │   ├── [ 429] TrustProxies.php │   │   │   │   └── [ 463] VerifyCsrfToken.php │   │   │   ├── [4.0K] Providers │   │   │   │   ├── [ 403] AppServiceProvider.php │   │   │   │   ├── [ 575] AuthServiceProvider.php │   │   │   │   ├── [ 380] BroadcastServiceProvider.php │   │   │   │   ├── [ 710] EventServiceProvider.php │   │   │   │   └── [1.5K] RouteServiceProvider.php │   │   │   └── [ 734] User.php │   │   ├── [1.6K] artisan │   │   ├── [4.0K] bootstrap │   │   │   ├── [1.6K] app.php │   │   │   └── [4.0K] cache │   │   ├── [1.5K] composer.json │   │   ├── [250K] composer.lock │   │   ├── [4.0K] config │   │   │   ├── [8.9K] app.php │   │   │   ├── [3.2K] auth.php │   │   │   ├── [1.6K] broadcasting.php │   │   │   ├── [2.6K] cache.php │   │   │   ├── [4.3K] database.php │   │   │   ├── [2.1K] filesystems.php │   │   │   ├── [1.5K] hashing.php │   │   │   ├── [2.6K] logging.php │   │   │   ├── [4.6K] mail.php │   │   │   ├── [2.6K] queue.php │   │   │   ├── [1.2K] services.php │   │   │   ├── [6.8K] session.php │   │   │   └── [1.0K] view.php │   │   ├── [4.0K] database │   │   │   ├── [4.0K] factories │   │   │   │   └── [ 804] UserFactory.php │   │   │   ├── [4.0K] migrations │   │   │   │   ├── [ 810] 2014_10_12_000000_create_users_table.php │   │   │   │   └── [ 683] 2014_10_12_100000_create_password_resets_table.php │   │   │   └── [4.0K] seeds │   │   │   └── [ 250] DatabaseSeeder.php │   │   ├── [1.1K] package.json │   │   ├── [1.1K] phpunit.xml │   │   ├── [4.0K] public │   │   │   ├── [4.0K] css │   │   │   │   └── [125K] app.css │   │   │   ├── [ 0] favicon.ico │   │   │   ├── [1.8K] index.php │   │   │   ├── [4.0K] js │   │   │   │   └── [329K] app.js │   │   │   ├── [ 24] robots.txt │   │   │   ├── [4.0K] svg │   │   │   │   ├── [6.5K] 403.svg │   │   │   │   ├── [4.2K] 404.svg │   │   │   │   ├── [ 15K] 500.svg │   │   │   │   └── [5.4K] 503.svg │   │   │   └── [1.2K] web.config │   │   ├── [4.0K] readme.md │   │   ├── [4.0K] resources │   │   │   ├── [4.0K] js │   │   │   │   ├── [1.1K] app.js │   │   │   │   ├── [1.7K] bootstrap.js │   │   │   │   └── [4.0K] components │   │   │   │   └── [ 552] ExampleComponent.vue │   │   │   ├── [4.0K] lang │   │   │   │   └── [4.0K] en │   │   │   │   ├── [ 617] auth.php │   │   │   │   ├── [ 534] pagination.php │   │   │   │   ├── [ 786] passwords.php │   │   │   │   └── [7.3K] validation.php │   │   │   ├── [4.0K] sass │   │   │   │   ├── [ 251] app.scss │   │   │   │   └── [ 318] _variables.scss │   │   │   └── [4.0K] views │   │   │   └── [2.8K] welcome.blade.php │   │   ├── [4.0K] routes │   │   │   ├── [ 528] api.php │   │   │   ├── [ 508] channels.php │   │   │   ├── [ 553] console.php │   │   │   └── [ 453] web.php │   │   ├── [ 563] server.php │   │   ├── [4.0K] storage │   │   │   ├── [4.0K] app │   │   │   │   └── [4.0K] public │   │   │   ├── [4.0K] framework │   │   │   │   ├── [4.0K] cache │   │   │   │   │   └── [4.0K] data │   │   │   │   ├── [4.0K] sessions │   │   │   │   ├── [4.0K] testing │   │   │   │   └── [4.0K] views │   │   │   └── [4.0K] logs │   │   ├── [4.0K] tests │   │   │   ├── [ 380] CreatesApplication.php │   │   │   ├── [4.0K] Feature │   │   │   │   └── [ 340] ExampleTest.php │   │   │   ├── [ 163] TestCase.php │   │   │   └── [4.0K] Unit │   │   │   └── [ 294] ExampleTest.php │   │   └── [ 537] webpack.mix.js │   ├── [1.1K] package.json │   ├── [1.1K] phpunit.xml │   ├── [4.0K] public │   │   ├── [4.0K] css │   │   │   └── [125K] app.css │   │   ├── [ 0] favicon.ico │   │   ├── [1.8K] index.php │   │   ├── [4.0K] js │   │   │   └── [329K] app.js │   │   ├── [ 24] robots.txt │   │   ├── [4.0K] svg │   │   │   ├── [6.5K] 403.svg │   │   │   ├── [4.2K] 404.svg │   │   │   ├── [ 15K] 500.svg │   │   │   └── [5.4K] 503.svg │   │   └── [1.2K] web.config │   ├── [4.0K] readme.md │   ├── [4.0K] resources │   │   ├── [4.0K] js │   │   │   ├── [1.1K] app.js │   │   │   ├── [1.7K] bootstrap.js │   │   │   └── [4.0K] components │   │   │   └── [ 552] ExampleComponent.vue │   │   ├── [4.0K] lang │   │   │   └── [4.0K] en │   │   │   ├── [ 617] auth.php │   │   │   ├── [ 534] pagination.php │   │   │   ├── [ 786] passwords.php │   │   │   └── [7.3K] validation.php │   │   ├── [4.0K] sass │   │   │   ├── [ 251] app.scss │   │   │   └── [ 318] _variables.scss │   │   └── [4.0K] views │   │   └── [2.8K] welcome.blade.php │   ├── [4.0K] routes │   │   ├── [ 528] api.php │   │   ├── [ 508] channels.php │   │   ├── [ 553] console.php │   │   └── [ 453] web.php │   ├── [ 563] server.php │   ├── [4.0K] storage │   │   ├── [4.0K] app │   │   │   └── [4.0K] public │   │   ├── [4.0K] framework │   │   │   ├── [4.0K] cache │   │   │   │   └── [4.0K] data │   │   │   ├── [4.0K] sessions │   │   │   ├── [4.0K] testing │   │   │   └── [4.0K] views │   │   └── [4.0K] logs │   ├── [4.0K] tests │   │   ├── [ 380] CreatesApplication.php │   │   ├── [4.0K] Feature │   │   │   └── [ 340] ExampleTest.php │   │   ├── [ 163] TestCase.php │   │   └── [4.0K] Unit │   │   └── [ 294] ExampleTest.php │   └── [ 537] webpack.mix.js ├── [4.0K] nginx │   └── [ 463] default.conf └── [3.8K] README.md 84 directories, 166 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.