CVE-2021-32061: S3scanner Path Traversal Vulnerability

MODERATE
Advisory Identifier: GHSA-qppg-v75c-r5ff
CVSS 5.3
CWE-22
Published
Advisory Summary

CVE-2021-32061 is a MODERATE (CVSS 5.3) path traversal vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting S3scanner libraries in the PyPI ecosystem. The issue involves s3scanner allows directory traversal. Remediation is available by upgrading affected packages to version 2.0.2.

CVE-2021-32061 at a Glance

CVE Identifier CVE-2021-32061
GHSA Identifier GHSA-qppg-v75c-r5ff
Severity MODERATE
CVSS v3.1 Base Score 5.3
CWE Classification CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Affected Product S3scanner
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 5.3

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

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

How to Fix CVE-2021-32061

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

s3scanner fixed: 2.0.2
pip install s3scanner>=2.0.2
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 s3scanner

How to Check if You Are Affected

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

pip show s3scanner

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

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

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In S3scanner, 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

S3Scanner before 2.0.2 allows Directory Traversal via a crafted bucket, as demonstrated by a `<Key>../` substring in a `ListBucketResult` element.

CVE-2021-32061 Affected S3scanner Versions

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

References

Frequently Asked Questions

What is CVE-2021-32061?
CVE-2021-32061 is a security vulnerability in S3scanner involving S3Scanner allows Directory Traversal under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Which S3scanner versions are affected?
Affected versions include releases prior to 2.0.2 across affected packages: s3scanner.
What version fixes CVE-2021-32061?
Upgrading to 2.0.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is s3scanner affected?
Yes, s3scanner is affected in releases prior to 2.0.2. Upgrade your dependency to 2.0.2 or later.
What is the CVSS score of CVE-2021-32061?
CVE-2021-32061 has a CVSS v3.1 base score of 5.3 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N.
What CWE is associated with CVE-2021-32061?
CVE-2021-32061 is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') (The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.).
How can I check PyPI dependencies for CVE-2021-32061?
Run the dependency tree command: 'pip show s3scanner'. 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-qppg-v75c-r5ff",
  "modified" : "2024-10-26T22:45:50Z",
  "published" : "2021-11-30T22:21:36Z",
  "aliases" : [ "CVE-2021-32061" ],
  "summary" : "S3Scanner allows Directory Traversal",
  "details" : "S3Scanner before 2.0.2 allows Directory Traversal via a crafted bucket, as demonstrated by a `<Key>../` substring in a `ListBucketResult` element.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "s3scanner"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.0.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-32061"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/sa7mon/S3Scanner/issues/122"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/sa7mon/S3Scanner/commit/fafa30a3bd35b496b3f7db9bfc35b75a8a06bcd1"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-qppg-v75c-r5ff"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/s3scanner/PYSEC-2021-433.yaml"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/sa7mon/S3Scanner"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/sa7mon/S3Scanner/releases/tag/2.0.2"
  }, {
    "type" : "WEB",
    "url" : "https://vuln.ryotak.me/advisories/62"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-11-30T16:20:13Z",
    "nvd_published_at" : "2021-11-29T03:15:00Z"
  }
}