Skip to content
RCE Write-up Advanced

[Blog] CVE-2019-19470: Rumble in the Pipe

TinyWall's named pipe server deserialized untrusted data using BinaryFormatter, and its authentication check could be bypassed by faking the client process's MainModule.FileName via PEB manipulation. An authenticated local user could therefore execute code as SYSTEM.

code-white.com

Published on code-white.com

This blog post describes an interesting privilege escalation from a local user to SYSTEM for a well-known local firewall solution called TinyWall in versions prior to 2.1.13. Besides a .NET deserialization flaw through Named Pipe communication, an authentication bypass is explained as well.

The author, on code-white.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

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

How it worked

Root cause

The server used BinaryFormatter to deserialize data from a named pipe accessible to any authenticated user, and its authentication check relied on a spoofable process property (MainModule.FileName) that can be altered via the Process Environment Block.

Impact

An authenticated local user could execute arbitrary code as SYSTEM, leading to full privilege escalation.

What the attacker needed

Local access to the machine; authenticated user context

The fix

The vulnerability was fixed in version 2.1.13.

How it was found

  1. Start the TinyWall binary from a debugger to satisfy the MainModule.FileName check.
  2. Set a breakpoint before the client writes to the pipe.
  3. Replace the serialized object with a malicious one created using ysoserial.NET and the TypeConfuseDelegate gadget.
  4. Release the breakpoint to trigger deserialization and execute code as SYSTEM.
  5. To avoid the debugger, modify the Masquerade-PEB PowerShell script to fake the MainModule.FileName.
  6. Import the modified script into a C# exploit, connect to the TinyWallController named pipe, and send the malicious serialized object.

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

TinyWall is a firewall program that runs a background service with high privileges (SYSTEM). It accepts messages from user programs through a Windows feature called a named pipe, and it turns those messages back into objects without checking if they are safe. An attacker can send a malicious object that runs code, and they can also trick the service into thinking the message came from a trusted program, so the code runs with the service's high privileges.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.