Skip to content
SQL injection Write-up Advanced

Technical Analysis

A SQL injection in dotCMS's Push Publishing feature allowed an attacker with Publisher role to inject arbitrary SQL via the delEp parameter, enabling database manipulation and, with the default H2 database, remote code execution. The vulnerable JSP lacked CSRF protection, so an unauthenticated attacker could exploit it by tricking a publisher into visiting a malicious site.

blog.ripstech.com

Published on blog.ripstech.com

The SQL injection vulnerability can be exploited as an unauthenticated attacker via CSRF or as a user of the role Publisher. An attacker is able to execute stacked SQL queries which means it is possible to manipulate arbitrary database entries and even execute shell commands when the H2 database is used.

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 concatenated unsanitised user input directly into a SQL DELETE statement instead of using a prepared statement.

Impact

An attacker could manipulate arbitrary database entries and, when the H2 database is used, execute shell commands; with other databases, remote code execution might still be possible by creating an admin user or overwriting serialized objects.

What the attacker needed

Publisher role or CSRF against a publisher; an unpushed bundle in the queue; H2 database for RCE

How it was found

  1. As a Publisher, push a bundle to the publishing queue so an unpushed bundle exists.
  2. Send a request to view_unpushed_bundles.jsp with the delEp parameter containing SQL syntax.
  3. The parameter is passed to deleteEndPointById(), then to completeDiscardConflicts(), then to discardConflicts(), where it is concatenated into a DELETE query.
  4. The resulting SQL is executed via DotConnect.executeStatement(), allowing stacked queries.
  5. With the H2 database, create a function alias containing Java code and call it to execute 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.

SQL injection is when user input is inserted into a database command without proper cleaning, letting an attacker change the command. Here, a web page took a parameter and put it directly into a DELETE statement, so an attacker could run their own database commands. Because the page had no protection against cross-site request forgery (CSRF), an attacker could make a logged-in publisher's browser send the malicious request without the publisher knowing.

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.