CVE-2020-5227: Feedgen Denial of Service Vulnerability

MODERATE
Advisory Identifier: GHSA-g8q7-xv52-hf9f
CVSS 4.4
CWE-776
Published
Advisory Summary

CVE-2020-5227 is a MODERATE (CVSS 4.4) denial of service vulnerability (CWE-776: Improper Restriction of Recursive Entity References in DTDs ('XML Entity Expansion')) affecting Feedgen libraries in the PyPI ecosystem. The issue involves feedgen vulnerable to xml denial of service attacks. Remediation is available by upgrading affected packages to version 0.9.0.

CVE-2020-5227 at a Glance

CVE Identifier CVE-2020-5227
GHSA Identifier GHSA-g8q7-xv52-hf9f
Severity MODERATE
CVSS v3.1 Base Score 4.4
CWE Classification CWE-776: Improper Restriction of Recursive Entity References in DTDs ('XML Entity Expansion')
Affected Product Feedgen
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 4.4

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

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required High (PR:H)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2020-5227

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

feedgen fixed: 0.9.0
pip install feedgen>=0.9.0
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 feedgen

How to Check if You Are Affected

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

pip show feedgen

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

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

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-776: Improper Restriction of Recursive Entity References in DTDs ('XML Entity Expansion'), where the product uses xml documents and allows their structure to be defined with a document type definition (dtd), but it does not properly control the number of recursive definitions of entities. In Feedgen, 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

### Impact The *feedgen* library allows supplying XML as content for some of the available fields. This XML will be parsed and integrated into the existing XML tree. During this process, feedgen is vulnerable to [XML Denial of Service Attacks](https://docs.microsoft.com/en-us/archive/msdn-magazine/2009/november/xml-denial-of-service-attacks-and-defenses) (e.g. XML Bomb). This becomes a concern in particular if feedgen is used to include content from untrused sources and if XML (including XHTML) is directly included instead of providing plain tex content only. ### Patches This problem has been fixed in feedgen 0.9.0 which disallows XML entity expansion and external resources. ### Workarounds Updating is strongly recommended and should not be problematic. Nevertheless, as a workaround, avoid providing XML directly to feedgen or ensure that no entity expansion is part of the XML. ### References - [Security Briefs - XML Denial of Service Attacks and Defenses](https://docs.microsoft.com/en-us/archive/msdn-magazine/2009/november/xml-denial-of-service-attacks-and-defenses) - [Billion laughs attack](https://en.wikipedia.org/wiki/Billion_laughs_attack#cite_note-2) ### For more information If you have any questions or comments about this advisory: - Open an issue in [lkiesow/python-feedgen](https://github.com/lkiesow/python-feedgen/issues) - Send an email to security@lkiesow.de

CVE-2020-5227 Affected Feedgen Versions

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

References

Frequently Asked Questions

What is CVE-2020-5227?
CVE-2020-5227 is a security vulnerability in Feedgen involving Feedgen Vulnerable to XML Denial of Service Attacks under CWE-776: Improper Restriction of Recursive Entity References in DTDs ('XML Entity Expansion').
Which Feedgen versions are affected?
Affected versions include releases prior to 0.9.0 across affected packages: feedgen.
What version fixes CVE-2020-5227?
Upgrading to 0.9.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is feedgen affected?
Yes, feedgen is affected in releases prior to 0.9.0. Upgrade your dependency to 0.9.0 or later.
What is the CVSS score of CVE-2020-5227?
CVE-2020-5227 has a CVSS v3.1 base score of 4.4 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:H/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2020-5227?
CVE-2020-5227 is classified under CWE-776: Improper Restriction of Recursive Entity References in DTDs ('XML Entity Expansion') (The product uses XML documents and allows their structure to be defined with a Document Type Definition (DTD), but it does not properly control the number of recursive definitions of entities.).
How can I check PyPI dependencies for CVE-2020-5227?
Run the dependency tree command: 'pip show feedgen'. 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-g8q7-xv52-hf9f",
  "modified" : "2024-09-20T17:44:21Z",
  "published" : "2020-01-28T22:37:50Z",
  "aliases" : [ "CVE-2020-5227" ],
  "summary" : "Feedgen Vulnerable to XML Denial of Service Attacks",
  "details" : "### Impact\n\nThe *feedgen* library allows supplying XML as content for some of the available fields. This XML will be parsed and integrated into the existing XML tree. During this process, feedgen is vulnerable to [XML Denial of Service Attacks](https://docs.microsoft.com/en-us/archive/msdn-magazine/2009/november/xml-denial-of-service-attacks-and-defenses) (e.g. XML Bomb).\n\nThis becomes a concern in particular if feedgen is used to include content from untrused sources and if XML (including XHTML) is directly included instead of providing plain tex content only.\n\n### Patches\n\nThis problem has been fixed in feedgen 0.9.0 which disallows XML entity expansion and external resources.\n\n### Workarounds\n\nUpdating is strongly recommended and should not be problematic. Nevertheless, as a workaround, avoid providing XML directly to feedgen or ensure that no entity expansion is part of the XML. \n\n### References\n\n- [Security Briefs - XML Denial of Service Attacks and Defenses](https://docs.microsoft.com/en-us/archive/msdn-magazine/2009/november/xml-denial-of-service-attacks-and-defenses)\n- [Billion laughs attack](https://en.wikipedia.org/wiki/Billion_laughs_attack#cite_note-2)\n\n### For more information\n\nIf you have any questions or comments about this advisory:\n- Open an issue in [lkiesow/python-feedgen](https://github.com/lkiesow/python-feedgen/issues)\n- Send an email to security@lkiesow.de",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:H/UI:N/S:U/C:N/I:N/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:H/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "feedgen"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.9.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/lkiesow/python-feedgen/security/advisories/GHSA-g8q7-xv52-hf9f"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-5227"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/lkiesow/python-feedgen/commit/f57a01b20fa4aaaeccfa417f28e66b4084b9d0cf"
  }, {
    "type" : "WEB",
    "url" : "https://docs.microsoft.com/en-us/archive/msdn-magazine/2009/november/xml-denial-of-service-attacks-and-defenses"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/lkiesow/python-feedgen"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/feedgen/PYSEC-2020-231.yaml"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/T6I5ENUYGFNMIH6ZQ62FZ6VU2WD3SIOI"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-776" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-01-28T22:34:51Z",
    "nvd_published_at" : null
  }
}