GHSA-656c-6cxf-hvcv
Vulnerability from github
Published
2021-06-18 18:33
Modified
2022-09-20 13:31
Summary
Deserialization of Untrusted Data in Flask-Caching
Details

Flask-Cache adds easy cache support to Flask. The Flask-Caching extension through 1.10.1 for Flask relies on Pickle for serialization, which may lead to remote code execution or local privilege escalation. If an attacker gains access to cache storage (e.g., filesystem, Memcached, Redis, etc.), they can construct a crafted payload, poison the cache, and execute Python code.

However, this is not a high-severity issue, as for an attack like this to work, an attacker must:

  1. Be able to write arbitrary values to the cache
  2. Be able to generate a cache key that will collide with a value being read by the application
  3. Cause the application to read a maliciously-injected value

Any situation where all 3 of those is true is a situation where the application has larger problems; for example, if someone's able to inject malicious cached rendered pages into a Flask app's cache, then they can make the website say literally anything they want, regardless of whether it involves the execution of remote code. Basically, the Pickle vulnerability follows from a website already being extremely vulnerable (due to conditions 1 and 2 being met).

Show details on source website


{
  "affected": [
    {
      "package": {
        "ecosystem": "PyPI",
        "name": "Flask-Caching"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "last_affected": "1.10.1"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2021-33026"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-269",
      "CWE-502"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2021-05-17T17:25:38Z",
    "nvd_published_at": "2021-05-13T23:15:00Z",
    "severity": "MODERATE"
  },
  "details": "Flask-Cache adds easy cache support to Flask. The Flask-Caching extension through 1.10.1 for Flask relies on Pickle for serialization, which may lead to remote code execution or local privilege escalation. If an attacker gains access to cache storage (e.g., filesystem, Memcached, Redis, etc.), they can construct a crafted payload, poison the cache, and execute Python code.\n\nHowever, this is not a high-severity issue, as for an attack like this to work, an attacker must:\n\n1. Be able to write arbitrary values to the cache\n2. Be able to generate a cache key that will collide with a value being read by the application\n3. Cause the application to read a maliciously-injected value\n\nAny situation where all 3 of those is true is a situation where the application has larger problems; for example, if someone\u0027s able to inject malicious cached rendered pages into a Flask app\u0027s cache, then they can make the website say literally anything they want, regardless of whether it involves the execution of remote code. Basically, the Pickle vulnerability follows from a website already being extremely vulnerable (due to conditions 1 and 2 being met).",
  "id": "GHSA-656c-6cxf-hvcv",
  "modified": "2022-09-20T13:31:06Z",
  "published": "2021-06-18T18:33:40Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2021-33026"
    },
    {
      "type": "WEB",
      "url": "https://github.com/pallets-eco/flask-caching/pull/209#issuecomment-1136397937"
    },
    {
      "type": "WEB",
      "url": "https://github.com/sh4nks/flask-caching/pull/209"
    },
    {
      "type": "ADVISORY",
      "url": "https://github.com/advisories/GHSA-656c-6cxf-hvcv"
    },
    {
      "type": "WEB",
      "url": "https://github.com/pypa/advisory-database/tree/main/vulns/flask-caching/PYSEC-2021-13.yaml"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/sh4nks/flask-caching"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:N/I:H/A:N",
      "type": "CVSS_V3"
    }
  ],
  "summary": "Deserialization of Untrusted Data in Flask-Caching"
}


Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Sightings

Author Source Type Date

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or seen somewhere by the user.
  • Confirmed: The vulnerability is confirmed from an analyst perspective.
  • Exploited: This vulnerability was exploited and seen by the user reporting the sighting.
  • Patched: This vulnerability was successfully patched by the user reporting the sighting.
  • Not exploited: This vulnerability was not exploited or seen by the user reporting the sighting.
  • Not confirmed: The user expresses doubt about the veracity of the vulnerability.
  • Not patched: This vulnerability was not successfully patched by the user reporting the sighting.