CVE-2019-12387: Twisted Twisted CRLF Injection Vulnerability

MODERATE
Advisory Identifier: GHSA-6cc5-2vg4-cc7m
CVSS 6.1
CWE-74 CWE-93
Published
Advisory Summary

CVE-2019-12387 is a MODERATE (CVSS 6.1) twisted crlf injection vulnerability (CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')) affecting Twisted libraries in the PyPI ecosystem. The issue involves twisted crlf injection. Remediation is available by upgrading affected packages to version 19.2.1.

CVE-2019-12387 at a Glance

CVE Identifier CVE-2019-12387
GHSA Identifier GHSA-6cc5-2vg4-cc7m
Severity MODERATE
CVSS v3.1 Base Score 6.1
CWE Classification CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
Affected Product Twisted
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 6.1

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability None (A:N)

How to Fix CVE-2019-12387

To remediate this vulnerability, upgrade all affected Twisted dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

twisted fixed: 19.2.1
pip install twisted>=19.2.1
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show twisted

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2019-12387, inspect your installed packages using pip:

pip show twisted

Analyze the terminal output to locate any version of Twisted in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 19.2.1), your application is affected.

Note: The pip show twisted command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection'), where the product constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component. In Twisted, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

In Twisted before 19.2.1, twisted.web did not validate or sanitize URIs or HTTP methods, allowing an attacker to inject invalid characters such as CRLF.

CVE-2019-12387 Affected Twisted Versions

1 component(s)
Fixed Versions:
19.2.1
Product / Package Ecosystem Affected Versions Fixed Version
twisted
PyPI
< 19.2.1
19.2.1

References

Frequently Asked Questions

What is CVE-2019-12387?
CVE-2019-12387 is a security vulnerability in Twisted involving Twisted CRLF Injection under CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection').
Which Twisted versions are affected?
Affected versions include releases prior to 19.2.1 across affected packages: twisted.
What version fixes CVE-2019-12387?
Upgrading to 19.2.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is twisted affected?
Yes, twisted is affected in releases prior to 19.2.1. Upgrade your dependency to 19.2.1 or later.
What is the CVSS score of CVE-2019-12387?
CVE-2019-12387 has a CVSS v3.1 base score of 6.1 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N.
What CWE is associated with CVE-2019-12387?
CVE-2019-12387 is classified under CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection') (The product constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component.).
How can I check PyPI dependencies for CVE-2019-12387?
Run the dependency tree command: 'pip show twisted'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-6cc5-2vg4-cc7m",
  "modified" : "2024-11-25T18:33:21Z",
  "published" : "2019-06-10T18:05:06Z",
  "aliases" : [ "CVE-2019-12387" ],
  "summary" : "Twisted CRLF Injection",
  "details" : "In Twisted before 19.2.1, twisted.web did not validate or sanitize URIs or HTTP methods, allowing an attacker to inject invalid characters such as CRLF.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "twisted"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "19.2.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2019-12387"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/twisted/twisted/commit/6c61fc4503ae39ab8ecee52d10f10ee2c371d7e2"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-6cc5-2vg4-cc7m"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/twisted/PYSEC-2019-128.yaml"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/twisted/twisted"
  }, {
    "type" : "WEB",
    "url" : "https://labs.twistedmatrix.com/2019/06/twisted-1921-released.html"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/2G5RPDQ4BNB336HL6WW5ZJ344MAWNN7N"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/2G5RPDQ4BNB336HL6WW5ZJ344MAWNN7N"
  }, {
    "type" : "WEB",
    "url" : "https://twistedmatrix.com/pipermail/twisted-python/2019-June/032352.html"
  }, {
    "type" : "WEB",
    "url" : "https://usn.ubuntu.com/4308-1"
  }, {
    "type" : "WEB",
    "url" : "https://usn.ubuntu.com/4308-2"
  }, {
    "type" : "WEB",
    "url" : "https://www.oracle.com/security-alerts/cpuapr2020.html"
  }, {
    "type" : "WEB",
    "url" : "http://lists.opensuse.org/opensuse-security-announce/2019-07/msg00030.html"
  }, {
    "type" : "WEB",
    "url" : "http://lists.opensuse.org/opensuse-security-announce/2019-07/msg00042.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-74", "CWE-93" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2019-06-10T18:04:12Z",
    "nvd_published_at" : "2019-06-10T12:29:00Z"
  }
}