http://81.70.197.171/nuonuo.html
http://81.70.197.171/jiuwei.html
这两个分别是源码
上面两个html都是我源码的审计结果,以上有无上传漏洞或者其他可以上传的方式,特别是nuonuo.html开着waf都没用
http://81.70.197.171/nuonuo.html
http://81.70.197.171/jiuwei.html
这两个分别是源码
上面两个html都是我源码的审计结果,以上有无上传漏洞或者其他可以上传的方式,特别是nuonuo.html开着waf都没用
这个审计只是一个参考, 在他的审计基础上,你需要追踪代码,看看变量是否有 过滤比如:
@(eval('$condition=(' . $command . ');'));
这个, $command 是否有暴露出来, 给用户传递. 如果用户传递了, 后续的执行结果是什么.跟踪一下代码的执行.看看是否有危险的执行结果。才能判断是否真的有漏洞
`<?php
/**
*/
namespace com;
class Auth{
//默认配置
protected $_config = array(
'auth_on' => true, // 认证开关
'auth_type' => 1, // 认证方式,1为实时认证;2为登录认证。
'auth_group' => 'think_auth_group', // 用户组数据表名
'auth_group_access' => 'think_auth_group_access', // 用户-用户组关系表
'auth_rule' => 'think_auth_rule', // 权限规则表
'auth_user' => 'think_admin' // 用户信息表
);
public function __construct() {
if (config('database.auth_config')) {
//可设置配置项 auth_config, 此配置项为数组。
$this->_config = array_merge($this->_config, config('database.auth_config'));
}
}
/**
* 检查权限
* @param name string|array 需要验证的规则列表,支持逗号分隔的权限规则或索引数组
* @param uid int 认证用户的id
* @param string mode 执行check的模式
* @param relation string 如果为 'or' 表示满足任一条规则即通过验证;如果为 'and'则表示需满足所有规则才能通过验证
* @return boolean 通过验证返回true;失败返回false
*/
public function check($name, $uid, $type=1, $mode='url', $relation='or') {
if (!$this->_config['auth_on'])
return true;
$authList = $this->getAuthList($uid,$type); //获取用户需要验证的所有有效规则列表
if (is_string($name)) {
$name = strtolower($name);
if (strpos($name, ',') !== false) {
$name = explode(',', $name);
} else {
$name = array($name);
}
}
$list = array(); //保存验证通过的规则名
if ($mode=='url') {
$REQUEST = unserialize( strtolower(serialize($_REQUEST)) );
}
foreach ( $authList as $auth ) {
$query = preg_replace('/^.+\?/U','',$auth);
if ($mode=='url' && $query!=$auth ) {
parse_str($query,$param); //解析规则中的param
$intersect = array_intersect_assoc($REQUEST,$param);
$auth = preg_replace('/\?.*$/U','',$auth);
if ( in_array($auth,$name) && $intersect==$param ) { //如果节点相符且url参数满足
$list[] = $auth ;
}
}else if (in_array($auth , $name)){
$list[] = $auth ;
}
}
//dump($list);exit;
if ($relation == 'or' and !empty($list)) {
return true;
}
$diff = array_diff($name, $list);
if ($relation == 'and' and empty($diff)) {
return true;
}
return false;
}
/**
* 根据用户id获取用户组,返回值为数组
* @param uid int 用户id
* @return array 用户所属的用户组 array(
* array('uid'=>'用户id','group_id'=>'用户组id','title'=>'用户组名称','rules'=>'用户组拥有的规则id,多个,号隔开'),
* ...)
*/
public function getGroups($uid) {
static $groups = array();
if (isset($groups[$uid]))
return $groups[$uid];
$user_groups = \think\Db::table($this->_config['auth_group_access'])
->alias('a')
->join($this->_config['auth_group']." g", "g.id=a.group_id")
->where("a.uid='$uid' and g.status='1'")
->field('uid,group_id,title,rules')->select();
$groups[$uid] = $user_groups ? $user_groups : array();
return $groups[$uid];
}
/**
* 获得权限列表
* @param integer $uid 用户id
* @param integer $type
*/
protected function getAuthList($uid,$type) {
static $_authList = array(); //保存用户验证通过的权限列表
$t = implode(',',(array)$type);
if (isset($_authList[$uid.$t])) {
return $_authList[$uid.$t];
}
if( $this->_config['auth_type']==2 && \think\Session::get('_auth_list_'.$uid.$t)){
return \think\Session::get('_auth_list_'.$uid.$t);
}
//读取用户所属用户组
$groups = $this->getGroups($uid);
$ids = array();//保存用户所属用户组设置的所有权限规则id
foreach ($groups as $g) {
$ids = array_merge($ids, explode(',', trim($g['rules'], ',')));
}
$ids = array_unique($ids);
if (empty($ids)) {
$_authList[$uid.$t] = array();
return array();
}
$map=array(
'id'=>array('in',$ids),
'type'=>$type,
'status'=>1,
);
//读取用户组所有权限规则
$rules = \think\Db::table($this->_config['auth_rule'])->where($map)->field('condition,name')->select();
//循环规则,判断结果。
$authList = array(); //
foreach ($rules as $rule) {
if (!empty($rule['condition'])) { //根据condition进行验证
$user = $this->getUserInfo($uid);//获取用户信息,一维数组
$command = preg_replace('/\{(\w*?)\}/', '$user[\'\\1\']', $rule['condition']);
//dump($command);//debug
@(eval('$condition=(' . $command . ');'));
if ($condition) {
$authList[] = strtolower($rule['name']);
}
} else {
//只要存在就记录
$authList[] = strtolower($rule['name']);
}
}
$_authList[$uid.$t] = $authList;
if($this->_config['auth_type']==2){
//规则列表结果保存到session
\think\Session::set('_auth_list_'.$uid.$t, $authList);
}
return array_unique($authList);
}
/**
* 获得用户资料,根据自己的情况读取数据库
*/
protected function getUserInfo($uid) {
static $userinfo=array();
if(!isset($userinfo[$uid])){
$userinfo[$uid]=\think\Db::table($this->_config['auth_user'])->where('id',$uid)->find();
}
return $userinfo[$uid];
}
}
`
1 回答4.1k 阅读✓ 已解决
3 回答1.9k 阅读✓ 已解决
2 回答2.3k 阅读✓ 已解决
1 回答1.4k 阅读✓ 已解决
2 回答725 阅读✓ 已解决
2 回答2.3k 阅读
1 回答689 阅读✓ 已解决
看了一下结果, 这就是个字符串匹配, 完全没有参考价值.
比如这条
读取文件函数中存在变量,可能存在任意文件读取漏洞 /hzpay/bufpay/czurl.php $content = file_get_contents($file);
哪个读文件函数会没有变量? 问题是这个变量的来源, 是用户输入的, 还是什么.再比如这条
, 这种会执行命令? sql注入倒是真的.
综上, 这审计完成没有价值.