Sites using adminer script for their sql databases are easily compromised - January 17, 2019¶
Exploitation happens in three stages. First, the attacker needs a modified MySQL server, which is altered to send out data import requests to any client that connects.
Second, an attacker needs to find an open
adminer.php on the victim system. That is not hard, as many people install it in the root of their site. Once found, the attacker can instruct Adminer to connect to his rigged MySQL server (external connections are actually a feature of Adminer):
Adminer will then connect to the foreign server, login with the credentials, and immediately receive a data import request from the server for a specific file. Here is an example session, where Adminer sends the contents of local.xml (where Magento stores it secret database password) to the attacker-controlled server.
Third stage: as the attacker now has the master password for the victim site, he can use the same Adminer to access the database of the victim. And continue to steal private data or inject a skimmer.
Abuse in the wild¶
Update Jan 18th: Twitter user Yasho made a similar discovery and wrote about it in August 2018.
- Remove Adminer script.
- I would recommend anyone running Adminer to upgrade to the latest version (4.7.0).
- Also, I urge anyone to protect their database tools via an additional password and/or IP filter. Sometimes perpetrators can obtain your database password by other means, and an open Adminer makes life very easy for them.
Original post and investigation from willem’s lab blog