HIGH 7.5

CVE-2026-49147: App::Ack Terminal Escape Sequence Injection in Filenames

App::Ack, a popular command-line search utility for Perl, fails to sanitize terminal escape sequences embedded in filenames across multiple output modes. When a user or an automated process searches files with ack and a filename contains ANSI escape codes (such as color or cursor-movement sequences), those bytes pass directly to the terminal unsanitized. This can allow an attacker to manipulate terminal display, overwrite previous output, or inject malicious control sequences into downstream tools that consume ack's output. The vulnerability affects versions through 3.10.0, though a partial fix was introduced in 3.10.0 that addresses some—but not all—output paths.

Source data · NVD / CISA · public domain

CVSS
3.1 · 7.5 HIGH · CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Weaknesses (CWE)
CWE-150
Affected products
0 configuration(s)
Published / Modified
2026-07-08 / 2026-07-08

NVD description (verbatim)

App::Ack versions through 3.10.0 for Perl print unsanitised terminal escape sequences from filenames in several output modes. When ack prints a filename whose basename contains terminal control bytes such as ANSI escape sequences, those bytes reach the terminal unchanged. Version 3.10.0 added a _safe_filename helper that sanitises the filenames printed by -f, -g, the colored match heading, and per-match lines, but the --show-types, -l/-L, and -c paths still emit the raw filename. A file whose name embeds cursor-movement or color escapes can overwrite or recolor earlier terminal output, or be passed unchanged to a downstream consumer.

2 reference(s) · View on NVD →

SEC.co analysis · AI-assisted, reviewed against source

Technical summary

The vulnerability stems from improper handling of terminal control characters in filename output. App::Ack version 3.10.0 introduced a _safe_filename sanitization function that addresses escape-sequence injection in -f (list filenames), -g (match filenames), colored match headings, and per-match output lines. However, the --show-types, -l (list files), -L (list files without matches), and -c (count matches) output modes still print raw filenames without sanitization. An attacker can craft a filename with embedded ANSI escape sequences (e.g., ESC[2J to clear screen, or ESC[H to reposition cursor) that execute when ack renders that filename in a terminal. The root cause is inconsistent application of output encoding across all code paths. CWE-150 (Improper Neutralization of Input Leading to Mangled Output) classifies this weakness.

Business impact

For organizations using ack in automated workflows, CI/CD pipelines, or shared development environments, this vulnerability can degrade tool reliability and user trust. Attackers who can influence filenames in indexed directories (via malicious downloads, repository commits, or archive extraction) gain a mechanism to corrupt log output, hide errors, or inject fake error messages that mislead incident response teams. In environments where ack output feeds into alerting systems or compliance reporting, injected escape sequences could suppress notifications or falsify audit logs. The impact is heightened in multi-tenant or untrusted-source scenarios where filename control by adversaries is plausible.

Affected systems

All users and systems running App::Ack versions up to and including 3.10.0 are affected. This includes developers on Linux, macOS, and other Unix-like systems, as well as automation scripts and containerized workloads that invoke ack as a search tool. The vulnerability does not affect Windows terminals that do not interpret ANSI escape codes by default, though modern Windows 10+ terminals can be configured to do so. Any downstream tool or script that parses ack output and feeds it to a terminal without additional sanitization is also at risk of being exploited indirectly.

Exploitability

Exploitability is straightforward and requires only that an attacker can create or influence a filename in a directory that a user or automation will search with ack. No authentication, user interaction beyond normal ack usage, or network access is required. The attack surface expands in scenarios involving downloaded files, extracted archives, shared repositories, or user-supplied input that is persisted as files. The escape sequences execute passively when ack renders the filename, making this a low-friction attack. However, real-world impact depends on whether the attacker's goal (terminal manipulation, log corruption, downstream injection) aligns with the specific output mode being used and the downstream consumer.

Remediation

Upgrade App::Ack to a patched version that applies the _safe_filename sanitization consistently across all output modes, including --show-types, -l, -L, and -c. Verify the exact patched version against the vendor's official advisory or release notes. Until patching is feasible, mitigate by running ack in non-interactive contexts (where terminal output is captured to files or logs) or by piping ack output through a sanitization tool such as cat -v or ansi. Restrict file creation in directories being searched to trusted users only, and avoid searching directories containing untrusted or user-supplied files.

Patch guidance

Check the official App::Ack repository and release history for versions newer than 3.10.0 that apply the _safe_filename function to all output code paths. Verify the specific patch version through the vendor's release notes or commits that address CWE-150. Update via your Perl package manager (CPAN, apt, yum, homebrew, etc.) once a patched version is released and tested in your environment. Regression testing should confirm that the patch does not break existing ack functionality or change output formatting for legitimate filenames.

Detection guidance

Detect potential exploitation by monitoring for filenames containing ANSI escape sequences in directories being indexed or searched. Unix command-line tools like find with -print0 and od can reveal raw bytes in filenames. Log analysis should flag ack invocations with atypical output if terminal corruption or missing log entries are observed. Network-based detection is not applicable; focus on endpoint and process-level monitoring. Review file creation patterns in shared directories or CI/CD artifact repositories for suspicious escape-sequence characters (e.g., byte sequences starting with 0x1B).

Why prioritize this

This vulnerability merits HIGH priority because it enables denial of availability and integrity attacks on terminal output and downstream tools with no authentication or user interaction required. While the attack surface is narrower than network-exposed vulnerabilities, the ease of exploitation and the potential for supply-chain contamination (e.g., malicious filenames in published archives or repositories) justify urgent patching. Organizations relying on ack for log parsing, code search, or automation should patch proactively.

Risk score, explained

The CVSS 3.1 score of 7.5 (HIGH) reflects a network-accessible attack vector with low complexity and no privilege requirement, resulting in high availability impact (terminal denial, tool malfunction). The scope is unchanged (impact is confined to the ack process and its output), and there is no direct confidentiality or integrity impact on data at rest. The score appropriately captures the ease of exploitation and the real potential for operational disruption in automated environments, though it may underweight scenarios involving log falsification or supply-chain injection.

Frequently asked questions

Can this vulnerability be exploited if ack is run in a non-interactive context, such as in a script that redirects output to a file?

Yes, but with different impact. If the file receives escape sequences, downstream tools that read and parse the file may be affected if they send it to a terminal. A safer approach is to pipe ack output through a tool like cat -v or sed to strip control characters before storage or downstream processing.

Does this affect me if I only use ack to search code repositories on GitHub or in a CI/CD pipeline where filenames are under my control?

Your risk is lower if you control all filenames being indexed. However, if your CI/CD pipeline checks out or builds third-party code, or if you have any dependency on user-uploaded artifacts, the risk increases. Patching remains recommended as a defense-in-depth measure.

Which ack output modes are vulnerable in version 3.10.0?

According to the description, the --show-types, -l (list files), -L (list files without matches), and -c (count matches) modes still emit raw filenames without sanitization in version 3.10.0. Modes like -f, -g, and colored match headings were addressed in 3.10.0 via the _safe_filename function.

What is the difference between this vulnerability and a typical code injection attack?

This is an output encoding vulnerability (CWE-150) rather than code injection. The attack does not execute arbitrary code but instead manipulates the terminal display or injects control sequences into output streams. The risk lies in corrupted output, false alerts, and downstream tool confusion rather than remote code execution.

This analysis is provided for informational purposes and reflects publicly available vulnerability data as of the stated publication date. No exploit code, proof-of-concept, or weaponized tools are included. Patch availability and version numbers should be verified against official vendor advisories before deployment. Organizations should test patches in non-production environments and follow their own change management processes. SEC.co makes no warranty regarding the completeness or accuracy of this information and recommends consulting vendor documentation and security advisories for the most current guidance. Source: NVD (public-domain), retrieved 2026-08-17. Analysis generated by SEC.co (claude-haiku-4-5).