repositories

daemon-sec-cheatsheet

The cheatsheet vault for operators: AD, enumeration, exploitation, priv-esc, web, DFIR

clonegit clone https://git.daemon-sec.xyz/daemon-sec-cheatsheet.git
perl-tricks.mdMarkdown80 lines5.6 KiBsource raw download

title: "Perl Command-Execution Sinks" section: "Network Services" sectionSlug: "network-services-pentesting" sourcePath: "src/network-services-pentesting/pentesting-web/perl-tricks.md" sourceUrl: "https://github.com/HackTricks-wiki/hacktricks/blob/188de82beb54e70956b2952367a0af91d26758b8/src/network-services-pentesting/pentesting-web/perl-tricks.md" sha: "188de82beb54e70956b2952367a0af91d26758b8" isIndex: false modified: true license: "CC-BY-NC-4.0"#

Perl Command-Execution Sinks#

Perl backticks/qx// sinks in Apache mod_perl handlers (reachability and exploitation)#

One real-world pattern is Perl code building a shell command and executing it with backticks (qx//). In a mod_perl access handler, request data such as $r->uri() can reach that string before authentication completes. RCE requires both reachable attacker input and shell interpretation; neither mod_perl nor URI access alone creates command injection.[1]

Risky Perl execution primitives include:[4]

Minimal vulnerable shape observed in the wild:[1]

sub getCASURL {
  ...
  my $exec_cmd = "...";
  if ($type eq 'login') {
    $exec_cmd .= $uri;        # $uri from $r->uri() → attacker-controlled
    my $out = `$exec_cmd`;    # backticks = shell
  }
}

Key reachability considerations in mod_perl:[1]

Exploitation workflow [1]#

  1. Inspect httpd.conf for PerlModule/MOD_PERL handler scopes to find a resolvable path processed by the handler.
  2. Send an unauthenticated request so the login redirect path is taken (type == "login").
  3. Place shell metacharacters in the request-URI path so $r->uri() carries your payload into the command string.

Example HTTP PoC (path injection via ';')

GET /ui/health;id HTTP/1.1
Host: target
Connection: close

Payload notes#

Hardening#

Vulnerability hunting#

Real-world case: Dell UnityVSA pre-auth RCE (CVE-2025-36604)[1][2][3]

References#