-
Notifications
You must be signed in to change notification settings - Fork 837
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ThinkAdmin v6 未授权列目录/任意文件读取 #244
Labels
Comments
感谢反馈,这个问题会立即处理,之前也有考虑,还没有加上验 |
临时方案 |
问题已经完成初次修复,后面还会继续优化。 |
这是来自QQ邮箱的假期自动回复邮件。
您好,来信收到
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ThinkAdmin v6 列目录/任意文件读取
app/admin/controller/api/Update.php
存在3个function,都是不用登录认证就可以使用的,引用列表如下:version()
可以获取到当前版本:2020.08.03.01
,≤这个版本的都有可能存在漏洞URL:http://think.admin/ThinkAdmin/public/admin.html?s=admin/api.Update/version
列目录
node()
:直接把POST的
rules
和ignore
参数传给InstallService::instance()->getList()
,根据上面的use引用可以知道文件路径在vendor/zoujingli/think-library/src/service/InstallService.php
:$ignore
可以不用关注,他会透过_scanList()
去遍历$rules
数组,调用scanDirectory()
去递归遍历目录下的文件,最后在透过_getInfo()
去获取文件名与哈希,由下面代码可以知道程序没有任何验证,攻击者可以在未授权的情况下读取服务器的文件列表。读取网站根目录Payload: http://think.admin/ThinkAdmin/public/admin.html?s=admin/api.Update/node
POST:
也可以使用
../
来进行目录穿越演示站:
任意文件读取
get()
:首先从GET读取
encode
参数并使用decode()
解码:解密UTF8字符串的,刚好上面有个加密UTF8字符串的
encode()
,攻击时直接调用那个就可以了:跟进
ModuleService::instance()->checkAllowDownload()
,文件路径vendor/zoujingli/think-library/src/service/ModuleService.php
:首先
$name
不能够是database.php
,接着跟进getAllowDownloadRule()
:有一个允许的列表:
也就是说
$name
必须要不是database.php
且要在允许列表内的文件才能够被读取,先绕过安全列表的限制,比如读取根目录的1.txt,只需要传入:而
database.php
的限制在Linux下应该是没办法绕过的,但是在Windows下可以透过"
来替换.
,也就是传入:对应encode()后的结果为:
34392q302x2r1b37382p382x2r1b1a1a1b1a1a1b2r33322u2x2v1b2s2p382p2q2p372t0y342w34
Windows读取
database.php
:演示站读取
/etc/passwd
:v5连允许列表都没有,可以直接读任意文件。
The text was updated successfully, but these errors were encountered: