Vulnerabilities in pkg:pypi/templated_dictionary

PACKAGE
Advisory Identifier: GHSA-7j98-74jh-cjxh
Advisory Summary

CVE-2023-6395 is a MODERATE (CVSS 6.7) privilege escalation for users that vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting Templated dictionary libraries in the PyPI ecosystem. The issue involves privilege escalation for users that can access mock configuration. Remediation is available by upgrading affected packages to version 1.4.1.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:pypi/templated_dictionary

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:pypi/templated_dictionary. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-7j98-74jh-cjxh CVE-2023-6395 MODERATE Privilege escalation for users that can access mock configuration

CVE-2023-6395 at a Glance

CVE Identifier CVE-2023-6395
GHSA Identifier GHSA-7j98-74jh-cjxh
Severity MODERATE
CVSS v3.1 Base Score 6.7
CWE Classification CWE-94: Improper Control of Generation of Code ('Code Injection')
Affected Product Templated dictionary
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 6.7

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

Attack Vector Local (AV:L)
Attack Complexity Low (AC:L)
Privileges Required High (PR:H)
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-6395

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

templated_dictionary fixed: 1.4.1
pip install templated_dictionary>=1.4.1
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 templated_dictionary

How to Check if You Are Affected

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

pip show templated_dictionary

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

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

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-94: Improper Control of Generation of Code ('Code Injection'), where the product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. In Templated dictionary, 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

The Mock software contains a vulnerability wherein an attacker could potentially exploit privilege escalation, enabling the execution of arbitrary code with root user privileges. This weakness stems from the absence of proper sandboxing during the expansion and execution of Jinja2 templates, which may be included in certain configuration parameters. While the Mock documentation advises treating users added to the mock group as privileged, certain build systems invoking mock on behalf of users might inadvertently permit less privileged users to define configuration tags. These tags could then be passed as parameters to mock during execution, potentially leading to the utilization of Jinja2 templates for remote privilege escalation and the execution of arbitrary code as the root user on the build server.

CVE-2023-6395 Affected Templated dictionary Versions

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

References

Frequently Asked Questions

What is CVE-2023-6395?
CVE-2023-6395 is a security vulnerability in Templated dictionary involving Privilege escalation for users that can access mock configuration under CWE-94: Improper Control of Generation of Code ('Code Injection').
Which Templated dictionary versions are affected?
Affected versions include releases prior to 1.4.1 across affected packages: templated_dictionary.
What version fixes CVE-2023-6395?
Upgrading to 1.4.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is templated_dictionary affected?
Yes, templated_dictionary is affected in releases prior to 1.4.1. Upgrade your dependency to 1.4.1 or later.
What is the CVSS score of CVE-2023-6395?
CVE-2023-6395 has a CVSS v3.1 base score of 6.7 (MODERATE) with vector string CVSS:3.1/AV:L/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2023-6395?
CVE-2023-6395 is classified under CWE-94: Improper Control of Generation of Code ('Code Injection') (The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.).
How can I check PyPI dependencies for CVE-2023-6395?
Run the dependency tree command: 'pip show templated_dictionary'. 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-7j98-74jh-cjxh",
  "modified" : "2024-10-25T22:00:03Z",
  "published" : "2024-01-16T15:30:28Z",
  "aliases" : [ "CVE-2023-6395" ],
  "summary" : "Privilege escalation for users that can access mock configuration",
  "details" : "The Mock software contains a vulnerability wherein an attacker could potentially exploit privilege escalation, enabling the execution of arbitrary code with root user privileges. This weakness stems from the absence of proper sandboxing during the expansion and execution of Jinja2 templates, which may be included in certain configuration parameters. While the Mock documentation advises treating users added to the mock group as privileged, certain build systems invoking mock on behalf of users might inadvertently permit less privileged users to define configuration tags. These tags could then be passed as parameters to mock during execution, potentially leading to the utilization of Jinja2 templates for remote privilege escalation and the execution of arbitrary code as the root user on the build server.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "templated_dictionary"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.4.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-6395"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/xsuchy/templated-dictionary/commit/0740bd0ca8d487301881541028977d120f8b8933"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/xsuchy/templated-dictionary/commit/bcd90f0dafa365575c4b101e6f5d98c4ef4e4b69"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/security/cve/CVE-2023-6395"
  }, {
    "type" : "WEB",
    "url" : "https://bugzilla.redhat.com/show_bug.cgi?id=2252206"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/xsuchy/templated-dictionary"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/62SP2BJC2AFLFJJAEHPGZ3ZINTBTI7AN"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/NBFYREAJH4T7GXXQZ4GJEREN4Q3AHS3K"
  }, {
    "type" : "WEB",
    "url" : "http://www.openwall.com/lists/oss-security/2024/01/16/1"
  }, {
    "type" : "WEB",
    "url" : "http://www.openwall.com/lists/oss-security/2024/01/16/3"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-20", "CWE-94" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-01-25T21:13:03Z",
    "nvd_published_at" : "2024-01-16T15:15:08Z"
  }
}