A falha reside no processo de transferência de ficheiros entre um cliente e um servidor MySQL. A falha pode ser explorada por um invasor em que este executa um servidorMySQL não autorizado para aceder quaisquer dados que pudessem ser lidos pelo cliente.
O problema está relacionado à instrução LOAD DATA usada com o modificador LOCAL. A instrução LOAD DATA pode carregar um ficheiro localizado no servidor, e se a palavra-chave LOCAL for usada na solicitação, no host do cliente, o pedido executa com sucesso.
A transferência do ficheiro do cliente para o servidor MySQL é iniciada pelo servidor.
Um cliente recebe solicitações de transferência de ficheiro do servidor MySQL com base nas informações fornecidas na instrução LOAD DATA. Um servidor não autorizado pode enviar uma instrução LOAD DATA LOCAL ao cliente para obter acesso a qualquer ficheiro para o qual o cliente tenha permissão de leitura.
“In theory, a patched server could be built that would tell the client program to transfer a file of the server’s choosing rather than the file named by the client in the LOAD DATA statement.” reads the official documentation.
“Such a server could access any file on the client host to which the client user has read access.”
Os especialistas apontam que o problema também afeta os servidores web que atuam como clientes conetados a um servidor MySQL. Nesse cenário, um invasor pode acionar a vulnerabilidade para roubar ficheiros confidenciais, incluindo o ficheiro /etc/passwd.
Um invasor pode obter acesso a um ficheiro através do seu caminho completo. Também podem ser exfiltradas outras informações do servidor, como chaves SSL, certificados, etc.
The attackers could exploit the flaw to steal cryptocurrency wallets and SSH keys,
De acordo com o investigador Willem de Groot, o APT Magecart explorou esta falha como vetor de ataque para injetar código “skimmer” nos ataques de outubro de 2018.
“Adminer is a popular PHP tool to administer MySQL and PostgreSQL databases. However, it can be lured to disclose arbitrary files. Attackers can abuse that to fetch passwords for popular apps such as Magento and WordPress, and gain control of a site’s database. ” reads a post published by de Groot.
“AFAIK this attack method has not been published before, but in hindsight I have observed it being used by different Magecart factions at least since October 2018 (although I didn’t understand what was going on back then). The vulnerability was subsequently used to inject payment skimmers on several high-profile stores (government & multinationals).”
The expert noticed attackers using Adminer to send the contents of ‘local.xml’ that stores secret database password in Magento installs to the server under their control.
“I have tested Adminer versions 4.3.1 up to 4.6.2 and found all to be vulnerable. Adminer 4.6.3 was released in June, 2018 and appears safe. It is unclear whether the security flaw was fixed deliberately or by accident, as Adminer does not mention a security release.” added the expert.
“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.”