Skip to content
KitploitKITPLOIT
ToolsBlog
Submit
ToolsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

··Feeds·Contact·Privacy·© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
django-xss-example — This repo reproduce xss attack on django 4.0.1 (see CVE-2022-22818) | Kitploit
Tools/GitHubGitHub/prikalel/django-xss-example
Vulnerability AnalysisWeb Application ExploitationWeb SecurityFuzzingLearning & Education
GitHubprikalel/django-xss-example

django-xss-example

This repo reproduce xss attack on django 4.0.1 (see CVE-2022-22818)

View Repository
323 years agoNot yet reviewed

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share

Local Testing

Works only on Linux. On Windows, one of the dependencies may cause an error.

Before running, you need to install the following packages:

root@kitploit:~
pip install -r requirements.txt

Make sure the packages are installed

root@kitploit:~
python -m django --version  # pip install django==4.0.1
grammarinator-generate --version  # pip install git+https://github.com/renatahodovan/grammarinator.git#egg=grammarinator

Prepare the fuzzer

root@kitploit:~
touch grammars/fuzzer/HTMLGenerator.py  # Create an empty file to be filled by the generator
grammarinator-process grammars/HTMLLexer.g4 grammars/HTMLParser.g4 -o grammars/fuzzer  # Fill the file

Run the fuzzer

root@kitploit:~
python runfuzz.py

Error

You need to patch one file from Django, because it can cause a template engine error, which will stop the fuzzing process:

root@kitploit:~
--- /home/alex/.local/lib/python3.9/site-packages/django/template/defaultfilters.py     2023-04-26 12:47:44.387239988 +0300
+++ /home/alex/.local/lib/python3.9/site-packages/django/template/defaultfilters-fixed.py       2023-04-26 12:47:33.931039539 +0300
@@ -613,7 +613,10 @@
 @register.filter(is_safe=True)
 def random(value):
     """Return a random item from the list."""
-    return random_module.choice(value)
+    try:
+        return random_module.choice(value)
+    except IndexError:
+        return ''
 
 
 @register.filter("slice", is_safe=True)

If you are using venv, the path might be: venv/lib/python3.9/site-packages/django/template/defaultfilters.py

If you installed packages system-wide, the path: $HOME/.local/lib/python3.9/site-packages/django/template/defaultfilters.py

You need to go inside the file, find the definition of the random tag, and wrap it in a try-catch block.

If you don't do this, the fuzzer will terminate when it encounters this bug.

Benchmark

Required tests count to find a bug

BugPlain fuzzerFixed weights modeCooldown 0.5
debug2020
join-escape-filter1000+560/3520(88s)/40/740(28s)/1800(51s)20/900/220/760(530s)
Download Tool