CVE-2023-6395
Description
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.
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 mockbefore but it was stripped to a separated code base in mock 2.9-1, while the vulnerability itself was introduced whileTemplatedDictionary` 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.
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.
Common Vulnerability Scoring System (CVSS) Score Details
Info alert:Important note
CVSS scores for open source components depend on vendor-specific factors (e.g. version or build chain). Therefore, Red Hat's score and impact rating can be different from NVD and other vendors. Red Hat remains the authoritative CVE Naming Authority (CNA) source for its products and services (see Red Hat classifications).
The following CVSS metrics and score provided are preliminary and subject to review.
CVSS v3 Score Breakdown
| Red Hat | NVD | cve.org | |
|---|---|---|---|
| Base Score | 6.7 | 9.8 | N/A |
| Attack Vector | Local | Network | N/A |
| Attack Complexity | Low | Low | N/A |
| Privileges Required | High | None | N/A |
| User Interaction | None | None | N/A |
| Scope | Unchanged | Unchanged | N/A |
| Confidentiality | High | High | N/A |
| Integrity Impact | High | High | N/A |
| Availability Impact | High | High | N/A |
Vector
Red Hat: CVSS:3.1/AV:L/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H
NVD: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Understanding the Weakness (CWE)
Availability
Technical Impact: DoS: Crash, Exit, or Restart; DoS: Resource Consumption (CPU); DoS: Resource Consumption (Memory)
An attacker could provide unexpected values and cause a program crash or arbitrary control of resource allocation, leading to excessive consumption of resources such as memory and CPU.
Confidentiality
Technical Impact: Read Memory; Read Files or Directories
An attacker could read confidential data if they are able to control resource references.
Integrity,Confidentiality,Availability
Technical Impact: Modify Memory; Execute Unauthorized Code or Commands
An attacker could use malicious input to modify data or possibly alter control flow in unexpected ways, including arbitrary command execution.
Acknowledgements
Red Hat would like to thank Sankin Nikita Alexeevich for reporting this issue.
Frequently Asked Questions
Not sure what something means? Check out our Security Glossary.
Want to get errata notifications? Sign up here.