Skip to content
Access control Disclosed report Intermediate

Named pipe connection inteception

MariaDB on Windows sets an incorrect security descriptor on its named pipe server, allowing any local user to create pipe server instances. An attacker can intercept connections between local clients and the server, read all data in clear text, and execute arbitrary SQL commands as the connected user.

gabriel_sztejnworcel Follow

Originally disclosed on HackerOne

High 7.8 View original
  • Fixed in 24 hours
  • Disclosed after 51 days

With MariaDB running on Windows, when local clients connect to the server over named pipes, it's possible for an unprivileged user with an ability to run code on the server machine to intercept the named pipe connection and act as a man-in-the-middle, gaining access to all the data passed between the client and the server, and getting the ability to run arbitrary SQL commands on behalf of the connected user.

On Windows, MariaDB allows local clients to connect to the server over named pipes. Unfortunately, when creating the named pipe server, the security descriptor is not set correctly, and as a result every user on the system can create pipe server instances. This allows for the following attack scenario:

  1. The attacker creates a pipe server instance and waits for a client to connect to it.
  2. Once a client is connected, the attacker connects to the real pipe server instance as a client.
  3. At this point, the attacker is connected to the legitimate client and server, and can pass the messages back and forth, reading the messages (as they are passed in clear text) and possibly changing the messages.

Please see the attached report and POC tool for more information.

Impact

  • All the SQL requests/responses from the intercepted connection
  • Ability to run SQL commands

The original report as published on HackerOne, by gabriel_sztejnworcel. 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 named pipe server was created with a security descriptor that grants all local users the right to create pipe server instances, instead of restricting it to the service account.

Impact

An attacker could read all SQL requests and responses and run arbitrary SQL commands as the connected user, but only if they can already run code on the server machine.

What the attacker needed

MariaDB running on Windows; Attacker can run code on the server machine; Local client connects over named pipes

The fix

The named pipe server should be created with a correctly set security descriptor so that not every local user can create pipe server instances.

How it was found

  1. The attacker creates a pipe server instance and waits for a client to connect to it.
  2. Once a client is connected, the attacker connects to the real pipe server instance as a client.
  3. The attacker then relays messages between the legitimate client and server, reading and possibly modifying them.

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.

On Windows, programs can talk to each other through a special channel called a named pipe. MariaDB, a database server, uses such a pipe for local connections, but it did not protect the pipe properly, so any user on the same machine could pretend to be the server. This let an attacker sit in the middle, read everything sent, and even send their own database commands as if they were the legitimate user.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More from MariaDB

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.