第一步:安装环境
下载源码并解压至WWW下
访问www下的install.php进行安装
第二部:验证漏洞
php审计知识
->在php中是一个对象操作符
比如我有一个类db:
class db{
public $host;
public function printHost(){
echo KaTeX parse error: Expected 'EOF', got '}' at position 15: this -> host; }̲ } 使用这个类: 首先要实例…db = new db();
得到一个对象$db,那我要怎么使用db里面的属性和方法呢,这个时候就要用->了,比如:
$db -> host = ‘localhost’; //设置他的属性
$db -> printHost(); //使用方法
经审计,有漏洞的部分为
public function limit($limit)
{
if(empty($limit)) return $this;
stripos($limit, 'limit') !== false ? $this->sql .= " $limit " : $this->sql .= ' ' . DAO::LIMIT . " $limit ";
return $this;
}
函数fuction limit()未对传进的参数进行过滤,直接拼接成SQL语句进行查询。
学习反向审计的方式,在其他源码中追溯调用该危险函数及参数的位置
这里推荐一个软件 DocFetcher
使用方法
免安装,可对某个范围里的文件内容进行搜索,且文件格式支持非常齐全
在DocFetcher中检索limit
module\task\model.php中limit被调用在 getUserasks 中
public function getUserTasks($account, $type = 'assignedTo', $limit = 0, $pager = null, $orderBy="id_desc")
{
$tasks = $this->dao->select('t1.*, t2.id as projectID, t2.name as projectName, t3.id as storyID, t3.title as storyTitle, t3.status AS storyStatus, t3.version AS latestStoryVersion')
->from(TABLE_TASK)->alias('t1')
->leftjoin(TABLE_PROJECT)->alias('t2')
->on('t1.project = t2.id')
->leftjoin(TABLE_STORY)->alias('t3')
->on('t1.story = t3.id')
->where('t1.deleted')->eq(0)
->beginIF($type != 'all')->andWhere("t1.$type")->eq($account)->fi()
->orderBy($orderBy)
->beginIF($limit > 0)->limit($limit)->fi()
->page($pager)
->fetchAll();
$this->loadModel('common')->saveQueryCondition($this->dao->get(), 'task');
if($tasks) return $this->processTasks($tasks);
return array();
}
同样地追踪 getUserTasks
module\block\control.php中
public function printTaskBlock()
{
$this->view->tasks = $this->loadModel('task')->getUserTasks($this->app->user->account, $this->params->type, $this->params->num, null, $this->params->orderBy);
$this->display();
}
</