Skip to content
RCE Write-up Intermediate

CS-Cart PDF Plugin Unauthenticated Command Injection

The CS-Cart HTML to PDF converter service builds a shell command from an unvalidated transaction_id parameter, allowing an unauthenticated attacker to inject commands and achieve remote code execution. The vendor's hosted service was fixed, but self-hosted instances remain vulnerable unless updated.

Ngo Wei Lin Follow

Published on starlabs.sg

A command injection vulnerability exists in CS-Cart’s HTML to PDF converter (https://github.com/cscart/pdf) allowing unauthenticated attackers to achieve remote command execution (RCE). The vulnerability only affects the HTML to PDF converter service and the default hosted service at converter.cart-services.com…

Ngo Wei Lin (@Creastery), on starlabs.sg

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

User input from the transaction_id parameter is used to build file paths and then passed unescaped into a shell command executed with exec().

What the attacker needed

Access to the PDF converter service; self-hosted or unpatched service

The fix

The vendor fixed the hosted service by changing the service logic, and self-hosted users should update; the report also suggests escaping shell arguments with escapeshellarg and validating transaction_id to prevent path traversal.

How it was found

  1. Set up the HTML to PDF converter infrastructure in a Docker environment.
  2. Send a POST request to /pdf/render with a crafted transaction_id containing shell metacharacters.
  3. Navigate to the injected endpoint to execute a command and observe its output.

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.

This report is about a service that turns web pages into PDF files. The service takes a value from the user and puts it directly into a command that the computer runs, without checking it first. Because of that, an attacker can add their own commands and run them 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.

More by Ngo Wei Lin

View all

3 more disclosed reports, best first.

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.