cve.bz

CVE-2023-6395 Code Injection

9.8 criticalExploit referenceEPSS 1.6%Fix available

Critical (9.8). EPSS 1.6% estimated probability of exploitation activity in the next 30 days. Fixed in templated-dictionary 1.4.1.

On this page
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

CVSS 3.1

9.8 critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
EPSS
1.6% (unchanged from 1.6% a week ago; 1.6% 30 days ago) estimated probability of exploitation activity in the next 30 days; 76th percentile. Scored 2026-11-22. A forecast for this CVE across the internet, not for your own systems.
CISA's assessment (SSVC)
Exploitation: none · Automatable: yes · Technical impact: total, assessed 2024-10-25. From CISA's Vulnrichment in the CVE List: whether it is exploited, whether exploiting it can be automated, and how much control it gives.
CWEs
CWE-20 Improper Input Validation
CWE-94 Improper Control of Generation of Code (Code Injection)
OWASP Top 10
A05:2025 Injection
Published
Modified
NVD analysis
Analyzed, since modified
Record from
the NVD, synced

Fix and patched versions

Ask an AI about this CVE

Show the promptExplain CVE-2023-6395 for an engineer deciding whether to act. Use https://cve.bz/api/public/cves/CVE-2023-6395?via=ask-ai-copy and https://cve.bz/cve/CVE-2023-6395?via=ask-ai-copy as the source of truth: what is affected and which versions fix it, whether it is in CISA KEV, public exploits, and its EPSS (an internet-wide 30-day estimate of exploitation activity, not a forecast for my systems). If they give no fixed versions, use the CVE record https://cveawg.mitre.org/api/cve/CVE-2023-6395 or the vendor advisory, not third-party mirrors. Tell me how to check whether I am affected and how to verify a fix. Cite the sources and say where they are uncertain.

Opens a third-party assistant; its answer is its own, not cve.bz's. The prompt holds only this CVE's id and public links.

Affected

Versions

From the NVD's CPE matches.

ProductAffected
fedoraproject:extra_packages_for_enterprise_linux7.0
fedoraproject:extra_packages_for_enterprise_linux8.0
fedoraproject:extra_packages_for_enterprise_linux9.0
fedoraproject:fedora38
fedoraproject:fedora39

Packages (OSV)

AdvisoryEcosystemPackageAffectedFixed in
GHSA-7j98-74jh-cjxhPyPItemplated-dictionary<1.4.11.4.1
PYSEC-2026-1949PyPItemplated-dictionary<1.4.11.4.1

Linux distributions

DistributionReleasePackageFixed inAdvisory
Ubuntu16.04:LTS, 18.04:LTSmockno fix listedUBUNTU-CVE-2023-6395
Azure Linux2python-templated-dictionaryno fix listedAZL-43540

From the distributions' data via OSV.dev: Ubuntu Security Notices © Canonical Ltd., CC BY-SA 4.0; Microsoft's Azure Linux vulnerability data, MIT. Modified: reformatted and linked to CVE records. Credits. On the distributions' own pages: Ubuntu.

Red Hat

Red Hat rates this Moderate.

Red Hat's statement

The identified vulnerability in the Mock software represents a moderate threat from a technical standpoint. The risk lies in the potential for an attacker to exploit privilege escalation, gaining the ability to execute arbitrary code with root user privileges. This vulnerability arises due to the absence of proper sandboxing during the expansion and execution of Jinja2 templates in specific configuration parameters. While the Mock documentation advises treating certain users as privileged, the risk is amplified by certain build systems inadvertently allowing less privileged users to define configuration tags. These tags can be passed as parameters to Mock during execution, creating a pathway for remote privilege escalation and the execution of arbitrary code on the build server. The moderate classification is attributed to the specific conditions required for exploitation and the potential impact on system integrity.

The fix for this issue is located at the `TemplatedDictionary' library, which mock heavily relies on to expand configuration values. This library was part of `mock` before but it was stripped to a separated code base in mock 2.9-1, while the vulnerability itself was introduced while `TemplatedDictionary` was part of mock code base in mock 1.4.

Red Hat Enterprise Linux 7, 8 and 9 are not affected by this vulnerability as those versions doesn't ship the `mock` package.

Red Hat's mitigation

Mitigation for this issue is either not available or the currently available options don't meet the Red Hat Product Security criteria comprising ease of use and deployment, applicability to widespread installation base or stability.

ProductPackageStateAdvisory
Red Hat Enterprise Linux 6mockNot affected

Contains Red Hat Security Data © Red Hat, Inc., licensed under CC BY 4.0. Source: https://access.redhat.com/security/data. Modified: reformatted. Red Hat's page for CVE-2023-6395.

Attack patterns (CAPEC)

  • CAPEC-35 Leverage Executable Code in Non-Executable Files Likelihood: High · Severity: Very High
  • CAPEC-77 Manipulating User-Controlled Variables Likelihood: High · Severity: Very High
  • CAPEC-242 Code Injection Likelihood: High · Severity: High

The attack patterns MITRE's CAPEC relates to this record's weaknesses, as MITRE names them. Credits. More on the page of CWE-20 (51).

References

Check your stackJSON