Skip to content

Traceback prints locals

Moderate
MartinBasti published GHSA-w9qc-9m5h-qqmh Nov 19, 2024

Package

cachi2

Affected versions

<= 0.13.0

Patched versions

>= 0.14.0

Description

Impact

Secrets may be shown in logs when an unhandled exception is triggered, because typer framework is logging locals of each function.

This may uncover secrets if Cachi2 is used in CI/build pipelines as it's the main use case.

Example of log:

2024-11-13 17:43:57,481 ERROR RuntimeError: Package parent module was not found
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /venv/lib64/python3.9/site-packages/cachi2/interface/cli.py:65 in            │
│ cmd_with_error_handling                                                      │
│                                                                              │
│    62 │   @functools.wraps(cmd)                                              │
│    63 │   def cmd_with_error_handling(*args: tuple[Any, ...], **kwargs: dict │
│    64 │   │   try:                                                           │
│ ❱  65 │   │   │   cmd(*args, **kwargs)                                       │
│    66 │   │   except Cachi2Error as e:                                       │
│    67 │   │   │   _bail_out_with_error(e)                                    │
│    68 │   │   except Exception as e:                                         │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │   args = ()                                                              │ │
│ │ kwargs = {                                                               │ │
│ │          │   'raw_input': '[{"type": "gomod","path":                     │ │
│ │          "redacted"}]',                          │ │
│ │          │   'source': PosixPath('/var/workdir/source'),                 │ │
│ │          │   'output': PosixPath('/var/workdir/cachi2/output'),          │ │
│ │          │   'dev_package_managers': False,                              │ │
│ │          │   'cgo_disable': False,                                       │ │
│ │          │   'force_gomod_tidy': False,                                  │ │
│ │          │   'gomod_vendor': False,                                      │ │
│ │          │   'gomod_vendor_check': False                                 │ │
│ │          }                                                               │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │

...

Patches

d6638e5

Workarounds

N/A

References

https://typer.tiangolo.com/tutorial/exceptions/?h=#disable-local-variables-for-security

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Local
Attack complexity
High
Privileges required
None
User interaction
Required
Scope
Unchanged
Confidentiality
High
Integrity
None
Availability
None

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:N/A:N

CVE ID

CVE-2024-52582

Weaknesses

Credits