CVE-2026-8704 Overview
CVE-2026-8704 affects Crypt::DSA versions through 1.19 for Perl. The module uses Perl's 2-argument form of open() when handling key files, which allows existing files to be modified in unintended ways. This file handling weakness maps to [CWE-552] (Files or Directories Accessible to External Parties). The flaw was addressed in Crypt-DSA version 1.20 by author TIMLEGGE on MetaCPAN. According to the EPSS model, the likelihood of exploitation in the wild remains low.
Critical Impact
Attackers who control input passed to Crypt::DSA key-handling routines can modify existing files on the host filesystem through unsafe open() semantics.
Affected Products
- Crypt::DSA Perl module versions up to and including 1.19
- Perl applications that pass user-influenced paths to Crypt::DSA::Key
- Downstream distributions packaging Crypt-DSA 1.19 or earlier
Discovery Timeline
- 2026-05-15 - Vulnerability disclosed on the Openwall oss-security mailing list
- 2026-05-15 - CVE-2026-8704 published to NVD
- 2026-05-18 - Last updated in NVD database
Technical Details for CVE-2026-8704
Vulnerability Analysis
The vulnerability stems from the use of Perl's two-argument open() form inside lib/Crypt/DSA/Key.pm. Perl's 2-args open() interprets special characters in the file path argument. A leading > opens the path for writing, while | treats the argument as a command for piped execution. When Crypt::DSA accepts a filename influenced by an attacker, these special characters change the operation from read to write or pipe.
The result is that an attacker can cause Crypt::DSA to overwrite or truncate arbitrary files that the Perl process can write. Because the call site is intended to load a DSA key, the application does not expect destructive side effects. The fix in Crypt-DSA 1.20 switches the affected code to the safer 3-argument open() form, which separates the mode from the filename and prevents metacharacter interpretation.
Root Cause
The root cause is unsafe file handling through legacy Perl I/O semantics. The 2-argument open($fh, $path) form treats the second argument as a mode-and-path expression, making it dangerous whenever $path originates from or is influenced by untrusted input. This pattern maps directly to [CWE-552].
Attack Vector
An attacker supplies a crafted filename to a Perl application that calls Crypt::DSA::Key routines. By prefixing the path with shell-like metacharacters recognized by Perl's open(), the attacker forces the module to open the file in write mode rather than read mode. Exploitation requires that user-controlled input reaches the key-loading API, which is reachable over the network in web applications that expose key management features.
No verified public proof-of-concept code is associated with this CVE. The patch diff for lib/Crypt/DSA/Key.pm between versions 1.19 and 1.20 on MetaCPAN illustrates the corrective change.
Detection Methods for CVE-2026-8704
Indicators of Compromise
- Unexpected truncation or overwriting of files writable by the Perl process running Crypt::DSA
- Audit log entries showing Crypt::DSA::Key operations with filenames containing leading >, <, or | characters
- New or modified files in directories accessed by services depending on Crypt-DSA 1.19 or earlier
Detection Strategies
- Inventory installed Perl modules and flag any host with Crypt-DSA at version 1.19 or earlier using cpan -l or distribution package managers
- Perform static code review of Perl applications for calls to Crypt::DSA::Key that pass non-constant or externally derived filename arguments
- Monitor file integrity on directories used by services that consume DSA keys to identify unauthorized writes
Monitoring Recommendations
- Enable Linux auditd rules on open() and openat() syscalls performed by Perl interpreters servicing untrusted input
- Forward web application logs that capture filename or key identifier parameters and search for shell metacharacters
- Alert on Perl process writes to sensitive paths such as /etc, application configuration directories, and key storage locations
How to Mitigate CVE-2026-8704
Immediate Actions Required
- Upgrade Crypt::DSA to version 1.20 or later from CPAN on all affected systems
- Audit application code for any direct use of 2-argument open() with externally influenced paths and refactor to the 3-argument form
- Validate and canonicalize filename inputs before passing them to cryptographic key-loading APIs
Patch Information
The maintainer released Crypt-DSA 1.20 on CPAN, replacing the unsafe open() call in lib/Crypt/DSA/Key.pm with the 3-argument form. Review the fix in the MetaCPAN Release Diff and the changelog in the MetaCPAN Release Changes. Disclosure details are available in the Openwall OSS-Security Post.
Workarounds
- Restrict the user accounts running Perl services so they cannot write to sensitive files outside their working directory
- Sanitize or reject filename inputs containing leading >, <, |, or trailing whitespace before they reach Crypt::DSA
- Run vulnerable services under mandatory access control profiles such as AppArmor or SELinux until the upgrade is completed
# Upgrade Crypt-DSA on affected hosts
cpanm Crypt::DSA@1.20
# Verify installed version
perl -MCrypt::DSA -e 'print $Crypt::DSA::VERSION, "\n"'
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

