• 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)

  • 相关阅读:
    Harbor安装 -- 企业级Registry仓库
    https原理
    第十节
    第九节
    第八节
    Spring中用到的部分设计模式
    代理模式及实现
    单例模式的实现
    索引
    第九章 集合
  • 原文地址:https://www.cnblogs.com/yangxiaodi/p/6874314.html
Copyright © 2020-2023  润新知