CVE-2024-56374: Denial-of-service vulnerability in IPv6 validation
Django's IPv6 validation functions lacked an upper bound on input length, allowing an attacker to cause a denial-of-service by submitting extremely long strings. The vulnerable code included private functions and the GenericIPAddressField form field.
- Fixed in 3 months
- Paid in 3 months
- Disclosed after 4 months
Hi IBB Team, :)
I discovered a vulnerability in Django related to IPv6 validation that could potentially lead to a denial-of-service attack. You can find the details of my report and the assigned (CVE-2024-42005) at the following links:
- https://www.djangoproject.com/weblog/2025/jan/14/security-releases/
- https://github.com/django/django/commit/ca2be7724e1244a4cb723de40a070f873c6e94bf#diff-dde021d7427efcb4de60b971a1dbcafb0aa3732f263572be835a311d8be20d96R10
Impact
Lack of upper bound limit enforcement in strings passed when performing IPv6 validation could lead to a potential denial-of-service attack. The undocumented and private functions clean_ipv6_address and is_valid_ipv6_address were vulnerable, as was the django.forms.GenericIPAddressField form field, which has now been updated to define a max_length of 39 characters.
What the report shows
The target is Django, reported through the Internet Bug Bounty programme on HackerOne. The researcher, sav_, found a denial-of-service issue in Django's IPv6 validation and the report was disclosed on 27 May 2025 with a medium severity rating, a CVSS score of 4.5 and a bounty of 2,162.00 USD.
The researcher describes the finding as a lack of an upper bound on the length of strings passed into IPv6 validation. The affected code is the private, undocumented functions clean_ipv6_address and is_valid_ipv6_address, together with the django.forms.GenericIPAddressField form field that reaches them. Because no maximum length was enforced, an attacker could supply very long input to the validator.
The report points to the Django security release announcement of 14 January 2025 and to the fixing commit for the details:
https://www.djangoproject.com/weblog/2025/jan/14/security-releases/
https://github.com/django/django/commit/[redacted]#diff-[redacted]
The fix described in the report is that django.forms.GenericIPAddressField now defines a max_length of 39 characters, which is the longest textual form of an IPv6 address. The report does not include a request, payload or reproduction script, and it does not give timing figures or a measured resource cost.
One detail to note: the report body refers to the issue as CVE-2024-42005, while the title of the disclosed report is CVE-2024-56374. The report does not explain the discrepancy.
Root cause
The mistake is the absence of an input length limit before validation. Without a bound on the field, a caller can hand the validator a string far longer than any legitimate address, and the cost of rejecting it is paid by the server.
Impact
The report frames the impact as a potential denial-of-service attack: the report frames the impact as a potential denial-of-service attack. The report uses hedged language ("could potentially lead to") and gives no measurement of how much load is needed.
How this kind of bug works
Validation routines are usually written to answer a yes/no question about a value, not to defend against adversarial input size. When a parser or validator processes a string in a loop, or builds intermediate structures per character, its running time grows with the length of the input. If the application accepts arbitrarily long values and runs that code before any length check, an attacker controls how much CPU and memory each request consumes.
The bug class is algorithmic complexity: the cost of handling one request is unbounded from the attacker's point of view. It differs from a classic flood because a modest number of requests, each carrying a large value, can be enough. The usual defences are a hard maximum length on every field that reaches a parser, rejection of oversized input before parsing begins, and request body limits at the reverse proxy or framework level.
How to test for it
- Identify every input that is validated rather than merely stored: IP address fields, hostname fields, URL fields, date and duration parsers, email validators, and any custom validator that loops over characters.
- Send a normal, valid value first and confirm the endpoint behaves as expected, so you have a baseline.
- Send the same field with a value far longer than any legitimate input, for example a valid address followed by a large run of padding characters, and compare response time and server behaviour with the baseline.
- Increase the length gradually and watch for response time that grows with input size rather than staying flat. A positive result is a clear, repeatable increase in processing time or memory use tied to input length, ideally visible in server logs or monitoring.
- Check whether the framework or proxy rejects the oversized body before it reaches the validator; if it does, the finding is not exploitable through that path.
Common false positives are network jitter, a single slow response caused by caching or cold start, and limits applied elsewhere in the stack that the tester did not notice. Repeat measurements, use several lengths, and confirm the delay disappears when the input is short.
How it is fixed
The standard fix is to bound the input before validation: set a maximum length on the form field or model field, and reject values above it early. The report says GenericIPAddressField has now been updated to define a max_length of 39 characters.
Hunting notes
This class of bug tends to hide in framework internals rather than application code: form fields, serialisers, URL and IP parsers, and validation helpers that are reused across many projects. Recon signals include public security advisories for a framework version, changelogs mentioning length limits, and fields whose documentation does not state a maximum size.
What happened, in plain words
Django is a popular toolkit for building websites with the Python programming language. Many sites use it to handle forms, the boxes where you type things like your name, your email address or an IP address. An IP address is the number that identifies a device on a network, a bit like a postal address for a computer.
The researcher, sav_, reported this issue through the Internet Bug Bounty programme on HackerOne, a platform where people report security problems and companies pay for them. The report was disclosed on 27 May 2025 with a medium severity rating, a CVSS score of 4.5 and a bounty of 2,162.00 USD. CVSS is a standard scoring system: 4.5 out of 10 sits in the middle, serious enough to fix but not an emergency.
The problem is a denial-of-service (DoS) issue. A denial of service does not steal data; it makes a service unavailable, like blocking a shop door so customers cannot get in. Here, the trigger is a missing limit on how long a piece of text can be before Django checks whether it is a valid IPv6 address. IPv6 is the newer version of the addressing system the internet uses, and its addresses are written as long strings of letters and numbers.
The affected code is two private, undocumented functions, clean_ipv6_address and is_valid_ipv6_address, together with the django.forms.GenericIPAddressField form field that reaches them. A form field is the part of a website that accepts and checks one value from a visitor. Because no maximum length was enforced, an attacker could supply very long input to the validator.
The report points to the Django security release announcement of 14 January 2025 and to the fixing commit for the details:
https://www.djangoproject.com/weblog/2025/jan/14/security-releases/
https://github.com/django/django/commit/[redacted]#diff-[redacted]
A commit is a saved change in a code repository, the shared folder where developers keep and track their work. The first link is the announcement of the security release; the second is a commit in the Django repository.
The fix described in the report is that django.forms.GenericIPAddressField now defines a max_length of 39 characters, which is the longest textual form of an IPv6 address. In other words, the field now defines a maximum length of 39 characters.
The report does not include a request, payload or reproduction script, and it does not give timing figures or a measured resource cost. One detail to note: the report body refers to the issue as CVE-2024-42005, while the title of the disclosed report is CVE-2024-56374. A CVE is a public identifier given to a known security flaw so people can track it. The report does not explain the discrepancy.
In general, how this kind of bug works
Validation routines are usually written to answer a yes/no question about a value, not to defend against adversarial input size. Think of a bouncer checking tickets: if the queue is normal, checking is quick, but if someone hands over a ticket the size of a bedsheet, the bouncer still has to read all of it. When a parser or validator processes a string in a loop, or builds intermediate structures per character, its running time grows with the length of the input. If the application accepts arbitrarily long values and runs that code before any length check, an attacker controls how much CPU and memory each request consumes.
The bug class is algorithmic complexity: the cost of handling one request is unbounded from the attacker's point of view. It differs from a classic flood because a modest number of requests, each carrying a large value, can be enough. The usual defences are a hard maximum length on every field that reaches a parser, rejection of oversized input before parsing begins, and request body limits at the reverse proxy or framework level. A reverse proxy is the server that sits in front of the application and forwards visitors' requests to it.
In general, how to test for it
- Identify every input that is validated rather than merely stored: IP address fields, hostname fields, URL fields, date and duration parsers, email validators, and any custom validator that loops over characters.
- Send a normal, valid value first and confirm the endpoint behaves as expected, so you have a baseline. A baseline is the normal result you compare everything else against.
- Send the same field with a value far longer than any legitimate input, for example a valid address followed by a large run of padding characters, and compare response time and server behaviour with the baseline.
- Increase the length gradually and watch for response time that grows with input size rather than staying flat. A positive result is a clear, repeatable increase in processing time or memory use tied to input length, ideally visible in server logs or monitoring.
- Check whether the framework or proxy rejects the oversized body before it reaches the validator; if it does, the finding is not exploitable through that path.
Common false positives are network jitter, a single slow response caused by caching or cold start, and limits applied elsewhere in the stack that the tester did not notice. A false positive is a result that looks like a bug but is not one. Repeat measurements, use several lengths, and confirm the delay disappears when the input is short.
In general, how it is fixed
The standard fix is to bound the input before validation: set a maximum length on the form field or model field, and reject values above it early. The report says GenericIPAddressField has now been updated to define a max_length of 39 characters. Defence in depth means layering several protections so one failure does not open everything.
In general, where to look
This class of bug tends to hide in framework internals rather than application code: form fields, serialisers, URL and IP parsers, and validation helpers that are reused across many projects. Recon signals include public security advisories for a framework version, changelogs mentioning length limits, and fields whose documentation does not state a maximum size.
Glossary
- Django: a toolkit for building websites in the Python programming language.
- IPv6: the newer version of the internet's addressing system, with long addresses written as letters and numbers.
- IP address: the number that identifies a device on a network.
- Denial of service (DoS): making a service unavailable to its normal users.
- Form field: the part of a website that accepts and checks one value from a visitor.
- Validator: code that checks whether a value is acceptable.
- Parser: code that reads a string and works out its structure.
- Algorithmic complexity: a bug where the work done grows with the size of the attacker's input.
- Commit: a saved change in a code repository.
- CVE: a public identifier for a known security flaw.
- CVSS: a standard scoring system for the severity of a security flaw, from 0 to 10.
- Bounty: a payment made for a valid security report.
- Reverse proxy: a server in front of the application that forwards requests to it.
- Rate limiting: restricting how many requests a client may make in a period of time.
- Baseline: the normal result you compare later measurements against.
- False positive: a result that looks like a bug but is not one.
- Defence in depth: layering several protections so one failure does not open everything.