Skip to content
SQL injection Write-up Intermediate

Ampache SQL injection (CVE-2019-12385)

Ampache contains an SQL injection in the search feature and a stored XSS in the localplay instance name field, which can be combined with CSRF to create an admin account. An attacker could exploit these to steal session cookies or escalate privileges.

tarlogic.com

Published on tarlogic.com

During a Red Team operation, multiple vulnerabilities where discovered in Ampache, an open source web platform for audio/video streaming. CVE codes have been assigned for two of them: CVE-2019-12385 (SQL injection) and CVE-2019-12386 (stored XSS).

Pablo Martinez, on tarlogic.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 steal admin session cookies via SQL injection or, by combining CSRF and stored XSS, force an admin to create a new privileged account with a known password.

What the attacker needed

Ampache <=3.9.1; For SQLi: ability to perform searches (even guest); For XSS: admin visits a malicious page

How it was found

  1. Send a POST request to /search.php?type=song with a crafted rule_1_input parameter containing SQL code.
  2. Observe a 5-second delay confirming the injection.
  3. Reset the admin password to generate a weak 6-character password.
  4. Use the SQL injection to dump the password hash.
  5. Crack the hash using hashcat with the known character sets.
  6. For XSS: submit a form to localplay.php?action=add_instance with a name containing a script tag.

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.

Ampache is a web app for streaming audio and video. Two security holes were found: one lets a user insert database commands through a search box, and another lets an attacker store malicious JavaScript that runs when an admin views a page. Together, these could let an attacker take over an admin account.

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.