Skip to content
SQL injection Write-up Advanced

Chaining SQL Injection and XSS

BigTree CMS 4.4.6 contains an unsanitised parameter that lets an authenticated administrator override a database table name, enabling SQL injection, and a separate flaw where a user-supplied value beginning with '@' is passed to a file-existence check, leading to Phar deserialisation. An attacker could chain these with a cross-site scripting issue and a stolen CSRF token to extract database contents and potentially achieve remote code execution.

blog.ripstech.com

Published on blog.ripstech.com

We have scanned one of the latest versions of BigTree CMS 4.4.6 and detected multiple vulnerabilities. Among them is a SQL Injection vulnerability and a Phar Deserialization vulnerability leading to a Remote Code Execution in the small web application.

The author, on blog.ripstech.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 the application builds SQL queries and file paths directly from user input without proper sanitisation or validation.

Impact

An attacker could extract sensitive database information and, by chaining with cross-site scripting and a stolen CSRF token, upload a file that leads to remote code execution.

What the attacker needed

Authenticated administrator; victim visits crafted link; attacker can host a file

The fix

The vendor released BigTree 4.4.7 patching the issue.

How it was found

  1. An authenticated administrator visits a crafted URL that sets the 'form' parameter to control the table name used in a SQL query.
  2. The SQL query returns data that the attacker has manipulated to start with 'http', causing the application to treat it as a link.
  3. The application checks the link with a web request and, if it fails, prints the link value without sanitisation, triggering cross-site scripting.
  4. The attacker uses the cross-site scripting to steal a CSRF token and upload a malicious file.
  5. The attacker then visits a URL with a 'code' parameter beginning with '@' and a 'phar://' path, causing the application to check the file and trigger Phar deserialisation.

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 two security holes in a content management system. One lets someone who is already logged in as an administrator change part of a database query, so they can read data they should not see. The other lets a crafted web address cause the server to open a file in a way that can run harmful code. The author shows how these can be combined with a scripting flaw to steal information.

What is SQL injection?

Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.

Similar reports

View all

Same bug class and techniques, clearest first.

SQL injection

The lesson behind this report.

Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.