Warning: mkdir(): Permission denied in /var/www/html/file/mimetype.php on line 14
SecuLab | MIME Type Bypass Lab
← 대시보드 MIME Type Bypass SecuLab PRAC

🎭 MIME Type Bypass

Content-Type 헤더 조작 실습

OWASP A04 · Insecure Design
취약 포인트: 이 서버는 $_FILES['type'] (클라이언트가 보낸 Content-Type) 만으로 파일을 검증합니다.
Content-Type은 HTTP 요청 헤더이므로 Burp Suite 등으로 자유롭게 조작할 수 있습니다.

목표: .php 웹쉘을 업로드할 때 Content-Type을 image/jpeg로 바꿔 우회하세요.
선택된 파일 없음

💡 힌트 보기 (클릭) ▾
# Burp Suite로 요청 가로채기 → Content-Type 변조 # 원본 요청 (PHP 파일 업로드 시) Content-Disposition: form-data; name="file"; filename="shell.php" Content-Type: application/x-php ← 차단됨 # 조작 후 (Burp Repeater에서 수정) Content-Disposition: form-data; name="file"; filename="shell.php" Content-Type: image/jpeg ← 통과됨! # curl로도 가능 curl -X POST http://localhost:8081/mimetype.php \ -F "file=@shell.php;type=image/jpeg"

🔍 취약한 검증 vs 안전한 검증

방식 코드 안전성
클라이언트 MIME $_FILES['type'] 취약 — 조작 가능
finfo (매직바이트) finfo_file($path, FILEINFO_MIME_TYPE) 안전 — 파일 내용 검사
getimagesize() getimagesize($tmp)['mime'] 안전 — 이미지 헤더 검사

📂 업로드된 파일 목록

업로드된 파일이 없습니다.