CVE-2023-32321: Ckan Remote Code Execution Vulnerability

CRITICAL
Advisory Identifier: GHSA-446m-hmmm-hm8m
CVSS 9.8
CWE-20
Published
Advisory Summary

CVE-2023-32321 is a CRITICAL (CVSS 9.8) remote code execution vulnerability (CWE-20: Improper Input Validation) affecting Ckan libraries in the PyPI ecosystem. The issue involves ckan remote code execution and private information access via crafted resource ids. Remediation is available by upgrading affected packages to version 2.9.9.

CVE-2023-32321 at a Glance

CVE Identifier CVE-2023-32321
GHSA Identifier GHSA-446m-hmmm-hm8m
Severity CRITICAL
CVSS v3.1 Base Score 9.8
CWE Classification CWE-20: Improper Input Validation
Affected Product Ckan
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 9.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:N/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 None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2023-32321

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

ckan fixed: 2.9.9
pip install ckan>=2.9.9
ckan fixed: Latest secure release
pip install ckan>=Latest secure release
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 ckan

How to Check if You Are Affected

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

pip show ckan

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

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

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-20: Improper Input Validation, where the product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly. In Ckan, 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

Specific vulnerabilities: * Arbitrary file write in `resource_create` and `package_update` actions, using the `ResourceUploader` object. Also reachable via `package_create`, `package_revise`, and `package_patch` via calls to `package_update`. * Remote code execution via unsafe pickle loading, via Beaker's session store when configured to use the file session store backend. * Potential DOS due to lack of a length check on the resource id. * Information disclosure: A user with permission to create a resource can access any other resource on the system if they know the id, even if they don't have access to it. * Resource overwrite: A user with permission to create a resource can overwrite any resource if they know the id, even if they don't have access to it. ### Impact A user with permissions to create or edit a dataset can upload a resource with a specially crafted id to write the uploaded file in an arbitrary location. This can be leveraged to Remote Code Execution via Beaker's insecure pickle loading. ### Patches All the above listed vulnerabilities have been fixed in CKAN 2.9.9 and CKAN 2.10.1 The patches for CKAN 2.9 should apply easily to previous CKAN versions.

CVE-2023-32321 Affected Ckan Versions

2 component(s)
Fixed Versions:
2.9.9
Product / Package Ecosystem Affected Versions Fixed Version
ckan
PyPI
< 2.9.9
2.9.9
ckan
PyPI
2.10.0
All 1 versions
2.10.0
None specified

References

Frequently Asked Questions

What is CVE-2023-32321?
CVE-2023-32321 is a security vulnerability in Ckan involving Ckan remote code execution and private information access via crafted resource ids under CWE-20: Improper Input Validation.
Which Ckan versions are affected?
Affected versions include releases prior to 2.9.9 across affected packages: ckan.
What version fixes CVE-2023-32321?
Upgrading to 2.9.9 (or the latest patched release for your respective branch) resolves the vulnerability.
Is ckan affected?
Yes, ckan is affected in releases prior to 2.9.9, Latest secure release. Upgrade your dependency to 2.9.9, Latest secure release or later.
What is the CVSS score of CVE-2023-32321?
CVE-2023-32321 has a CVSS v3.1 base score of 9.8 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2023-32321?
CVE-2023-32321 is classified under CWE-20: Improper Input Validation (The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.).
How can I check PyPI dependencies for CVE-2023-32321?
Run the dependency tree command: 'pip show ckan'. 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-446m-hmmm-hm8m",
  "modified" : "2023-05-29T16:12:22Z",
  "published" : "2023-05-24T17:24:56Z",
  "aliases" : [ "CVE-2023-32321" ],
  "summary" : "Ckan remote code execution and private information access via crafted resource ids",
  "details" : "Specific vulnerabilities:\n\n* Arbitrary file write in `resource_create` and `package_update` actions, using the `ResourceUploader` object.  Also reachable via `package_create`, `package_revise`, and `package_patch` via calls to `package_update`.\n* Remote code execution via unsafe pickle loading, via Beaker's session store when configured to use the file session store backend.\n* Potential DOS due to lack of a length check on the resource id.\n* Information disclosure: A user with permission to create a resource can access any other resource on the system if they know the id, even if they don't have access to it.\n* Resource overwrite: A user with permission to create a resource can overwrite any resource if they know the id, even if they don't have access to it.  \n\n### Impact\n\nA user with permissions to create or edit a dataset can upload a resource with a specially crafted id to write the uploaded file in an arbitrary location. This can be leveraged to Remote Code Execution via Beaker's insecure pickle loading. \n\n### Patches\n\nAll the above listed vulnerabilities have been fixed in CKAN 2.9.9 and CKAN 2.10.1\nThe patches for CKAN 2.9 should apply easily to previous CKAN versions.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "ckan"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.9.9"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "ckan"
    },
    "versions" : [ "2.10.0" ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/ckan/ckan/security/advisories/GHSA-446m-hmmm-hm8m"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-32321"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/ckan/ckan"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ckan/ckan/blob/2a6080e61d5601fa0e2a0317afd6a8e9b7abf6dd/CHANGELOG.rst"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-20" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-05-24T17:24:56Z",
    "nvd_published_at" : "2023-05-26T23:15:18Z"
  }
}