Skip to content
SQL injection Disclosed report Intermediate

SQL injection when configuring a database

The installer's database configuration form did not escape backticks in the database name, allowing an attacker to inject SQL that creates an additional database. An attacker could execute arbitrary SQL statements on the database server during installation.

solov9ev Follow

Originally disclosed on HackerOne

  • Triaged in 15 days
  • Fixed in 3 months
  • Disclosed after 4 months

Summary:

I found a SQL Injection in the form of a system install (Database configuration)

Steps To Reproduce:

  • Run command: git clone https://github.com/ImpressCMS/impresscms.git
  • Stop at a menu item: Database configuration
  • In the Database name field, insert the following exploit:
SQL
 impresscms`;create database `vuln
_________________2020-09-16_21-12-49.png
_________________2020-09-16_21-12-49.png From the original on HackerOne
  • Submit the form
_________________2020-09-16_21-12-49_(_____).png
_________________2020-09-16_21-12-49_(_____).png From the original on HackerOne
  • Two databases (impresscms, vuln) created successfully. POC is attached to the report

Supporting Material/References:

PHP addslashes - single quote ('), double quote ("), backslash, NUL (the NUL byte), but Backtick is not escaped!

Impact

Executing arbitrary code on a database

Attachments

Peek_2020-09-16_21-17.mp4 From the original on HackerOne

The original report as published on HackerOne, by solov9ev. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the installer used PHP's addslashes() to escape the database name, which does not escape backticks, and then placed the name inside backticks in a SQL statement.

Impact

An attacker could execute arbitrary SQL statements on the database server, such as creating additional databases.

What the attacker needed

Access to the installer; ability to submit the database configuration form

How it was found

  1. Clone the ImpressCMS repository.
  2. Start the installer and go to the database configuration step.
  3. Enter a crafted database name containing a backtick and additional SQL.
  4. Submit the form.
  5. Observe that two databases are created.

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 report has not been written yet. The Original tab links to the source.

When you set up a website, you often give it a database name. The installer put that name directly into a database command without properly handling special characters like backticks. This let someone sneak in extra database commands, like creating another database.

What is SQL injection?

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

More by solov9ev

View all

10 more disclosed reports, best first.

More from ImpressCMS

View all

The newest disclosed reports for this program.

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.