FindBin::libs Makes the Working Directory Part of the Trust Boundary

2026-12-01来源 dev.toEnglish

FindBin::libs Makes the Working Directory Part of the Trust Boundary

Two Perl module issues published on November 30, 2026 show how small environment decisions turn into code-execution paths. CVE-2026-120359 affects FindBin::libs from 4.1.0 before 5.4.0 when the ld_lib option is used. The module adds the current directory to LD_LIBRARY_PATH. CVE-2026-120361 affects FindBin::Bin from 4.0.1 before 5.4.0, where a script directory name reaches a string evaluation path. The fixed release for both is 5.4.0.

The first flaw trusts the directory from which a process starts. If a privileged wrapper, scheduled job, or administrator launches a Perl program from a writable directory, an attacker who can place a library there may influence loader resolution. The second issue trusts the name of the script directory. A path that looks like data can become Perl code under the wrong conditions. Both flaws are local in the ordinary case, but operations teams should not dismiss them as desktop-only bugs. Build runners, shared hosting panels, backup jobs, and incident scripts often run under a privileged account in directories that another user can modify.

Update the modules to 5.4.0 or later and verify that the loaded copy comes from the intended @INC or system path. A package manager may leave a local lib directory ahead of the vendor copy. Run a process inventory that records the script path, working directory, effective user, and module version for scheduled Perl jobs. That inventory turns a vague dependency warning into a concrete list of programs that can be tested.

Remove writable directories from the launch path. Use an absolute working directory owned by the service account, and make parent directories non-writable by unprivileged users. Do not depend on ld_lib to locate production libraries when the runtime can use an explicit, read-only path. Sanitize or avoid embedding directory basenames in code passed to eval. For a wrapper that must run from a user-selected folder, drop privileges before invoking the Perl process and keep the library search path under the wrapper's control.

Test the negative cases. Create a disposable account and a temporary directory with a benign marker file. Launch the affected utility from that directory and verify that the marker cannot influence library resolution or evaluation. Do not test with malicious libraries against production. Record the exit status and runtime trace from the isolated environment.

The fix is a dependency update, but the durable control is a clear boundary between code paths and writable data. Perl's search rules are only one example. Any interpreter that uses the current directory or an environment variable as an implicit search location deserves the same review.

References

原文:https://www.a8q9.cn/en/article/findbin-libs-makes-the-working-directory-part-of-the-trust-boundary-c82e87.html

相关文章