Description
File::Find::Rule through 0.34 for Perl is vulnerable to Arbitrary Code Execution when `grep()` encounters a crafted filename. A file handle is opened with the 2 argument form of `open()` allowing an attacker controlled filename to provide the MODE parameter to `open()`, turning the filename into a command to be executed. Example: $ mkdir /tmp/poc; echo > "/tmp/poc/|id" $ perl -MFile::Find::Rule \ -E 'File::Find::Rule->grep("foo")->in("/tmp/poc")' uid=1000(user) gid=1000(user) groups=1000(user),100(users)
Problem types
CWE-78 Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
Product status
Any version
Timeline
| 2011-01-04: | A bug was reported by Kevin Ryde to the upstream RT bugtracker described as "grep() can truncate files". |
| 2025-06-04: | CPANSec became aware of the bug and started triage. Code execution impact was confirmed, a patch was made, and the author, the distros list and additional downstream vendors were notified. |
| 2025-06-05: | The author released File::Find::Rule 0.35. |
References
github.com/richardc/perl-file-find-rule/pull/4
lists.debian.org/debian-lts-announce/2025/06/msg00006.html
www.openwall.com/lists/oss-security/2025/06/05/4
www.openwall.com/lists/oss-security/2025/06/06/1
www.openwall.com/lists/oss-security/2025/06/06/3
metacpan.org/...-Find-Rule-0.34/source/lib/File/Find/Rule.pm
rt.cpan.org/Public/Bug/Display.html?id=64504
github.com/richardc/perl-file-find-rule/pull/4
github.com/...df58128bcee4c1da78c34d7f3fe1357e575ad56f.patch