Skip to content
RCE Write-up Intermediate

From RCE to LDAP Access

The website's AJAX endpoint allowed calling arbitrary PHP functions without proper input validation, enabling remote code execution. An attacker could execute system commands, read configuration files containing database and LDAP credentials, and access sensitive employee data.

medium.com

Published on medium.com

This is my second write-up, feel free to give me feedback on Twitter (@thibeaultchenu) or in the comments to help me. 🙂

The author, on medium.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

Impact

An attacker could execute arbitrary commands, access about twenty databases, read LDAP data of 40,000 people including personal details and clear-text passwords, and potentially send SMS alerts to all employees.

What the attacker needed

No authentication required; Knowledge of AJAX endpoint parameters

The fix

The company was alerted and fixed the RCE flaw.

How it was found

  1. Send an AJAX request with the class parameter removed to call phpinfo().
  2. Use the system function with an args parameter to execute arbitrary commands.
  3. Retrieve configuration files to obtain database and LDAP credentials.
  4. Connect to the LDAP server using the credentials to access user information.

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.

The website had a feature that let users request information, but it didn't check what functions were being called. By manipulating the request, an attacker could run commands on the server, like a remote control. This let them read secret files with passwords and access a directory of employee details.

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.