VolgaCTF 2020 Qualifier Library

fuzz

初步fuzz整个网站的功能,数据传输使用JSON格式,输入点只有注册和登录,也没有测出sql注入。但是随便删掉query中属性后看到报错{"code":"GRAPHQL_PARSE_FAILED"},判断出前后端是用graphql来查询api

获取信息

根据文档中Introspection的部分
获取所有的数据类型,包括用户定义的,bp没有json美化,转战postman

{
  __schema {
    types {
      name
    }
  }
}

获取数据库所有的结构

fragment FullType on __Type {
  kind
  name
  description
  fields(includeDeprecated: true) {
    name
    description
    args {
      ...InputValue
    }
    type {
      ...TypeRef
    }
    isDeprecated
    deprecationReason
  }
  inputFields {
    ...InputValue
  }
  interfaces {
    ...TypeRef
  }
  enumValues(includeDeprecated: true) {
    name
    description
    isDeprecated
    deprecationReason
  }
  possibleTypes {
    ...TypeRef
  }
}
fragment InputValue on __InputValue {
  name
  description
  type {
    ...TypeRef
  }
  defaultValue
}
fragment TypeRef on __Type {
  kind
  name
  ofType {
    kind
    name
    ofType {
      kind
      name
      ofType {
        kind
        name
        ofType {
          kind
          name
          ofType {
            kind
            name
            ofType {
              kind
              name
              ofType {
                kind
                name
              }
            }
          }
        }
      }
    }
  }
}

query IntrospectionQuery {
  __schema {
    queryType {
      name
    }
    mutationType {
      name
    }
    types {
      ...FullType
    }
    directives {
      name
      description
      locations
      args {
        ...InputValue
      }
    }
  }
}

在获取的数据中我们可以看到loginregister的部分,但是还有一个并没有暴露在外的testGetUserByFilter值得我们关注,因为作为测试功能,往往会比正式功能更容易攻击。

testGetUserByFilter的参数是loginemaliname

GraphQL Injection

要获取数据首先要登录,在header中加上Authentication:Bearer [token here]
测试发现引号无效,但是报错,用union select测试列数

直接注出flag

原文地址:https://www.cnblogs.com/20175211lyz/p/12605583.html