Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^3: Vulnerabilities when editing untrusted code... (compiletime injection in regex)

by LanX (Saint)
on Oct 06, 2021 at 15:24 UTC ( [id://11137266]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Vulnerabilities when editing untrusted code... (compiletime injection in regex)
in thread Vulnerabilities when editing untrusted code... (Komodo)

OK the term "eval-group" seems to refer to an optimization which concats 2 strings °

'' =~ ('STRING1'.'STRING2');

but if you don't bother splitting up the BEGIN you can still inject code at compiletime :(

D:\tmp\pm>type unsafe_regex_BEGIN.pl exit; '' =~ m/(?{ BEGIN{ die "owned"} })/ ; D:\tmp\pm>perl -c unsafe_regex_BEGIN.pl owned at unsafe_regex_BEGIN.pl line 2. BEGIN failed--compilation aborted at unsafe_regex_BEGIN.pl line 2. D:\tmp\pm>

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

°) and variable interpolation in general see re#'eval'-mode

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11137266]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (8)
As of 2024-04-18 06:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found