Skip to content

Commit

Permalink
add detections, bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
dolevf committed Apr 16, 2022
1 parent 19c780e commit 20bf34f
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 3 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ GraphQL Cop allows you to reproduce the findings by providing cURL commands upon
- GraphiQL (Info Leak)
- Introspection (Info Leak)
- Directives Overloading (DoS)
- Circular Query using Introspection (DoS)

## Usage

Expand Down
4 changes: 3 additions & 1 deletion graphql-cop.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from lib.tests.dos_field_duplication import field_duplication
from lib.tests.dos_directive_overloading import directive_overloading
from lib.tests.info_trace_mode import trace_mode
from lib.tests.dos_circular_introspection import circular_query_introspection
from lib.utils import is_graphql, draw_art


Expand Down Expand Up @@ -66,7 +67,8 @@

tests = [field_suggestions, introspection, detect_graphiql,
get_method_support, alias_overloading, batch_query,
field_duplication, trace_mode, directive_overloading]
field_duplication, trace_mode, directive_overloading,
circular_query_introspection]

json_output = []

Expand Down
25 changes: 25 additions & 0 deletions lib/tests/dos_circular_introspection.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"""Perform Circular Query based on Introspection."""
from lib.utils import graph_query, curlify

def circular_query_introspection(url, proxy, headers):
"""Run a Circular Query using introspection."""
res = {
'result':False,
'title':'Introspection-based Circular Query',
'description':'Circular-query using Introspection',
'impact':'Denial of Service',
'severity':'HIGH',
'curl_verify':''
}

q = 'query { __schema { types { fields { type { fields { type { fields { type { fields { type { name } } } } } } } } } } }'

gql_response = graph_query(url, proxies=proxy, headers=headers, payload=q)
res['curl_verify'] = curlify(gql_response)
try:
if len(gql_response.json()['data']['__schema']['types']) > 25:
res['result'] = True
except:
pass

return res
2 changes: 1 addition & 1 deletion version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
"""Version details of graphql-cop."""
VERSION = '1.2'
VERSION = '1.3'

0 comments on commit 20bf34f

Please sign in to comment.