Skip to content
RCE Write-up Intermediate

Perl Jam: When Your Server Starts “Even Flow”-ing Your Secret

Perl CGI scripts that use the diamond operator on a user-controlled parameter can be tricked into executing commands or reading arbitrary files. An attacker could achieve remote code execution without any explicit system() or exec() call.

Arnav Vaidya Follow

Published on rootissh.in

It’s not every day that cybersecurity and ’90s rock collide, but when they do, the bugs “come back like before”. Welcome to the Perl Jam vulnerability — a class of bugs where certain Perl CGI scripts that handle user input without strict validation process user input in unsafe ways, leading to command execution, file…

Arnav Vaidya, on rootissh.in

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the code passes user-controlled input directly to Perl's open() function via the diamond operator, which interprets a trailing pipe as a command to execute.

Impact

An attacker could execute arbitrary commands on the server, leading to full remote code execution.

What the attacker needed

Access to a vulnerable Perl CGI script; ability to send crafted HTTP requests

The fix

The code should avoid passing user input to open() and instead validate or use safer file handling.

How it was found

  1. Send two 'file' parameters: one a malicious string ending in a pipe, the other an actual uploaded file.
  2. The upload check returns true because one value is a file.
  3. The parameter call returns the first value, the malicious string.
  4. The diamond operator performs an implicit open() on that string.
  5. Because the string ends in a pipe, Perl treats it as a command to execute.
  6. The command output is printed in the HTML table.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

Perl is an older programming language still used in some web servers. When a script reads a file whose name comes from the user, Perl may treat special characters in that name as instructions to run a command. This lets an attacker run their own commands on the server.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.