CVE-2016-6185
High · 7.8CVSS
7.8
EPSS
0.8%
Published
Aug 2, 2016
CISA due date
—
Cloudanix analysis
A problem in the Perl programming language lets someone who already has access to a computer run their own code by leaving a fake library file in the folder where programs are running.
- Exploitation
- Local Privilege
- Attacker needs
- Local User
- Complexity
- Low
- Impact
- Full Compromise
- Component
- Library
- Class
- Other
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
XSLoader::load fails to resolve .so paths correctly inside string eval, causing Perl to load a library from the current working directory instead of the system path and enabling local arbitrary code execution.
Why it matters to the business
Local attackers can execute arbitrary code on any system running affected Perl versions, leading to full host compromise, data theft, or lateral movement; the issue affects widely used Perl deployments and downstream packages but carries low exploitation likelihood.
How an attack unfolds
An attacker with local access places a malicious .so file matching the expected module name in a directory from which a Perl process will later run, then triggers XSLoader::load inside a string eval context so that the Trojan library is loaded instead of the legitimate one.
How to fix it
Upgrade perl/perl5 to commit c137098022dcef5e7ea32608e5299276efea6457 or later; for prometheus-postgres-exporter-0.10 (Chainguard) upgrade to the fixed 0 release that bundles the patched Perl.
How to confirm the fix worked
Confirm the perl5 source contains commit c137098022dcef5e7ea32608e5299276efea6457; run a test script that calls XSLoader::load in string eval and verify it no longer searches the current working directory.
Typical attack path
- Locate or create a Perl script or module that invokes XSLoader::load inside a string eval
- Compile or copy a malicious .so into the current working directory using the expected module name
- Cause the vulnerable Perl code path to execute (via cron, web request, or scheduled task)
- Malicious library is loaded and attacker code runs with the privileges of the Perl process
How to detect it
Search application and system logs for Perl processes loading unexpected shared libraries; inspect working directories of Perl processes for recently added .so files whose names match modules loaded via XSLoader.
- unexpected .so file matching XSLoader module name in cwd
- Perl process loading library from current working directory instead of system path
What your security team should do
- Immediately patch all Perl installations to the fixed commit or newer release
- Audit codebases for XSLoader usage inside string eval and refactor to avoid the pattern
- Restrict write access to directories used as working directories by Perl processes
- Add filesystem monitoring for unexpected .so files in application working directories
The record
The XSLoader::load method in XSLoader in Perl does not properly locate .so files when called in a string eval, which might allow local users to execute arbitrary code via a Trojan horse library under the current working directory.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| Debian:11 | perl | 0 | 5.22.2-2 |
| Debian:12 | perl | 0 | 5.22.2-2 |
| Debian:13 | perl | 0 | 5.22.2-2 |
| Debian:7 | perl | 0 | 5.14.2-21+deb7u4 |
| Debian:8 | perl | 0 | 5.20.2-3+deb8u6 |
| Mageia:5 | perl-XSLoader | 0 | 0.160.0-7.1.mga5 |
| SUSE:Linux Enterprise Desktop 12 SP1 | perl | 0 | 5.18.2-11.1 |
| SUSE:Linux Enterprise Server 11 SP4 | perl | 0 | 5.10.0-64.80.1 |
| SUSE:Linux Enterprise Server 12 SP1 | perl | 0 | 5.18.2-11.1 |
| SUSE:Linux Enterprise Server for SAP Applications 11 SP4 | perl | 0 | 5.10.0-64.80.1 |
| SUSE:Linux Enterprise Server for SAP Applications 12 SP1 | perl | 0 | 5.18.2-11.1 |
| SUSE:Linux Enterprise Software Development Kit 11 SP4 | perl | 0 | 5.10.0-64.80.1 |
| Ubuntu:14.04:LTS | perl | 0 | 5.18.2-2ubuntu1.4 |
| Ubuntu:16.04:LTS | perl | 0 | 5.22.1-9ubuntu0.3 |
Related vulnerabilities
- CVE-2025-40909 Perl threads have a working directory race condition where file operations may target… Also affects perl
- CVE-2020-16156 CPAN 2.28 allows Signature Verification Bypass. Also affects perl
- CVE-2017-12883 Buffer overflow in the S_grok_bslash_N function in regcomp.c in Perl 5 before 5.24.3-RC1… Also affects perl
- CVE-2017-12837 Heap-based buffer overflow in the S_regatom function in regcomp.c in Perl 5 before… Also affects perl
- CVE-2017-6512 Race condition in the rmtree and remove_tree functions in the File-Path module before… Also affects perl
- CVE-2016-1238 (1) cpan/Archive-Tar/bin/ptar, (2) cpan/Archive-Tar/bin/ptardiff, (3)… Also affects perl
- CVE-2015-8853 The (1) S_reghop3, (2) S_reghop4, and (3) S_reghopmaybe3 functions in regexec.c in Perl… Also affects perl
- CVE-2016-2381 Perl might allow context-dependent attackers to bypass the taint protection mechanism in… Also affects perl