zoukankan      html  css  js  c++  java
  • Joomla!3.7.0 Core SQL注入漏洞动态调试草稿

     参考joolma的mvc框架讲解:http://www.360doc.com/content/11/1219/18/1372409_173441270.shtml

    从这个页面开始下断点:Joomla_3.7.0/components/com_fields/controller.php

     调用父类的构造方法

    继续跟:/Applications/MAMP/htdocs/Joomla_3.7.0/libraries/legacy/controller/legacy.php

     -------分割线-------

    跟进函数,位于/Joomla_3.7.0/libraries/legacy/model/legacy.php

    在这里调用第一个的get()函数 $this->state = $this->get('State');

    跟进以后构造成模块也就是 getState($property = null, $default = null) 函数

    $this->populateState();

    遇到这个继续跟进

    位于 /Joomla_3.7.0/administrator/components/com_fields/models/fields.php    p73-89

    protected function populateState($ordering = null, $direction = null)

    可以看到这里有调用了父类populateState方法,我们跟进到父类
    parent::populateState('a.ordering', 'asc');
    继续跟进

    位于/Joomla_3.7.0/libraries/legacy/model/list.php 

     

     跟进getUserStateFromRequest()函数

    /Applications/MAMP/htdocs/Joomla_3.7.0/libraries/cms/application/cms.php

    这里的$request=list  $key=com_fields.fields  继续跟进$cur_state = $this->getUserState($key, $default);

    这里的$key是等于com_fields.fields.list

    经过一系列for循环

    $cur_state的值变成了注入payload。 

     

    返回$list的值

    位于 /Applications/MAMP/htdocs/Joomla_3.7.0/libraries/legacy/model/list.php   第495-570行 

     第566行:

    跟进setState函数

     这时候就设定了list.fullordering的值。

    接着看第二个$this->items = $this->get('Items');

    走get函数,执行了getItems()

     

     跟进getItems()  位于 /Joomla_3.7.0/libraries/legacy/model/list.php   第172-186行

    可以看到执行了_getListQuery()  函数,位于同一目录下。

    然后执行getListQuery() 函数,位于/Joomla_3.7.0/administrator/components/com_fields/models/fields.php  第124-328行

    执行到305行

     

    取list.fullordering的值,我们在前面$this->state = $this->get('State');  操作中,已经把$this->state = $this->get('State');设成了sql语句的值。

    赋值给$listOrdering,然后进入order查询。

    就这样产生注入了。

    后记。模模糊糊跟着函数看了大半天的参考文章,才写成的,对于joolma这种大程序,函数那么多还是容易犯迷糊,最后经过指点,用phpstorm看调用堆栈就有过程,然后慢慢回溯回去,才有了这篇文章。

    参考:http://bobao.360.cn/learning/detail/3870.html

    poc:index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml(0x3a,concat(1,(select%20md5(1))),1)

  • 相关阅读:
    python笔记之re模块学习
    python笔记之面向对象
    C# 静态类和非静态类(实例类)
    占位符的使用
    数据类型和数据类型转换
    win7 安装 memcached
    php 汉字转换成拼音
    apache window环境下本地配置虚拟主机
    在浏览器输入一个网址到得到页面的过程
    浅谈线程池ThreadPoolExecutor核心参数
  • 原文地址:https://www.cnblogs.com/yangxiaodi/p/6874314.html
Copyright © 2011-2022 走看看