{"id":"CVE-2026-53539","aliases":["CVE-2026-53539","GHSA-5rvq-cxj2-64vf","PYSEC-2026-3036"],"related":[],"kind":"vulnerability","state":"published","title":"Python-Multipart: Quadratic-time querystring parsing with semicolon separators causes CPU denial of service","summary":"Python-Multipart is a streaming multipart parser for Python. Prior to 0.0.30, when parsing application/x-www-form-urlencoded bodies, QuerystringParser located the field separator with a two step lookup: it first scanned the entire remaining buffer for &, and only when no & existed anywhere ahead did it fall back to scanning for ;. For a body that uses ; as the separator and contains no &, every field iteration performed a full failed & scan over the entire remaining buffer before locating the nearby ;. With N semicolon separated fields in a chunk of size B, this yields O(B^2) byte comparisons per chunk. An attacker can submit a small crafted body of the form a;a;a;... and cause the parser to spend seconds of CPU per request. A handful of concurrent requests can exhaust worker processes. This vulnerability is fixed in 0.0.30.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Python-Multipart is a streaming multipart parser for Python. Prior to 0.0.30, when parsing application/x-www-form-urlencoded bodies, QuerystringParser located the field separator with a two step lookup: it first scanned the entire remaining buffer for &, and only when no & existed anywhere ahead did it fall back to scanning for ;. For a body that uses ; as the separator and contains no &, every field iteration performed a full failed & scan over the entire remaining buffer before locating the nearby ;. With N semicolon separated fields in a chunk of size B, this yields O(B^2) byte comparisons per chunk. An attacker can submit a small crafted body of the form a;a;a;... and cause the parser to spend seconds of CPU per request. A handful of concurrent requests can exhaust worker processes. This vulnerability is fixed in 0.0.30.","source":"cvelist"},{"lang":"en","text":"### Summary\n\nWhen parsing `application/x-www-form-urlencoded` bodies, `QuerystringParser` located the field separator with a two step lookup: it first scanned the entire remaining buffer for `&`, and only when no `&` existed anywhere ahead did it fall back to scanning for `;`. For a body that uses `;` as the separator and contains no `&`, every field iteration performed a full failed `&` scan over the entire remaining buffer before locating the nearby `;`. With N semicolon separated fields in a chunk of size B, this yields O(B^2) byte comparisons per chunk.\n\nAn attacker can submit a small crafted body of the form `a;a;a;...` and cause the parser to spend seconds of CPU per request. A handful of concurrent requests can exhaust worker processes.\n\n### Details\n\nIn `python_multipart/multipart.py`, both the `FIELD_NAME` and `FIELD_DATA` states located the next separator like this:\n\n```python\nsep_pos = data.find(b\"&\", i)\nif sep_pos == -1:\n    sep_pos = data.find(b\";\", i)\n```\n\n`data.find(b\"&\", i)` scans from `i` to the end of the buffer and returns `-1` only when there is no `&` anywhere in the remainder. For a `;` separated body with no `&`, this failed full buffer scan repeats once per field, making parsing quadratic in the body length.\n\nFor example, a 1 MiB url encoded body consisting of `a;` repeated ~500,000 times, submitted with `Content-Type: application/x-www-form-urlencoded`, causes the parser to perform on the order of 10^11 byte comparisons, consuming several seconds of CPU for a single request. Cost scales quadratically with chunk size.\n\nThe parser is reachable through the public `QuerystringParser` class and through the high level `FormParser`, `create_form_parser`, and `parse_form` APIs for url encoded bodies. It is also the parser Starlette and FastAPI use for `application/x-www-form-urlencoded` request bodies via `request.form()`.\n\n### Impact\n\nUncontrolled CPU consumption (denial of service). Parsing is synchronous, so a single small crafted form body occupies the handling worker for seconds, blocking any other work on that worker until parsing finishes. Sustained concurrent requests keep workers continuously busy, degrading or denying service.\n\n### Mitigation\n\nUpgrade to `python-multipart` `0.0.30` or later, which treats only `&` as a field separator (per the [WHATWG URL standard](https://url.spec.whatwg.org/#urlencoded-parsing)) using a single bounded scan, making parsing linear in the body length.","format":"markdown","source":"ghsa"},{"lang":"es","text":"Python-Multipart es un analizador multipart de streaming para Python. Antes de la versión 0.0.30, al analizar cuerpos application/x-www-form-urlencoded, QuerystringParser localizaba el separador de campo con una búsqueda en dos pasos: primero escaneaba todo el búfer restante en busca de &, y solo cuando no existía ningún & más adelante, recurría a escanear en busca de ;. Para un cuerpo que usa ; como separador y no contiene ningún &, cada iteración de campo realizaba un escaneo completo fallido de & sobre todo el búfer restante antes de localizar el ; cercano. Con N campos separados por punto y coma en un fragmento de tamaño B, esto produce O(B^2) comparaciones de bytes por fragmento. Un atacante puede enviar un cuerpo pequeño y manipulado de la forma a;a;a;... y hacer que el analizador gaste segundos de CPU por solicitud. Un puñado de solicitudes concurrentes puede agotar los procesos de trabajo. Esta vulnerabilidad está corregida en la versión 0.0.30.","source":"nvd"}],"published":"2026-06-15T20:24:09.000Z","modified":"2026-10-25T23:10:00.167Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"},{"scorer":"PyPA Advisory Database","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"}],"cwes":["CWE-400","CWE-407"],"affected":[{"ranges":[{"version":"< 0.0.30","status":"affected"}],"vendor":"Kludex","product":"python-multipart","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"0.0.30"}],"ecosystem":"PyPI","package":"python-multipart","purl":"pkg:pypi/python-multipart","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"0.0.30"}],"vendor":"fastapiexpert","product":"python-multipart","cpe":"cpe:2.3:a:fastapiexpert:python-multipart:*:*:*:*:*:python:*:*","source":"nvd"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"0.0.30"}],"ecosystem":"PyPI","package":"python-multipart","purl":"pkg:pypi/python-multipart","source":"pysec"}],"references":[{"url":"https://github.com/Kludex/python-multipart/security/advisories/GHSA-5rvq-cxj2-64vf","tags":["vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/Kludex/python-multipart","tags":["package"],"sources":["ghsa","pysec"]},{"url":"https://pypi.org/project/python-multipart","tags":["package"],"sources":["pysec"]},{"url":"https://github.com/advisories/GHSA-5rvq-cxj2-64vf","tags":["advisory"],"sources":["pysec"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-53539","tags":["advisory"],"sources":["pysec"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"yes","technicalImpact":"partial","date":"2026-06-23T14:05:50.901Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-53539","url":"https://www.cve.org/CVERecord?id=CVE-2026-53539","licence":"CVE Terms of Use","modified":"2026-06-23T16:08:36.474Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-5rvq-cxj2-64vf","url":"https://github.com/advisories/GHSA-5rvq-cxj2-64vf","licence":"CC-BY-4.0","modified":"2026-09-10T03:50:48.426Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-53539","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-53539","licence":"Public domain","modified":"2026-10-25T23:10:00.167Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2026-3036","url":"https://osv.dev/vulnerability/PYSEC-2026-3036","licence":"CC-BY-4.0","modified":"2026-07-13T16:33:29.036Z"}],"updatedAt":"2026-11-25T22:59:25.390Z","epss":{"score":0.00388,"percentile":0.35083,"date":"2026-12-01T12:00:22.000Z"}}