Skip to content
KitploitKITPLOIT
도구블로그
제출
도구블로그
제출

해킹, 침투 테스트 및 사이버 보안 도구를 당신의 보안 무기고에!

Kitploit은 해킹, 사이버 보안 및 침투 테스트 도구 디렉토리입니다. 최신 프로젝트 업데이트를 발견하여 취약점을 찾고, 시스템을 분석하고, 테스트를 자동화하고, 보안을 강화하세요.

··피드·문의·개인정보·© 2026 Kitploit

도구 디렉토리

카테고리

모든 카테고리 보기
Loading categories
CVE-2024-40275_Scanner — Apache HTTP Server 소스 코드 노출(CVE-2024-40725) 스캐너; 직접 경로와 하위 요청(subrequest) 경로를 검사하고, 영향을 받는 버전을 식별하며, CI/CD용 JSON 보고서를 출력합니다. | Kitploit
도구/GitHubGitHub/burjoy/cve-2024-40275_scanner
Vulnerability ScannersWeb Vulnerability ScannersVulnerability AnalysisWeb SecurityMisconfiguration
GitHubburjoy/cve-2024-40275_scanner

CVE-2024-40275_Scanner

Apache HTTP Server 소스 코드 노출(CVE-2024-40725) 스캐너; 직접 경로와 하위 요청(subrequest) 경로를 검사하고, 영향을 받는 버전을 식별하며, CI/CD용 JSON 보고서를 출력합니다.

저장소 보기
623일 전아직 검토되지 않음

인기

모두 보기 →

커뮤니티에서 가장 많이 사용되는 도구를 찾아보세요.

모든 도구 탐색

도구 컬렉션을 둘러보세요

모든 도구 보기 →
공유

CVE-2024-40725 스캐너

CVE-2024-40725용 Python 기반 탐지 도구로, 2.4.0 및 2.4.61 버전에 영향을 미치는 Apache HTTP Server 소스 코드 노출 취약점입니다.

법적 고지: 이 스캐너는 본인이 소유하거나 명시적인 서면 테스트 승인을 받은 서버에서만 실행하십시오. 무단 사용은 컴퓨터 사기 관련 법률(예: CFAA, Computer Misuse Act)을 위반할 수 있습니다.


배경

CVE-2024-40725은 버전 2.4.0에 도입된 Apache 내부 요청 파이프라인의 회귀(regression)입니다(CVE-2024-39884에 대한 불완전한 수정). 서버가 레거시 AddType 지시문(예: AddType application/x-httpd-php .php)을 사용하여 구성된 경우, 하위 요청(subrequest) 처리 중(DirectoryIndex, mod_rewrite 또는 mod_dir에 의해 트리거됨) Apache의 내부 핸들러 할당이 조용히 제거됩니다.

그 결과 PHP 스크립트 인터프리터는 호출되지 않습니다. 대신 Apache의 내장 default-handler가 디스크에서 파일을 열어 데이터베이스 자격 증명, API 키, 애플리케이션 로직을 포함한 원시 바이트를 클라이언트에게 직접 스트리밍합니다.

영향받는 버전: Apache httpd 2.4.0 – 2.4.61
수정된 버전: Apache httpd 2.4.62+


요구 사항

  • Python 3.8+
  • requests 라이브러리
root@kitploit:~
pip install requests

설치

root@kitploit:~
# Clone or download the scanner
curl -O https://your-host/cve_2024_40725_scanner.py

# Make executable (optional)
chmod +x cve_2024_40725_scanner.py

사용법

root@kitploit:~
python3 cve_2024_40725_scanner.py --target <URL> [OPTIONS]

옵션

플래그유형기본값설명
--targetURL(필수)테스트할 Apache 서버의 기본 URL
--pathsPATH [PATH ...]내장 목록직접 프로브할 하나 이상의 PHP 경로
--wordlistFILE—워드리스트 파일 경로(줄당 하나의 경로)
--no-directory-check플래그꺼짐하위 요청/디렉터리 인덱스 프로브(프로브 B) 건너뛰기
--timeoutint(초)10요청별 제한 시간
--delayfloat(초)0.0요청 간 지연(속도 제한)
--no-verify-ssl플래그꺼짐SSL 인증서 검증 비활성화
--outputFILE—전체 JSON 보고서를 이 파일에 작성
--verbose플래그꺼짐디버그 출력 활성화

예시

root@kitploit:~
# Quickstart: scan localhost with built-in default paths
python3 cve_2024_40725_scanner.py --target http://localhost

# Scan specific paths
python3 cve_2024_40725_scanner.py \
  --target http://192.168.1.10 \
  --paths /index.php /admin/config.php /wp-config.php

# Use a wordlist file
python3 cve_2024_40725_scanner.py \
  --target http://192.168.1.10 \
  --wordlist php_paths.txt

# Combine wordlist + extra inline paths (merged, deduplicated)
python3 cve_2024_40725_scanner.py \
  --target http://192.168.1.10 \
  --wordlist php_paths.txt \
  --paths /extra/secret.php

# HTTPS with self-signed certificate
python3 cve_2024_40725_scanner.py \
  --target https://myserver.local \
  --no-verify-ssl

# Polite scan with 1 second delay and JSON report
python3 cve_2024_40725_scanner.py \
  --target http://myserver.local \
  --wordlist php_paths.txt \
  --delay 1.0 \
  --output results.json \
  --verbose

# CI/CD usage (exit code 1 = vulnerable, 0 = clean)
python3 cve_2024_40725_scanner.py --target http://localhost || echo "VULNERABLE"

워드리스트 형식

줄당 하나의 경로입니다. #로 시작하는 줄은 주석으로 처리되어 건너뜁니다. 빈 줄은 무시됩니다. 선행 슬래시는 자동으로 정규화됩니다.

root@kitploit:~
# Common PHP entrypoints
/index.php
/info.php
/phpinfo.php

# Admin panels
/admin/index.php
/admin/config.php

# CMS files
/wp-config.php
/wp-login.php
/configuration.php

# API internals
/api/v1/status.php

작동 방식

스캐너는 경로당 두 가지 프로브를 실행합니다:

프로브 A — 직접 파일 요청

root@kitploit:~
GET /index.php HTTP/1.1

PHP 파일을 직접 요청했을 때 원시 소스 코드가 반환되는지 확인합니다. AddType이 직접 요청에서도 손상된 잘못 구성된 서버에서 영향을 받습니다.

프로브 B — 하위 요청 트리거(실제 CVE 경로)

root@kitploit:~
GET / HTTP/1.1

파일 자체 대신 상위 디렉터리를 요청합니다. Apache는 내부적으로 DirectoryIndex → index.php를 해석하여 하위 요청을 생성합니다. 이것은 Apache 2.4.0–2.4.61에서 r->handler가 NULL로 떨어지는 정확한 코드 경로입니다.

프로브 B가 더 중요하고 현실적인 테스트입니다. 많은 서버가 직접 파일 경로가 아닌 하위 요청 경로를 통해서만 취약합니다.

유출 탐지

스캐너는 응답 본문에서 PHP 소스 코드 시그니처를 확인합니다:

  • <?php
  • <?PHP
  • <?=

일치 항목이 발견되면 전체 응답 본문을 출력하는 대신 분류를 위해 유출 위치 주변의 150자 스니펫을 추출합니다.

서버 핑거프린팅

Server: 응답 헤더를 읽어 Apache 버전을 감지합니다. 유출이 확인되기 전에도 버전 2.4.0 또는 2.4.61을 보고하는 서버에 플래그를 표시합니다.

참고: 강화된 서버는 Server: 헤더를 숨길 수 있습니다(ServerTokens Prod). 스캐너는 그와 관계없이 모든 프로브를 계속 실행합니다.


출력

터미널 출력 예시

root@kitploit:~
============================================================
  CVE-2024-40725 -- Apache Source Code Disclosure Scanner
============================================================
  Target : http://localhost
  Paths  : 6
  Time   : 2024-08-01T12:00:00

  [*] Fingerprinting server: http://localhost
      Server Header : Apache/2.4.61 (Debian)
      Apache Version: 2.4.61
      [!] Version is in vulnerable range (2.4.0 - 2.4.61)

  [*] Testing 6 path(s)...

  --- /index.php
      Direct  (HTTP 200): OK
      Subreq  (HTTP 200): LEAKED
      [!] VULNERABLE via: subrequest (directory index)
         Leaked snippet: '<?php\n$db_pass = "supersecretpassword";'

  --- /info.php
      Direct  (HTTP 404): OK
      Subreq  (HTTP 404): OK
      [+] Safe

============================================================
  SCAN SUMMARY
============================================================
  Target            : http://localhost
  Apache Version    : 2.4.61
  Paths Tested      : 6
  Vulnerable Paths  : 1
  Safe Paths        : 5

  [!] RESULT: VULNERABLE
      Vulnerable paths:
        * /index.php  (trigger: subrequest (directory index))

  Remediation:
    1. Upgrade to Apache httpd >= 2.4.62
    2. Replace 'AddType' with 'SetHandler' in <FilesMatch> blocks
============================================================

JSON 보고서 구조(--output results.json)

root@kitploit:~
{
  "target": "http://localhost",
  "scan_time": "2024-08-01T12:00:00",
  "apache_version": "2.4.61",
  "apache_in_range": true,
  "paths_tested": 6,
  "vulnerable_paths": [
    {
      "path": "/index.php",
      "direct_url": "http://localhost/index.php",
      "directory_url": "http://localhost/",
      "direct_status": 200,
      "direct_leaked": false,
      "direct_snippet": null,
      "directory_status": 200,
      "directory_leaked": true,
      "directory_snippet": "<?php\n$db_pass = \"supersecretpassword\";",
      "server_header": "Apache/2.4.61 (Debian)",
      "vulnerable": true,
      "trigger": "subrequest (directory index)"
    }
  ],
  "safe_paths": [...]
}

종료 코드

코드의미
0취약한 경로가 감지되지 않음
1취약한 경로가 하나 이상 발견됨

종료 코드 덕분에 이 스캐너는 CI/CD 파이프라인 및 자동화된 인프라 감사에 적합합니다.


조치 방법

방법 1: Apache 업그레이드(권장)

root@kitploit:~
# Debian / Ubuntu
sudo apt update && sudo apt install apache2

# RHEL / CentOS / AlmaLinux
sudo dnf update httpd

# Verify version (must be >= 2.4.62)
apache2 -v

방법 2: AddType을 SetHandler로 교체

PHP 실행에 사용되는 모든 AddType 지시문을 교체하십시오:

root@kitploit:~
# ❌ Vulnerable Configs
AddType application/x-httpd-php .php

# ✅ Safe Configs
<FilesMatch "\.php$">
    SetHandler "proxy:unix:/run/php/php8.2-fpm.sock|fcgi://localhost"
</FilesMatch>

취약한 구성과 안전한 구성 비교

root@kitploit:~
# VULNERABLE
<VirtualHost *:80>
    DocumentRoot /var/www/html
    AddType application/x-httpd-php .php     # ← triggers CVE
    DirectoryIndex index.php
</VirtualHost>

# SAFE
<VirtualHost *:80>
    DocumentRoot /var/www/html
    <FilesMatch "\.php$">
        SetHandler "proxy:unix:/run/php/php8.2-fpm.sock|fcgi://localhost"
    </FilesMatch>
    DirectoryIndex index.php
</VirtualHost>

관련 CVE

CVE버전설명
CVE-2024-398842.4.0최초 소스 노출 회귀(regression)
CVE-2024-407252.4.61불완전한 수정 — 동일한 유형의 버그
CVE-2024-408982.4.61mod_rewrite의 별도 SSRF(Windows 전용)
도구 다운로드