CVE-2026-120361: FindBin::Bin versions from 4.0.1 before 5.4.0 for Perl execute code from the script's directory name via a string eval
FindBin::Bin versions from 4.0.1 before 5.4.0 for Perl execute code from the script's directory name via a string eval.
The module defines Bin by interpolating the script's directory, or the current directory for perl -e, into a single-quoted literal inside a string eval, without escaping. A single quote in any directory name ends the literal and the rest of the name is compiled as Perl code. FindBin::Bin is installed only on Perl 5.40 and later, and FindBin::libs loads it.
An attacker who can name a directory can run code as any user who runs a script inside it.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
FindBin-libsto a version that resolves this vulnerability.Fixed in 5.4.0
Event History
Frequently Asked Questions
Which systems are exposed to this issue?
Systems running Perl 5.40 or later with FindBin::Bin version 4.0.1 through versions before 5.4.0 are exposed when a script using the affected module, including through FindBin::libs, is run from a directory whose name an attacker can control.
What must an attacker be able to do to exploit it?
The attacker must be able to create or rename a directory so that its name contains a single quote and Perl code, then cause or wait for a user to run an affected script from within that directory. The injected code runs with the privileges of the user running the script.
Are one-line Perl commands affected?
Yes. For perl -e, the module uses the current directory when defining Bin, so a malicious current-directory name can trigger the same code execution.
What can be done before upgrading?
Avoid running affected scripts, including scripts that load FindBin::libs, from directories whose names may be attacker-controlled. Restrict untrusted users from creating or renaming directories in locations where privileged or automated Perl scripts may be executed.