CVE-2020-7965: Webargs Cross-Site Request Forgery Vulnerability

HIGH
Advisory Identifier: GHSA-fjq3-5pxw-4wj4
CVSS 8.8
CWE-352
Published
Advisory Summary

CVE-2020-7965 is a HIGH (CVSS 8.8) cross-site request forgery vulnerability (CWE-352: Cross-Site Request Forgery (CSRF)) affecting Webargs libraries in the PyPI ecosystem. The issue involves cross-site request forgery in webargs. Remediation is available by upgrading affected packages to version 5.5.3, 6.0.0b4.

CVE-2020-7965 at a Glance

CVE Identifier CVE-2020-7965
GHSA Identifier GHSA-fjq3-5pxw-4wj4
Severity HIGH
CVSS v3.1 Base Score 8.8
CWE Classification CWE-352: Cross-Site Request Forgery (CSRF)
Affected Product Webargs
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 8.8

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:U/C:H/I:H/A:H).

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

How to Fix CVE-2020-7965

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

webargs fixed: 5.5.3
pip install webargs>=5.5.3
webargs fixed: 6.0.0b4
pip install webargs>=6.0.0b4
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 webargs

How to Check if You Are Affected

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

pip show webargs

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

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

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-352: Cross-Site Request Forgery (CSRF), where the web application does not, or cannot, sufficiently verify whether a request was intentionally provided by the user who sent the request, which could have originated from an unauthorized actor. In Webargs, 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

flaskparser.py in Webargs 5.x through 5.5.2 doesn't check that the Content-Type header is application/json when receiving JSON input. If the request body is valid JSON, it will accept it even if the content type is application/x-www-form-urlencoded. This allows for JSON POST requests to be made across domains, leading to CSRF.

CVE-2020-7965 Affected Webargs Versions

2 component(s)
Fixed Versions:
5.5.36.0.0b4
Product / Package Ecosystem Affected Versions Fixed Version
webargs
PyPI
≥ 5.0.0
< 5.5.3
5.5.3
webargs
PyPI
≥ 6.0.0b1
< 6.0.0b4
6.0.0b4

References

Frequently Asked Questions

What is CVE-2020-7965?
CVE-2020-7965 is a security vulnerability in Webargs involving Cross-Site Request Forgery in Webargs under CWE-352: Cross-Site Request Forgery (CSRF).
Which Webargs versions are affected?
Affected versions include releases prior to 5.5.3, 6.0.0b4 across affected packages: webargs.
What version fixes CVE-2020-7965?
Upgrading to 5.5.3, 6.0.0b4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is webargs affected?
Yes, webargs is affected in releases prior to 5.5.3, 6.0.0b4. Upgrade your dependency to 5.5.3, 6.0.0b4 or later.
What is the CVSS score of CVE-2020-7965?
CVE-2020-7965 has a CVSS v3.1 base score of 8.8 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2020-7965?
CVE-2020-7965 is classified under CWE-352: Cross-Site Request Forgery (CSRF) (The web application does not, or cannot, sufficiently verify whether a request was intentionally provided by the user who sent the request, which could have originated from an unauthorized actor.).
How can I check PyPI dependencies for CVE-2020-7965?
Run the dependency tree command: 'pip show webargs'. 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-fjq3-5pxw-4wj4",
  "modified" : "2024-11-19T15:34:04Z",
  "published" : "2021-04-07T21:06:30Z",
  "aliases" : [ "CVE-2020-7965" ],
  "summary" : "Cross-Site Request Forgery in Webargs",
  "details" : "flaskparser.py in Webargs 5.x through 5.5.2 doesn't check that the Content-Type header is application/json when receiving JSON input. If the request body is valid JSON, it will accept it even if the content type is application/x-www-form-urlencoded. This allows for JSON POST requests to be made across domains, leading to CSRF.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "webargs"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "5.0.0"
      }, {
        "fixed" : "5.5.3"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "webargs"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "6.0.0b1"
      }, {
        "fixed" : "6.0.0b4"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-7965"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/marshmallow-code/webargs/commit/b9ee8b0aa668207a363d9fd21d967eeadb975c3e"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/marshmallow-code/webargs"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/webargs/PYSEC-2020-156.yaml"
  }, {
    "type" : "WEB",
    "url" : "https://webargs.readthedocs.io/en/latest/changelog.html"
  }, {
    "type" : "WEB",
    "url" : "https://webargs.readthedocs.io/en/latest/changelog.html#b4-2020-01-28"
  }, {
    "type" : "WEB",
    "url" : "https://webargs.readthedocs.io/en/latest/changelog.html#id11"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-352" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-03-29T22:19:18Z",
    "nvd_published_at" : "2020-01-29T15:15:00Z"
  }
}