Skip to content
Info disclosure Write-up Advanced

Sometimes they come back: exfiltration through MySQL and CVE-2020-11579

A PHP application (PHPKB) connected to an attacker-controlled MySQL server, and because PHP before 7.2.16 allowed the LOCAL INFILE feature by default, the attacker could read local files from the application server. The attacker could exfiltrate sensitive files such as configuration files containing credentials.

shielder.com

Published on shielder.com

Let’s jump straight to the strange behavior: up until PHP 7.2.16 it was possible by default to exfiltrate local files via the MySQL LOCAL INFILE feature through the connection to a malicious MySQL server. Considering that the previous PHP versions are still the majority in use, these exploits will remain useful for…

The author, on shielder.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 allowed user-controlled database connection settings, and PHP's default enabled LOCAL INFILE let a malicious MySQL server request local files from the client.

Impact

An attacker who can influence the database connection could read local files on the application server, potentially exposing credentials and other sensitive data.

What the attacker needed

PHP before 7.2.16; attacker controls MySQL server; app connects to attacker's MySQL

The fix

The issue was mitigated in PHP 7.2.16 by disabling LOCAL INFILE by default; applications should also not let users control database connection settings.

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.

When a program connects to a database, it normally trusts the database server. If an attacker can make the program connect to their own fake database server, they can abuse a feature called LOCAL INFILE, which lets the server ask the client to send a local file. In older PHP versions this was allowed by default, so the fake server could request files from the application server and receive their contents.

What is Info disclosure?

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.

Similar reports

View all

Same bug class and techniques, clearest first.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.