GuardDog: Unsanitized human-readable scan output allows terminal escape injection from malicious package content
Summary
GuardDog includes attacker-controlled filenames, file locations, messages, and code snippets in its default human-readable output without escaping terminal control characters. A malicious package can therefore inject ANSI or OSC escape sequences into analyst terminals or CI logs.
Description
The finding formatter stores file paths and snippets from scanned content:
location = file_path + ":" + str(start_line)
finding = {
"location": location,
"code": code,
"message": result["extra"]["message"],
}
The human-readable reporter later prints these values directly:
" * " + finding["message"] + " at " + finding["location"] + "\n " + _format_code_line_for_output(finding["code"])
No escaping is applied for control characters such as \x1b. A malicious package can therefore ship a filename like:
evil\x1b[2J.py
or matched source lines containing terminal escapes, which survive into the final CLI output.
Reproduction summary
- Create a file whose name contains
\x1b[2J. - Feed a semgrep-style result referencing that file into
Analyzer._format_semgrep_response(). - Render the result with
HumanReadableReporter.print_scan_results(). - The output string contains the raw escape bytes, which a terminal may interpret.
Key code paths
guarddog/analyzer/analyzer.py:377-392guarddog/reporters/human_readable.py:36-42guarddog/reporters/human_readable.py:84-91
Practical impact
This can be used to:
- clear or rewrite analyst terminal output
- inject misleading or spoofed log content in CI
- emit clickable OSC 8 hyperlinks or title changes in compatible terminals
Prior public disclosure check
As of 2026-03-18, no matching public GitHub advisory, CVE, or public repo issue was found for this specific bug.
Suggested fix
Escape or strip terminal control characters before rendering any attacker-controlled value in human-readable output. This should cover package names, file paths, messages, and code snippets.
Software afectado
Haz clic en una tecnología para ver todas sus vulnerabilidades.
| Plataforma | Paquete | Versiones vulnerables | Corregida en |
|---|---|---|---|
| Python (PyPI) | guarddog | >= 2.6.0, <= 2.9.0 | sin corrección |
Referencias
- Vector CVSS
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N- Debilidad (CWE)
CWE-116- Plataforma
- Python (PyPI)
- Paquete
guarddog- Publicada
- 11.05.2026
- Actualizado
- 11.10.2026 14:17
Fuentes y licencias
OSV / GitHub Advisory Database - PYSEC-2026-2506 - PyPA Advisory Database; CC BY 4.0
OSV / GitHub Advisory Database - GHSA-m5p4-gvpx-4mvr - CC BY 4.0
Historial de vulnerabilidades: guarddog
Todas las vulnerabilidades publicadas de este paquete (Python (PyPI)), de la más reciente a la más antigua. Muestra si es un fallo aislado o un paquete que hay que vigilar.
- Entradas en total
- 6
- Primera → última
- 12.2022 05.2026
- Sin corrección
- 2
- Explotada en ataques
- 0
Distribución por gravedad
- Alta 3
- Media 1
- Baja 2
Divulgaciones por año
- 2022: 2
- 2023: 0
- 2024: 0
- 2025: 0
- 2026: 4
-
GuardDog: Unsanitized human-readable scan output allows terminal escape injection from malicious package content esta entrada
Identifica las vulnerabilidades de tu aplicación
Con la integración de DockRay y el inventario de software activado, DockRay compara las versiones notificadas de los componentes con las vulnerabilidades conocidas y avisa de las coincidencias confirmadas. La cobertura depende de la tecnología compatible y de los avisos disponibles.