Skip to content
RCE Write-up Intermediate

What is libnotify?

The libnotify plugin in Metasploit builds a shell command from host and service names without escaping, so a crafted name can inject commands. An attacker who can get a malicious name imported (for example via an nmap XML file) could run commands on the machine running Metasploit.

medium.com

Published on medium.com

In the previous months, our team has been working over a Metasploit plugin to integrate it with Faraday. The plugin named as faradaybridge tries to synchronize the information about hosts, service, or vulnerabilities between both tools.

Faraday Team, on medium.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 plugin passes unescaped host and service names into a shell command via system(), allowing command injection.

Impact

An attacker who can supply a crafted host or service name could execute arbitrary commands on the system running Metasploit, but only if the libnotify plugin is enabled.

What the attacker needed

Libnotify plugin enabled; ability to import crafted host/service names

The fix

The vulnerability was fixed by a pull request that presumably escapes the values before building the command.

How it was found

  1. Create an nmap XML file with a service name that contains shell metacharacters and a command.
  2. Import the XML file into Metasploit.
  3. The plugin's notification callback runs the injected command.

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.

Metasploit is a tool for testing security. Its libnotify plugin shows desktop notifications when new hosts or services are found. The plugin puts the host or service name directly into a command that runs on the computer, so a name containing special characters can make the computer run extra commands. This only affects people who have turned on that plugin.

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.