CVE-2013-7345
NoneCVSS
—
EPSS
3.0%
Published
Mar 24, 2014
CISA due date
—
Cloudanix analysis
A flaw in a common tool that identifies file types lets attackers send specially made text files that can make computers slow down or stop responding.
- Exploitation
- Remote Unauthenticated
- Attacker needs
- None
- Complexity
- Low
- Impact
- Denial Of Service
- Component
- Application
- Class
- Denial of service
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
The BEGIN regex in the awk script detector uses multiple wildcards with unlimited repetitions, enabling catastrophic backtracking on crafted input containing many newline characters and resulting in excessive CPU consumption.
Why it matters to the business
Attackers can remotely trigger high CPU usage that disrupts file identification services, slows down scanning workflows, and may lead to resource exhaustion on systems that process untrusted files.
How an attack unfolds
An attacker crafts an ASCII file containing a large number of newline characters and submits it to any process that invokes the file command or its library; the regex engine in the awk detector enters repeated backtracking, consuming CPU until the process is terminated or the system becomes unresponsive.
How to fix it
Upgrade the file utility to version 5.15 or later on all affected systems; where upgrades are unavailable, implement strict input validation or sandboxing around file-type detection of untrusted content.
How to confirm the fix worked
Verify installed version is 5.15 or newer; test with a file containing 10,000+ consecutive newlines and confirm CPU usage remains bounded.
Typical attack path
- Identify a service or script that invokes the file command or libmagic on attacker-controlled content
- Generate an ASCII file containing thousands of consecutive newline characters
- Submit the crafted file through the normal input path (upload, email attachment, network share)
- Observe sustained high CPU usage on the target process until manual intervention or timeout
How to detect it
Review system and application logs for repeated invocations of the file command or PHP fileinfo functions processing files with unusually high newline counts; correlate with process CPU metrics showing sustained 100% usage on file-related workers.
What your security team should do
- Prioritize upgrade of the file package to 5.15+ across all Linux distributions and PHP deployments
- Add monitoring for sustained high CPU by the file command or PHP fileinfo module
- Restrict file-type detection to trusted or sandboxed contexts until patches are applied
The record
The BEGIN regular expression in the awk script detector in magic/Magdir/commands in file before 5.15 uses multiple wildcards with unlimited repetitions, which allows context-dependent attackers to cause a denial of service (CPU consumption) via a crafted ASCII file that triggers a large amount of backtracking, as demonstrated via a file with many newline characters.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| Debian:11 | file | 0 | 1:5.17-0.1 |
| Debian:12 | file | 0 | 1:5.17-0.1 |
| Debian:13 | file | 0 | 1:5.17-0.1 |
| Debian:6.0 | file | 0 | 5.04-5+squeeze4 |
| Debian:7 | file | 0 | 5.11-2+deb7u2 |
| Debian:7 | php5 | 0 | 5.4.34-0+deb7u1 |
| Mageia:3 | file | 0 | 5.12-8.3.mga3 |
| Mageia:3 | php | 0 | 5.4.27-1.mga3 |
| Mageia:3 | php-apc | 0 | 3.1.14-7.7.mga3 |
| Mageia:3 | php-gd-bundled | 0 | 5.4.27-1.mga3 |
| Mageia:3 | php-timezonedb | 0 | 2014.2-1.mga3 |
| Mageia:4 | php | 0 | 5.5.11-1.mga4 |
| Mageia:4 | php-apc | 0 | 3.1.15-4.2.mga4 |
| Mageia:4 | php-timezonedb | 0 | 2014.2-1.mga4 |
| Red Hat:enterprise_linux:7::client | php | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::client | php-bcmath | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::client | php-cli | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::client | php-common | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::client | php-dba | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::client | php-debuginfo | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::client | php-devel | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::client | php-embedded | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::client | php-enchant | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::client | php-fpm | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::client | php-gd | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::client | php-intl | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::client | php-ldap | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::client | php-mbstring | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::client | php-mysql | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::client | php-mysqlnd | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::client | php-odbc | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::client | php-pdo | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::client | php-pgsql | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::client | php-process | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::client | php-pspell | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::client | php-recode | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::client | php-snmp | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::client | php-soap | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::client | php-xml | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::client | php-xmlrpc | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::computenode | php | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::computenode | php-bcmath | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::computenode | php-cli | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::computenode | php-common | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::computenode | php-dba | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::computenode | php-debuginfo | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::computenode | php-devel | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::computenode | php-embedded | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::computenode | php-enchant | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::computenode | php-fpm | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::computenode | php-gd | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::computenode | php-intl | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::computenode | php-ldap | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::computenode | php-mbstring | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::computenode | php-mysql | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::computenode | php-mysqlnd | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::computenode | php-odbc | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::computenode | php-pdo | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::computenode | php-pgsql | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::computenode | php-process | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::computenode | php-pspell | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::computenode | php-recode | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::computenode | php-snmp | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::computenode | php-soap | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::computenode | php-xml | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::computenode | php-xmlrpc | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::server | php | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::server | php-bcmath | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::server | php-cli | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::server | php-common | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::server | php-dba | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::server | php-debuginfo | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::server | php-devel | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::server | php-embedded | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::server | php-enchant | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::server | php-fpm | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::server | php-gd | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::server | php-intl | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::server | php-ldap | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::server | php-mbstring | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::server | php-mysql | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::server | php-mysqlnd | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::server | php-odbc | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::server | php-pdo | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::server | php-pgsql | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::server | php-process | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::server | php-pspell | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::server | php-recode | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::server | php-snmp | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::server | php-soap | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::server | php-xml | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::server | php-xmlrpc | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::workstation | php | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::workstation | php-bcmath | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::workstation | php-cli | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::workstation | php-common | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::workstation | php-dba | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::workstation | php-debuginfo | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::workstation | php-devel | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::workstation | php-embedded | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::workstation | php-enchant | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::workstation | php-fpm | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::workstation | php-gd | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::workstation | php-intl | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::workstation | php-ldap | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::workstation | php-mbstring | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::workstation | php-mysql | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::workstation | php-mysqlnd | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::workstation | php-odbc | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::workstation | php-pdo | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::workstation | php-pgsql | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::workstation | php-process | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::workstation | php-pspell | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::workstation | php-recode | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::workstation | php-snmp | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::workstation | php-soap | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::workstation | php-xml | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:enterprise_linux:7::workstation | php-xmlrpc | 0 | 0:5.4.16-23.el7_0 |
| Red Hat:rhel_software_collections:1::el6 | php54-php | 0 | 0:5.4.16-22.el6 |
| Red Hat:rhel_software_collections:1::el6 | php54-php-bcmath | 0 | 0:5.4.16-22.el6 |
| Red Hat:rhel_software_collections:1::el6 | php54-php-cli | 0 | 0:5.4.16-22.el6 |
| Red Hat:rhel_software_collections:1::el6 | php54-php-common | 0 | 0:5.4.16-22.el6 |
| Red Hat:rhel_software_collections:1::el6 | php54-php-dba | 0 | 0:5.4.16-22.el6 |
| Red Hat:rhel_software_collections:1::el6 | php54-php-debuginfo | 0 | 0:5.4.16-22.el6 |
| Red Hat:rhel_software_collections:1::el6 | php54-php-devel | 0 | 0:5.4.16-22.el6 |
| Red Hat:rhel_software_collections:1::el6 | php54-php-enchant | 0 | 0:5.4.16-22.el6 |
| Red Hat:rhel_software_collections:1::el6 | php54-php-fpm | 0 | 0:5.4.16-22.el6 |
| Red Hat:rhel_software_collections:1::el6 | php54-php-gd | 0 | 0:5.4.16-22.el6 |
| Red Hat:rhel_software_collections:1::el6 | php54-php-imap | 0 | 0:5.4.16-22.el6 |
| Red Hat:rhel_software_collections:1::el6 | php54-php-intl | 0 | 0:5.4.16-22.el6 |
| Red Hat:rhel_software_collections:1::el6 | php54-php-ldap | 0 | 0:5.4.16-22.el6 |
| Red Hat:rhel_software_collections:1::el6 | php54-php-mbstring | 0 | 0:5.4.16-22.el6 |
| Red Hat:rhel_software_collections:1::el6 | php54-php-mysqlnd | 0 | 0:5.4.16-22.el6 |
| Red Hat:rhel_software_collections:1::el6 | php54-php-odbc | 0 | 0:5.4.16-22.el6 |
| Red Hat:rhel_software_collections:1::el6 | php54-php-pdo | 0 | 0:5.4.16-22.el6 |
| Red Hat:rhel_software_collections:1::el6 | php54-php-pgsql | 0 | 0:5.4.16-22.el6 |
| Red Hat:rhel_software_collections:1::el6 | php54-php-process | 0 | 0:5.4.16-22.el6 |
| Red Hat:rhel_software_collections:1::el6 | php54-php-pspell | 0 | 0:5.4.16-22.el6 |
| Red Hat:rhel_software_collections:1::el6 | php54-php-recode | 0 | 0:5.4.16-22.el6 |
| Red Hat:rhel_software_collections:1::el6 | php54-php-snmp | 0 | 0:5.4.16-22.el6 |
| Red Hat:rhel_software_collections:1::el6 | php54-php-soap | 0 | 0:5.4.16-22.el6 |
| Red Hat:rhel_software_collections:1::el6 | php54-php-tidy | 0 | 0:5.4.16-22.el6 |
| Red Hat:rhel_software_collections:1::el6 | php54-php-xml | 0 | 0:5.4.16-22.el6 |
| Red Hat:rhel_software_collections:1::el6 | php54-php-xmlrpc | 0 | 0:5.4.16-22.el6 |
| Red Hat:rhel_software_collections:1::el7 | php54-php | 0 | 0:5.4.16-22.el7 |
| Red Hat:rhel_software_collections:1::el7 | php54-php-bcmath | 0 | 0:5.4.16-22.el7 |
| Red Hat:rhel_software_collections:1::el7 | php54-php-cli | 0 | 0:5.4.16-22.el7 |
| Red Hat:rhel_software_collections:1::el7 | php54-php-common | 0 | 0:5.4.16-22.el7 |
| Red Hat:rhel_software_collections:1::el7 | php54-php-dba | 0 | 0:5.4.16-22.el7 |
| Red Hat:rhel_software_collections:1::el7 | php54-php-debuginfo | 0 | 0:5.4.16-22.el7 |
| Red Hat:rhel_software_collections:1::el7 | php54-php-devel | 0 | 0:5.4.16-22.el7 |
| Red Hat:rhel_software_collections:1::el7 | php54-php-enchant | 0 | 0:5.4.16-22.el7 |
| Red Hat:rhel_software_collections:1::el7 | php54-php-fpm | 0 | 0:5.4.16-22.el7 |
| Red Hat:rhel_software_collections:1::el7 | php54-php-gd | 0 | 0:5.4.16-22.el7 |
| Red Hat:rhel_software_collections:1::el7 | php54-php-intl | 0 | 0:5.4.16-22.el7 |
| Red Hat:rhel_software_collections:1::el7 | php54-php-ldap | 0 | 0:5.4.16-22.el7 |
| Red Hat:rhel_software_collections:1::el7 | php54-php-mbstring | 0 | 0:5.4.16-22.el7 |
| Red Hat:rhel_software_collections:1::el7 | php54-php-mysqlnd | 0 | 0:5.4.16-22.el7 |
| Red Hat:rhel_software_collections:1::el7 | php54-php-odbc | 0 | 0:5.4.16-22.el7 |
| Red Hat:rhel_software_collections:1::el7 | php54-php-pdo | 0 | 0:5.4.16-22.el7 |
| Red Hat:rhel_software_collections:1::el7 | php54-php-pgsql | 0 | 0:5.4.16-22.el7 |
| Red Hat:rhel_software_collections:1::el7 | php54-php-process | 0 | 0:5.4.16-22.el7 |
| Red Hat:rhel_software_collections:1::el7 | php54-php-pspell | 0 | 0:5.4.16-22.el7 |
| Red Hat:rhel_software_collections:1::el7 | php54-php-recode | 0 | 0:5.4.16-22.el7 |
| Red Hat:rhel_software_collections:1::el7 | php54-php-snmp | 0 | 0:5.4.16-22.el7 |
| Red Hat:rhel_software_collections:1::el7 | php54-php-soap | 0 | 0:5.4.16-22.el7 |
| Red Hat:rhel_software_collections:1::el7 | php54-php-xml | 0 | 0:5.4.16-22.el7 |
| Red Hat:rhel_software_collections:1::el7 | php54-php-xmlrpc | 0 | 0:5.4.16-22.el7 |
| Ubuntu:14.04:LTS | file | 0 | 1:5.14-2ubuntu3.1 |
| openSUSE:Tumbleweed | php5 | 0 | 5.6.28-1.1 |
| openSUSE:Tumbleweed | php7 | 0 | 7.0.14-1.4 |
| openSUSE:Tumbleweed | php8 | 0 | 8.0.11-1.1 |
Related vulnerabilities
- CVE-2015-8865 The file_check_mem function in funcs.c in file before 5.23, as used in the Fileinfo… Also affects file
- CVE-2014-9620 The ELF parser in file 5.08 through 5.21 allows remote attackers to cause a denial of… Also affects file
- CVE-2014-8117 softmagic.c in file before 5.21 does not properly limit recursion, which allows remote… Also affects file
- CVE-2014-3710 The donote function in readelf.c in file through 5.20, as used in the Fileinfo component… Also affects file
- CVE-2014-3587 Integer overflow in the cdf_read_property_info function in cdf.c in file through 5.19, as… Also affects file
- CVE-2014-3480 The cdf_count_chain function in cdf.c in file before 5.19, as used in the Fileinfo… Also affects file
- CVE-2014-3478 Buffer overflow in the mconvert function in softmagic.c in file before 5.19, as used in… Also affects file
- CVE-2014-3487 The cdf_read_property_info function in file before 5.19, as used in the Fileinfo… Also affects file