php代码审计思维导图,利用思维导图快速读懂框架和理清思路之禅道

偶尔会收到邮件、微博还有博客来咨询,说在代码审计的时候总感觉程序比较乱,读不懂框架,理不清思路,发现了一段漏洞代码,但是不知道怎么去找到漏洞利用点(请求哪个URL、提交什么数据),这是因为你对这套程序的大框架还不够熟悉,对程序执行流程理解不透彻。

既然这么多人反馈,那我就简单说一下我的方式:利用思维导图。

思维导图是个很好的东西,我在思考各种事情、写复杂程序等等各种场景都会用上这个东西,当然代码审计的时候也会用到,因为它能帮我很快熟悉框架,并且记录可能出现安全问题的地方。如下图所示

这是在审计禅道时弄的一个简单思维导图,禅道这套系统一共审计出来了几十个漏洞利用点,包括免登录注入和getshell。

可以看到我的这个思维导图,里面包括以下因素:

1、程序执行过程(URL怎么解析、首先调用哪些文件等等)

2、重要配置文件

3、模块解释

4、出现问题的点(用红旗标记)

5、代码备注

这样一来我们对程序的框架就会一览无余,思路自然清晰。

还有一个问题是关于:怎么挖掘免登陆的漏洞?

程序自然会检测权限,就像我这个思维导图里面写的禅道一样,common模块的isopenmethod()函数检查权限,哪些模块可以不用登陆或者低权限可访问

public function isOpenMethod($module, $method)

{

if($module == ‘user’ and strpos(‘login|logout|deny|reset’, $method) !== false) return true;

if($module == ‘api’ and $method == ‘getsessionid’) return true;

if($module == ‘misc’ and $method == ‘ping’) return true;

if($module == ‘misc’ and $method == ‘checktable’) return true;

if($module == ‘misc’ and $method == ‘qrcode’) return true;

if($module == ‘misc’ and $method == ‘about’) return true;

if($module == ‘misc’ and $method == ‘checkupdate’) return true;

if($module == ‘misc’ and $method == ‘changelog’) return true;

if($module == ‘sso’ and $method == ‘login’) return true;

if($module == ‘sso’ and $method == ‘logout’) return true;

if($module == ‘sso’ and $method == ‘bind’) return true;

if($module == ‘sso’ and $method == ‘gettodolist’) return true;

if($module == ‘block’ and $method == ‘main’) return true;

if($this->loadModel(‘user’)->isLogon() or ($this->app->company->guest and $this->app->user->account == ‘guest’))

{

if(stripos($method, ‘ajax’) !== false) return true;

if(stripos($method, ‘downnotify’) !== false) return true;

if($module == ‘tutorial’) return true;

if($module == ‘block’) return true;

if($module == ‘product’ and $method == ‘showerrornone’) return true;

}

return false;

}

从代码中可以看到,主要是’user’ 、’api’ 、’misc’ 、’sso’ 以及’block’ 模块的部分函数无需登陆就可以访问,$module 代表模块,$method代表函数,那我们就可以把这些函数都看一遍,看是否存在可利用的漏洞。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值