Skip to content
RCE Write-up Advanced

Security Assessment Report: Full Exploit Chain (SQLi to RCE)

A union-based SQL injection in a parameter used in the FROM clause allowed extraction of user credentials, and a leaked backup archive on another subdomain exposed source code revealing cookie-based admin authentication and an insecure file upload. The attacker forged admin cookies and uploaded a .htaccess file plus a PHP shell with a custom extension to achieve remote code execution.

orion7715 Follow

Published on orion7715.medium.com

During a security assessment, I identified a complex multi-stage attack chain across different subdomains of [REDACTEDDOMAIN]. The exploitation began with a Union-Based SQL Injection on [REDACTEDSUBDOMAINA].

Orion, on orion7715.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

Root cause

Likely multiple flaws: unsanitised input in a SQL FROM clause, exposed backup source code, client-side cookie-based authorisation, and an upload handler that allowed .htaccess overrides and executable extensions.

Impact

The attacker could read all user credentials, gain unauthorised administrative access, and execute arbitrary system commands on the server hosting the second subdomain.

What the attacker needed

Network access to the target subdomains; ability to send crafted requests; exposed backup.zip on a subdomain; admin dashboard file upload feature

The fix

The report recommends whitelisting table identifiers and using parameterised queries, moving to server-side sessions, enforcing an upload allow-list with content validation, disabling AllowOverride, using strong salted password hashes, and removing backup files from production.

How it was found

  1. Inject a union-based payload into the system parameter to map the database and extract credentials.
  2. Fuzz directories on another subdomain and find an exposed backup.zip containing full source code.
  3. Analyse the leaked source to learn the cookie names and hash check used for admin sessions.
  4. Set forged admin cookie values in the browser to bypass login and reach the admin dashboard.
  5. Upload a .htaccess file that makes the .orion extension execute as PHP.
  6. Upload a PHP web shell with the .orion extension and trigger it to run system commands.

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 report describes a chain of mistakes. First, a database query was built by inserting user input directly, letting an attacker read data. Second, a backup file left on the web server gave away the site's source code. That code showed the site trusted cookies to decide who is an admin, so the attacker could fake being an admin. Finally, the upload feature let the attacker upload a file that told the server to run another uploaded file as code, giving full control of 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.