graphqler
🔍A cutting edge context aware GraphQL API fuzzing tool!
Science Score: 64.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
✓Academic publication links
Links to: arxiv.org -
✓Committers with academic emails
1 of 4 committers (25.0%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (15.4%) to scientific vocabulary
Keywords
Keywords from Contributors
Repository
🔍A cutting edge context aware GraphQL API fuzzing tool!
Basic Info
Statistics
- Stars: 147
- Watchers: 4
- Forks: 14
- Open Issues: 8
- Releases: 8
Topics
Metadata Files
README.md
The only dependency-aware GraphQL API testing tool
GraphQLer is a cutting-edge tool designed to dynamically test GraphQL APIs with a focus on awareness. It offers a range of sophisticated features that streamline the testing process and ensure robust analysis of GraphQL APIs such as being able to automatically read a schema and run tests against an API using the schema. Furthermore, GraphQLer is aware of dependencies between objects queries and mutations which is then used to perform security tests against APIs.
Key features
- Request generation: Automatically generate valid queries and mutations based on the schema (supports fragments, unions, interfaces, and enums based on the latest GraphQL-spec)
- Dependency awareness: Run queries and mutations based on their natural dependencies
- Resource tracking: Keep track of any objects seen in the API for future use and reconnaisance
- Error correction: Try and fix requests so that the GraphQL API accepts them
- Statistics collection: Shows your results in a easy-to-read file
- Ease of use: All you need is the endpoint and the authentication token if needed
- Customizability: Change the configuration file to suit your needs, proxy requests through Burp or ZAP if you want
Getting started
Quick installation can be done either with pip:
sh
pip install GraphQLer
python -m graphqler --help
or docker:
sh
docker pull omar2535/graphqler:latest
docker run --rm omar2535/graphqler --help
For a more in-depth guide, check out the installation guide.
Usage
```sh ❯ python -m graphqler --help usage: main.py [-h] --url URL [--path PATH] [--config CONFIG] --mode {compile,fuzz,idor,run,single} [--auth AUTH] [--proxy PROXY] [--node NODE] [--plugins-path PLUGINS_PATH] [--version]
options: -h, --help show this help message and exit --url URL remote host URL --path PATH directory location for files to be saved-to/used-from. Defaults to graphqler-output --config CONFIG configuration file for the program --mode {compile,fuzz,idor,run,single} mode to run the program in --auth AUTH authentication token Example: 'Bearer arandompat-abcdefgh' --proxy PROXY proxy to use for requests (ie. http://127.0.0.1:8080) --node NODE node to run (only used in single mode) --plugins-path PLUGINS_PATH path to plugins directory --version display versionn ```
Below will be the steps on how you can use this program to test your GraphQL API. The usage is split into 2 phases, compilation and fuzzing.
- Compilation mode:This mode is responsible for running an introspection query against the given API and generating the dependency graphh
- Fuzzing mode: This mode is responsible for traversing the dependency graph and sending test requests to the API
A third mode is also included for ease of use, called run mode. this mode compiles both the compilation and fuzzing mode into one single command.
A mode in development right now is known as the idor mode, which will look for re-used objects that are accessible using another access token. This is in trial right now and requires the user to have run the compile and fuzzing mode first.
Compile mode
sh
python -m graphqler --mode compile --url <URL> --path <SAVE_PATH>
After compiling, you can view the compiled results in the <SAVE_PATH>/compiled. Additionally, a graph will have been generated called dependency_graph.png for inspection. Any UNKNOWNS in the compiled .yaml files can be manually marked; however, if not marked the fuzzer will still run them but just without using a dependency chain.
Fuzz mode
sh
python -m graphqler --mode fuzz --url <URL> --path <SAVE_PATH>
While fuzzing, statistics related to the GraphQL API and any ongoing request counts are logged in the console. Any request return codes are written to <SAVE_PATH>/stats.txt. All logs during fuzzing are kept in <SAVE_PATH>/logs/fuzzer.log. The log file will tell you exactly which requests are sent to which endpoints, and what the response was. This can be used for further result analysis. A copy of the objects bucket can be found in objects_bucket.pkl as well.
IDOR Checking mode
sh
python -m graphqler --mode idor --url <URL> --path <SAVE_PATH>
The insecure direct object reference (IDOR) mode can be run after compile mode and fuzz mode is complete. It requires the objects_bucket.pkl file to already exist as it uses the objects bucket from a previous run to see if information found/created from a previous run is also reference-able in a new run.
Run mode
Runs both the Compile mode and Fuzz mode
sh
python -m graphqler --mode run --url <URL> --path <SAVE_PATH>
Single mode
Runs a single node (make sure it exists in the list of queries or mutations)
sh
python -m graphqler --url <URL> --path <SAVE_PATH> --config <CUSTOM_CONFIG>> --proxy <CUSTOM_PROXY> --mode single --node <NODE_NAME>
Advanced features
There are also varaibles that can be modified with the --config flag as a TOML file (see /examples/config.toml for an example). These correspond to specific features implemented in GraphQLer, and can be tuned to your liking.
| Variable Name | Variable Description | Variable Type | Default |
|---------------|---------------------|---------------|---------------|
| MAXLEVENSHTEINTHRESHOLD | The levenshtein distance between objects and object IDs | Integer | 20 |
| MAXOBJECTCYCLES | Max number of times the same object should be materialized in the same query/mutation | Integer | 3 |
| MAXOUTUPTSELECTORDEPTH | Max depth the query/mutation's output should be expanded (such as the case of infinitely recursive selectors) | Integer | 3 |
| USEOBJECTSBUCKET | Whether or not to store object IDs for future use | Boolean | True |
| USEDEPENDENCYGRAPH | Whether or not to use the dependency-aware feature | Boolean | True |
| ALLOWDELETIONOFOBJECTS | Whether or not to allow deletions from the objects bucket | Boolean | False |
| MAXFUZZINGITERATIONS | Maximum number of fuzzing payloads to run on a node | Integer | 5 |
| MAXTIME | The maximum time to run in seconds | Integer | 3600 |
| TIMEBETWEENREQUESTS | Max time to wait between requests in seconds | Integer | 0.001 |
| DEBUG | Debug mode | Boolean | False |
| Custom Headers | Custom headers to be sent along with each request | Object | Accept = "application/json" |
| SKIPMAXIMALPAYLOADS | Whether or not to send a payload with all the possible outputs | Boolean | False |
| SKIPDOSATTACKS | Whether or not to skip DOS attacks(defaults to true to not DOS the service) | Boolean | True |
| SKIPINJECTIONATTACKS | Whether or not to skip injection attacks | Boolean | False |
| SKIPMISCATTACKS | Whether or not to skip miscillaneous attacks | Boolean | False |
| SKIPNODES | Nodes to skip (query or mutation names) | List | [] |
Plugins
You can also implement your own plugins for custom authentication (ie. short token lifetimes). See more in the docs.
Owner
- Name: Omar
- Login: omar2535
- Kind: user
- Location: Orion Arm, Milky Way Galaxy
- Website: thaomar.com
- Repositories: 85
- Profile: https://github.com/omar2535
50% minion, 50% LLM
Citation (CITATION.cff)
cff-version: 1.2.0 message: "If you use or reference this software, please cite it as below." authors: - family-names: "Tsai" given-names: "Omar" orcid: "https://orcid.org/0000-0002-6335-3335" - family-names: "Zhu" given-names: "Hao" - family-names: "Xiao" given-names: "Jianrui" - family-names: "Li" given-names: "Jianing" - family-names: "Cheung" given-names: "Neo" - family-names: "Huang" given-names: "Lejing" title: "GraphQLer" version: 2.2.3 date-released: 2024-11-03 url: "https://github.com/omar2535/GraphQLer"
GitHub Events
Total
- Create event: 33
- Issues event: 7
- Release event: 2
- Watch event: 19
- Delete event: 26
- Issue comment event: 9
- Push event: 125
- Pull request review comment event: 2
- Pull request review event: 6
- Gollum event: 1
- Pull request event: 54
- Fork event: 6
Last Year
- Create event: 33
- Issues event: 7
- Release event: 2
- Watch event: 19
- Delete event: 26
- Issue comment event: 9
- Push event: 125
- Pull request review comment event: 2
- Pull request review event: 6
- Gollum event: 1
- Pull request event: 54
- Fork event: 6
Committers
Last synced: 9 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Omar2535 | o****5@a****a | 403 |
| dependabot[bot] | 4****] | 19 |
| HaoChuh | c****y@o****m | 15 |
| xiaojianrui | 1****2@q****m | 3 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 22
- Total pull requests: 122
- Average time to close issues: 5 months
- Average time to close pull requests: 6 days
- Total issue authors: 2
- Total pull request authors: 5
- Average comments per issue: 0.41
- Average comments per pull request: 0.32
- Merged pull requests: 87
- Bot issues: 0
- Bot pull requests: 52
Past Year
- Issues: 7
- Pull requests: 41
- Average time to close issues: 14 days
- Average time to close pull requests: 9 days
- Issue authors: 2
- Pull request authors: 3
- Average comments per issue: 0.29
- Average comments per pull request: 0.2
- Merged pull requests: 24
- Bot issues: 0
- Bot pull requests: 22
Top Authors
Issue Authors
- omar2535 (25)
- denini08 (1)
- dependabot[bot] (1)
Pull Request Authors
- dependabot[bot] (86)
- omar2535 (83)
- hao2hu (10)
- jianruixiao (3)
- denini08 (1)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- PyYAML ==6.0
- astroid ==2.9.0
- attrs ==21.2.0
- autopep8 ==1.6.0
- backports.entry-points-selectable ==1.1.1
- black ==21.11b1
- certifi ==2021.10.8
- cfgv ==3.3.1
- charset-normalizer ==2.0.7
- click ==8.0.3
- colorama ==0.4.4
- coverage ==6.2
- distlib ==0.3.3
- docopt ==0.6.2
- filelock ==3.4.0
- flake8 ==4.0.1
- identify ==2.4.0
- idna ==3.3
- importlib-metadata ==4.8.2
- iniconfig ==1.1.1
- isort ==5.10.1
- lazy-object-proxy ==1.6.0
- mccabe ==0.6.1
- mypy-extensions ==0.4.3
- networkx ==2.6.3
- nodeenv ==1.6.0
- num2words ==0.5.10
- packaging ==21.3
- pathspec ==0.9.0
- platformdirs ==2.4.0
- pluggy ==1.0.0
- pre-commit ==2.15.0
- py ==1.11.0
- pycodestyle ==2.8.0
- pyflakes ==2.4.0
- pylint ==2.12.1
- pyparsing ==3.0.6
- pytest ==6.2.5
- pytest-cov ==3.0.0
- regex ==2021.11.10
- requests ==2.26.0
- six ==1.16.0
- toml ==0.10.2
- tomli ==1.2.2
- typed-ast ==1.5.0
- typing-extensions ==4.0.0
- urllib3 ==1.26.7
- virtualenv ==20.10.0
- wrapt ==1.13.3
- zipp ==3.6.0
- actions/checkout v2 composite
- actions/setup-python v2 composite
- paambaati/codeclimate-action v3.0.0 composite
- actions/checkout master composite
- actions/setup-python v1 composite
- suo/flake8-github-action releases/v1 composite
- actions/checkout v2 composite
- actions/setup-python v2 composite
- zcong1993/setup-timezone master composite