Skip to content
RCE Write-up Intermediate

RCE - LimeSurvey (CVE-2018-7556)

The LimeSurvey installer could be re-run after installation by supplying a POST parameter, and the database username was written into a PHP config file with insufficient escaping. An attacker could inject PHP code into that file and execute commands on the server.

Học sâu Follow

Published on yeuchisme.substack.com

A day in 2018, I was participating in a bug bounty program, and this target caught my attention:

Học sâu, on yeuchisme.substack.com

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

The installer's 'already installed' check was bypassed by sending a POST field, and the database username was written into a PHP config file using addcslashes(), which does not prevent code injection.

Impact

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

What the attacker needed

Reachable installer endpoint; config directory writable by the web server

The fix

The installer check and the escaping of values written into the config file were corrected in versions 2.6.7 LTS, 2.73.1 and 3.4.2.

How it was found

  1. Send a POST request to the installer's database step with the InstallerConfigForm parameter set, so the installation check is skipped.
  2. Supply a crafted database username containing PHP code, which is written into the config file.
  3. Request the config file with a command in the query string to run it as a web shell.

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.

After a web app is installed, its setup pages should be locked so nobody can run them again. Here they could be reopened just by sending an extra form field, and the setup page saved the database username into a code file without properly escaping it. That let an attacker slip their own code into the file, which the server then runs, giving them control of the machine.

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 Học sâu

View all

2 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.