{"answers":{"affected":"3 open source packages ship an affected version, including black.","exploited":"It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-21503 exists.","fix":"Upgrade black to 24.3.0 or later.","what":"CVE-2024-21503 is a medium-severity denial of service vulnerability in black, published on 19 Mar 2024. An attacker can exploit it over the internet without logging in, with no action from the victim."},"fix_prompt":"Check this codebase for CVE-2024-21503 and fix it if it is affected.\n\nWhat it is: CVE-2024-21503 is a medium-severity denial of service vulnerability in black, published on 19 Mar 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.\nExploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-21503 exists.\n\nAffected packages and fixed versions:\n- black (PyPI): affected all versions; fixed in 24.3.0\n- black (PyPI): affected all versions; fixed in 24.3.0\n- black (PyPI): affected all versions; fixed in 24.3.0\n\nTask:\n1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.\n2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.\n3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.\n4. Run the tests and summarise what changed and why.\n5. If nothing in the project is affected, say so and change nothing.\n\nReference: https://insights.sbomify.com/CVE-2024-21503/ (Markdown: https://insights.sbomify.com/CVE-2024-21503/index.md)","id":"CVE-2024-21503","markdown":"https://insights.sbomify.com/CVE-2024-21503/index.md","name":"CVE-2024-21503","record":{"aliases":["CLEANSTART-2024-EN29810","DEBIAN-CVE-2024-21503","GHSA-fj7x-q9j7-g6q6","PYSEC-2024-48","ROOT-APP-PYPI-CVE-2024-21503","SUSE-SU-2024:2481-1","UBUNTU-CVE-2024-21503","openSUSE-SU-2024:13783-1","openSUSE-SU-2026:12001-1"],"analysis":{"component_type":"library","fix_type":"upgrade","impacts":["denial_of_service"],"network_reachable":"yes","non_default_config":false,"product_category":"Python code formatter","requires_auth":"none","summary":"An attacker can cause a denial of service in the Black Python formatter by providing input with excessive leading tabs, triggering a regular expression vulnerability.","user_interaction":"not_required","vuln_class":"denial_of_service"},"analysis_generated_by":"qwen3.8-flash-next","assigner":"snyk","cpe":[],"cvss":{"score":5.3,"severity":"medium","source":"cna","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L/E:P","version":"3.1"},"cwes":[{"id":"CWE-75","name":"Failure to Sanitize Special Elements into a Different Plane"},{"id":"CWE-1333","name":"Inefficient Regular Expression Complexity"}],"description":"Versions of the package black before 24.3.0 are vulnerable to Regular Expression Denial of Service (ReDoS) via the lines_with_leading_tabs_expanded function in the strings.py file. An attacker could exploit this vulnerability by crafting a malicious input that causes a denial of service.\r\rExploiting this vulnerability is possible when running Black on untrusted input, or if you habitually put thousands of leading tab characters in your docstrings.","ecosystems":["PyPI","openSUSE:Leap 15.6","openSUSE:Tumbleweed"],"exploits":{"exploitdb":0,"first_seen":null,"github_poc":0,"max_poc_stars":null,"metasploit":0,"nuclei":0,"refs":[],"tier":"weaponised"},"has_fix":true,"headline":"Black vulnerable to Regular Expression Denial of Service (ReDoS)","id":"CVE-2024-21503","indexable":true,"kev":null,"kind":"cve","links":{"ecosystem":"PyPI","product":null,"products":[],"type":"denial_of_service","year":"2024"},"n_packages":5,"n_references":3,"next":{"headline":"Cross-site Scripting in livewire/livewire","id":"CVE-2024-21504"},"packages":[{"ecosystem":"PyPI","fixed":["24.3.0"],"introduced":["0"],"last_affected":[],"package":"black","purl":null,"source":"GHSA-fj7x-q9j7-g6q6"},{"ecosystem":"PyPI","fixed":["24.3.0"],"introduced":["0"],"last_affected":[],"package":"black","purl":"pkg:pypi/black","source":"GHSA-fj7x-q9j7-g6q6"},{"ecosystem":"PyPI","fixed":["24.3.0"],"introduced":["0"],"last_affected":[],"package":"black","purl":"pkg:pypi/black","source":"PYSEC-2024-48"},{"ecosystem":"openSUSE:Leap 15.6","fixed":["24.3.0-150400.9.8.1"],"introduced":["0"],"last_affected":[],"package":"python-black","purl":"pkg:rpm/opensuse/python-black\u0026distro=openSUSE%20Leap%2015.6","source":"SUSE-SU-2024:2481-1"},{"ecosystem":"openSUSE:Tumbleweed","fixed":["26.5.1-1.3"],"introduced":["0"],"last_affected":[],"package":"python-black","purl":"pkg:rpm/opensuse/python-black\u0026distro=openSUSE%20Tumbleweed","source":"openSUSE-SU-2026:12001-1"}],"prev":{"headline":"Uninitialized Variable in fastecdsa","id":"CVE-2024-21502"},"products":["black"],"published":"2024-03-19","related":[],"sources":[{"class":"attribution","licence":"CVE Terms of Use (MITRE)","name":"CVE List","prefix":"CVE"},{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"},{"class":"attribution","licence":"CC BY 4.0","name":"PyPA Advisory Database","prefix":"PYSEC"},{"class":"attribution","licence":"CC BY 4.0","name":"SUSE","prefix":"SUSE"},{"class":"attribution","licence":"CC BY 4.0","name":"SUSE","prefix":"openSUSE"},{"class":"attribution","licence":"CWE Terms of Use","name":"CWE (MITRE)"},{"class":"attribution","licence":"FIRST CVSS licence","name":"CVSS (FIRST)"}],"ssvc":{"automatable":"yes","exploitation":"poc","technical_impact":"partial"},"state":"PUBLISHED","updated":"2024-08-01","vendors":["n/a"]},"summary":"An attacker can cause a denial of service in the Black Python formatter by providing input with excessive leading tabs, triggering a regular expression vulnerability.","url":"https://insights.sbomify.com/CVE-2024-21503/"}