CVE-2023-46695: Potential denial of service vulnerability in UsernameField on Windows
Django's UsernameField performed slow NFKC normalization on Windows for very long invalid Unicode inputs, allowing an attacker to cause denial of service by sending many such requests. A single request took seconds and concurrent requests led to gateway timeouts.
Originally disclosed on HackerOne
- Triaged in 40 hours
- Fixed in 9 days
- Paid in 9 days
- Disclosed after 9 days
Summary by the program
CVE-2023-46695: Potential denial of service vulnerability in UsernameField on Windows The NFKC normalization is slow on Windows. As a consequence, django.contrib.auth.forms.UsernameField was subject to a potential denial of service attack via certain inputs with a very large number of Unicode characters.
In order to avoid the vulnerability, invalid values longer than UsernameField.max_length are no longer normalized, since they cannot pass validation anyway.
Thanks MProgrammer for the report.
This issue has severity "moderate" according to the Django security policy.
Full Security Advisory: https://www.djangoproject.com/weblog/2023/nov/01/security-releases/
The report
In Django versions before 4.2.7, 4.1.13, and 3.2.23, I sent a POST request to the admin login page using Burp Suite, editing the request to send over 1 million invalid unicode characters to my local web server running Django. (I used: "¾") After submitting, a single request took 4.4 seconds on average. When I sent 20 concurrent requests, then I got 60 second wait times, and 504 gateway timeout errors on my machine.

Normal ascii characters don't do this and the page loads instantly.
Impact
Denial of Service anywhere a form contains a UsernameField that checks for errors.
Context
Django ships an authentication form field, django.contrib.auth.forms.UsernameField, which is used wherever a form accepts a username, including the admin login page. Before validating a submitted value, the field normalises it with NFKC normalisation. On Windows that normalisation is slow, and the slowness grows with the size of the input. The report describes how a very large number of Unicode characters in the username field turns that slowness into a denial of service.
The issue is tracked as CVE-2023-46695 and was reported through the Internet Bug Bounty program against the Django project. The program rates it medium severity, and the Django security policy calls it "moderate". A bounty of 2540.00 USD was paid, and the report was disclosed on 2023-11-29.
Setup
The researcher tested against a local web server running Django, in versions before 4.2.7, 4.1.13 and 3.2.23. The tool used to craft and send the request was Burp Suite. The target feature was the admin login page, which contains a UsernameField. No accounts, roles or special configuration are described beyond that.
Finding it
The report states that the username field performs NFKC normalisation on the submitted value, and that this operation is slow on Windows. Because the cost scales with the number of characters, an input made of a very large number of Unicode characters makes the server spend a long time normalising a single request. Ordinary ASCII input does not trigger the behaviour: with normal ASCII characters the page loads instantly.
Exploitation
Step 1: craft the login request
A POST request to the admin login page was captured in Burp Suite and edited so that the username field carried over one million invalid Unicode characters. The character used was:
Step 2: send a single request
With that payload, a single request took 4.4 seconds on average. The delay comes from the normalisation of the oversized username value before validation.
Step 3: send concurrent requests
Sending 20 concurrent requests produced 60 second wait times and 504 gateway timeout errors on the researcher's machine.

The screenshot shows the resulting 504 gateway timeout.
Root cause
The UsernameField normalises the submitted value with NFKC before validation. On Windows, NFKC normalisation is slow, and its cost grows with the length of the input, so a value containing a very large number of Unicode characters consumes a disproportionate amount of server time. The fix stops normalising invalid values longer than UsernameField.max_length, since they cannot pass validation anyway. The fix addresses exactly that ordering: invalid values longer than UsernameField.max_length are no longer normalised, since they cannot pass validation anyway.
Impact
A denial of service is possible anywhere a form contains a UsernameField that checks for errors. The attacker needs only to submit oversized Unicode input to such a form; the report's measurements show that a single request took 4.4 seconds on average, and that 20 concurrent requests produced 60 second wait times and 504 gateway timeout errors on the researcher's machine. The condition that makes this practical is a Django deployment on Windows, since the slowness of NFKC normalisation there is what the attack relies on.
Fix
Django changed the field so that invalid values longer than UsernameField.max_length are no longer normalised, because they cannot pass validation anyway. The report describes the affected versions as before 4.2.7, 4.1.13 and 3.2.23. and the full security advisory is at https://www.djangoproject.com/weblog/2023/nov/01/security-releases/.
Variants to test
- Other form fields that normalise input before validating it. Send a value far longer than the field's maximum length and watch for response times that grow with input size; a positive result is a request that takes noticeably longer than the same request with short ASCII input.
- Other Unicode-heavy inputs to the same username field. The report used
¾; any input with a very large number of Unicode characters is the pattern to try, and a positive result is the same multi-second delay per request. - Concurrency checks on any endpoint that shows the per-request delay. A positive result is rising wait times and 504 gateway timeout errors as concurrent requests are added, as seen with 20 concurrent requests in the report.
Hunting notes
This kind of bug hides in input handling that runs expensive processing before cheap validation, particularly Unicode normalisation, and particularly on Windows hosts. During recon, look for login and registration forms built on framework authentication fields, and for any endpoint that accepts free text and normalises it. The signal is a response time that scales with input length while short ASCII input stays fast. The researcher demonstrated impact by measuring the per-request delay (4.4 seconds on average) and then showing that 20 concurrent requests produced 60 second waits and 504 gateway timeout errors, which turned a slow code path into a demonstrable denial of service.
What happened, in plain words
A website built with Django, a popular toolkit for making web applications, has a login page. When you type a username and press submit, the server does some processing on what you typed before it decides whether the username is valid. On Windows servers, one part of that processing, called NFKC normalisation, is slow, and it gets slower the more characters you send.
The researcher found that by sending a username made of more than a million unusual Unicode characters, a single login attempt took 4.4 seconds on average. Sending 20 of these at the same time produced 60 second wait times and 504 gateway timeout errors on the researcher's machine. That is a denial of service: the attacker does not steal data or break in, they simply make the service unavailable to everyone else.
The problem was tracked as CVE-2023-46695, reported through the Internet Bug Bounty program against the Django project. The program rates it medium severity, and the Django security policy calls it "moderate". A bounty of 2540.00 USD was paid, and the report was disclosed on 2023-11-29.
Context
Django ships an authentication form field, django.contrib.auth.forms.UsernameField, which is used wherever a form accepts a username, including the admin login page. Before validating a submitted value, the field normalises it with NFKC normalisation. On Windows that normalisation is slow, and the slowness grows with the size of the input. The report describes how a very large number of Unicode characters in the username field turns that slowness into a denial of service.
A few terms first, because the rest of this article leans on them:
- Django is a framework: a collection of ready-made building blocks that developers use to build websites faster instead of writing everything from scratch. Think of it as a box of pre-built kitchen units rather than raw timber.
- A form field is one input box on a web page, such as the username box on a login screen. Django provides ready-made field types so developers do not have to build each one by hand.
UsernameFieldis Django's ready-made username field. Anywhere a Django site needs a username box, including the admin login page, it can use this same field.- Validation is the server checking whether what you submitted is acceptable: is it the right type, is it the right length, does it contain forbidden characters. If it fails validation, the form shows an error instead of accepting the input.
- Normalisation is rewriting text into a standard form so that two inputs that look the same are treated as the same. For example, some characters can be typed in more than one way but should count as identical. NFKC is one specific set of rules for doing this.
- Unicode is the standard that assigns a number to every character in every writing system, far beyond the basic English letters and digits. The character
¾is a Unicode character. - ASCII is the much smaller, older set of characters covering basic English letters, digits and punctuation. Normal English text is mostly ASCII.
- A denial of service (DoS) means making a service unavailable to its normal users, usually by making it do far more work than it can handle. It is not about stealing data; it is about stopping the service working.
- A CVE is a public identifier for a known security flaw, so that everyone can refer to the same issue unambiguously.
- A bounty is a payment a company or program makes to a researcher who reports a security problem responsibly.
The issue is tracked as CVE-2023-46695 and was reported through the Internet Bug Bounty program against the Django project.
Setup
The researcher tested against a local web server running Django, in versions before 4.2.7, 4.1.13 and 3.2.23. The tool used to craft and send the request was Burp Suite. The target feature was the admin login page, which contains a UsernameField. No accounts, roles or special configuration are described beyond that.
Some explanation of the setup:
- A local web server is a copy of the website running on the researcher's own computer rather than on the internet. This is the safe way to test: you can send hostile traffic without affecting real users.
- Burp Suite is a tool that sits between your browser and a website. It lets you capture a request the browser sends, pause it, edit it, and then forward it. Think of it as intercepting a letter, changing a word, and posting it on.
- A POST request is the way a browser sends data to a server, for example when you submit a login form. The data travels in the body of the request rather than in the address bar.
- The admin login page is the login screen for Django's built-in administration area, the place where site staff manage content.
Finding it
The report states that the username field performs NFKC normalisation on the submitted value, and that this operation is slow on Windows. Because the cost scales with the number of characters, an input made of a very large number of Unicode characters makes the server spend a long time normalising a single request. Ordinary ASCII input does not trigger the behaviour: with normal ASCII characters the page loads instantly.
The reasoning is worth spelling out. Normalisation has to look at every character and decide what it should become. On Windows, that per-character work is expensive. So if one character costs a tiny amount of time, a million characters cost a million times that amount. The fix stops normalising invalid values longer than UsernameField.max_length, since they cannot pass validation anyway.
Exploitation
Step 1: craft the login request
A POST request to the admin login page was captured in Burp Suite and edited so that the username field carried over one million invalid Unicode characters. The character used was:
What this step means: The researcher sent a POST request to the admin login page using Burp Suite, editing the request to carry the oversized username value. In Burp, the username value was then replaced with the character above, repeated over a million times. The character ¾ is a single Unicode character; repeating it produces a value that is far longer than any real username and is not a valid username anyway. The point is not that ¾ is special in itself, but that it is a Unicode character, and the server will normalise every copy of it.
Step 2: send a single request
With that payload, a single request took 4.4 seconds on average. The delay comes from the normalisation of the oversized username value before validation.
Why this matters: 4.4 seconds for one request is already a warning sign. A normal login request should come back in a fraction of a second. The report states that a single request took 4.4 seconds on average. It also shows the cost is caused by the input, because the same page with ordinary ASCII input loads instantly.
Step 3: send concurrent requests
Sending 20 concurrent requests produced 60 second wait times and 504 gateway timeout errors on the researcher's machine.

- Concurrent requests are requests sent at the same time rather than one after another. A web server has a limited capacity to work on things at once, like a shop with a fixed number of tills. If each customer takes 4.4 seconds, twenty customers arriving together create a queue.
- A 504 gateway timeout is an error a server or gateway returns when it waited too long for a response from the thing behind it and gave up. In everyday terms, it is the receptionist telling you the person you are waiting for did not pick up in time.
The screenshot shows the resulting 504 gateway timeout. The sequence is the heart of the finding: one slow request took 4.4 seconds on average, and 20 concurrent requests produced 60 second wait times and 504 gateway timeout errors.
Root cause
The UsernameField normalises the submitted value with NFKC before validation. On Windows, NFKC normalisation is slow, and its cost grows with the length of the input, so a value containing a very large number of Unicode characters consumes a disproportionate amount of server time. The fix addresses exactly that ordering: invalid values longer than UsernameField.max_length are no longer normalised, since they cannot pass validation anyway.
In plain terms, max_length is the rule that says a username may not be longer than some number of characters. You would expect that rule to stop an oversized input immediately. The fix simply swaps the order: if the value is too long to ever be valid, do not bother normalising it.
Impact
A denial of service is possible anywhere a form contains a UsernameField that checks for errors. The attacker needs only to submit oversized Unicode input to such a form; the report's measurements show that a single request took 4.4 seconds on average, and that 20 concurrent requests produced 60 second wait times and 504 gateway timeout errors on the researcher's machine. The condition that makes this practical is a Django deployment on Windows, since the slowness of NFKC normalisation there is what the attack relies on.
Two things make this serious despite its simplicity.
Fix
Django changed the field so that invalid values longer than UsernameField.max_length are no longer normalised, because they cannot pass validation anyway. The report describes the affected versions as before 4.2.7, 4.1.13 and 3.2.23. and the full security advisory is at https://www.djangoproject.com/weblog/2023/nov/01/security-releases/.
The advisory link above is the official notice from the Django project.
Variants to test
- Other form fields that normalise input before validating it. Send a value far longer than the field's maximum length and watch for response times that grow with input size; a positive result is a request that takes noticeably longer than the same request with short ASCII input.
- Other Unicode-heavy inputs to the same username field. The report used
¾; any input with a very large number of Unicode characters is the pattern to try, and a positive result is the same multi-second delay per request. - Concurrency checks on any endpoint that shows the per-request delay. A positive result is rising wait times and 504 gateway timeout errors as concurrent requests are added, as seen with 20 concurrent requests in the report.
Hunting notes
This kind of bug hides in input handling that runs expensive processing before cheap validation, particularly Unicode normalisation, and particularly on Windows hosts. During recon, look for login and registration forms built on framework authentication fields, and for any endpoint that accepts free text and normalises it. The signal is a response time that scales with input length while short ASCII input stays fast. The researcher demonstrated impact by measuring the per-request delay (4.4 seconds on average) and then showing that 20 concurrent requests produced 60 second waits and 504 gateway timeout errors, which turned a slow code path into a demonstrable denial of service.
Glossary
- Django: a framework, a collection of ready-made building blocks for building websites.
- Form field: one input box on a web page, such as a username box.
UsernameField: Django's ready-made username input field, used on login forms including the admin login page.- Validation: the server checking whether submitted input is acceptable before using it.
- Normalisation: rewriting text into a standard form so equivalent inputs are treated the same.
- NFKC normalisation: one specific set of normalisation rules; on Windows it is slow and its cost grows with input length.
- Unicode: the standard assigning a number to every character in every writing system.
- ASCII: the smaller, older character set covering basic English letters, digits and punctuation.
max_length: the rule limiting how many characters a field may contain.- Denial of service (DoS): making a service unavailable to its normal users by making it do more work than it can handle.
- CVE: a public identifier for a known security flaw.
- Bounty: a payment made to a researcher who reports a security problem responsibly.
- Local web server: a copy of a website running on the researcher's own computer for safe testing.
- Burp Suite: a tool that captures, pauses and edits requests between a browser and a website.
- POST request: the way a browser sends form data to a server, in the body of the request.
- Admin login page: the login screen for Django's built-in administration area.
- Concurrent requests: requests sent at the same time rather than one after another.
- 504 gateway timeout: an error returned when a server or gateway waited too long for a response and gave up.
- Recon: the early stage of testing where you look around a target to see what it is built from and which features it exposes.