Skip to content
Path traversal Disclosed report Advanced

Path traversal in command line client

The MariaDB command line client has a directory traversal vulnerability that allows a malicious server to cause the client to load arbitrary shared libraries from the victim's filesystem. In rare cases where the attacker controls a file at a known location, this can lead to code execution.

lixtelnis Follow

Originally disclosed on HackerOne

Medium 4.5 View original
  • Triaged in 14 days
  • Fixed in 25 days
  • Disclosed after 11 months

The command line client has a directory traversal bug which allows server chosen files to be dlopened when it connects to a malicious server.

The path can also be padded with / characters so that strxnmov drops the .so extension.

The dlopen call is performed here: https://github.com/MariaDB/server/blob/10.5/sql-common/client_plugin.c#L368

Impact

In rare situations where the attacker controls a file at a known location on the victim's machine this can lead to code execution using init/fini functions. See attached dlopen.sh.

Other side effects present in commonly installed software are not to be neglected. The mecanism is far from being uncommon in C files alone according to this search:

https://codesearch.debian.net/search?q=__attribute__.*constructor+filetype%3Ac&perpkg=1

Without abusing the path traversal bug the dialog plugin might also be used to fool a user into sending its password unhashed. See attached dialog.sh.

The original report as published on HackerOne, by lixtelnis. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the client does not properly validate the plugin path received from the server, allowing directory traversal sequences and padding to bypass extension checks before calling dlopen.

Impact

In rare situations where the attacker controls a file at a known location on the victim's machine this can lead to code execution using `init/fini` functions.

What the attacker needed

Victim connects to a malicious server; attacker controls a file at a known location

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 report has not been written yet. The Original tab links to the source.

When you connect to a database server, the client program may load extra code from files on your computer. This report shows that a malicious server can trick the client into loading a file from anywhere on your disk, not just the intended folder. If an attacker can place a harmful file in a known location, they could run their own code on your machine.

What is Path traversal?

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.

More from MariaDB

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Path traversal and file inclusion

The lesson behind this report.

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.