[arpping] Remote Code Execution
The arpping npm package builds shell commands from caller-supplied host values without sanitising them, so a crafted host string runs extra commands. An attacker who can influence the input passed to the ping or arp functions could execute arbitrary commands on the machine running the module.
- Fixed in 3 months
- Disclosed after 4 months
I would like to report RCE in arpping
It allows to execute arbitrary commands on the victim's PC
Module
module name: arpping
version: 2.0.0
npm page: https://www.npmjs.com/package/arpping
Module Description
Discover and search for internet-connected devices (locally) using ping and arp
Module Stats
[16] weekly downloads
Vulnerability
Vulnerability Description
Code injection occurs when using commands: ping, arp
Steps To Reproduce:
- Create and run the following POC index.js:
const Arpping = require('arpping');
var arpping = new Arpping();
arpping.ping(["127.0.0.1;touch HACKED;"]); // arpping.arp(["127.0.0.1; touch HACKED;"]);
- The exploit worked and created the file -
HACKED
Patch
Check input before command
Wrap up
- I contacted the maintainer to let them know: [N]
- I opened an issue in the related repository: [N]
Impact
Command Injection on arpping module via insecure command
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 module concatenates user-supplied host values into a shell command string instead of passing them as separate arguments or validating them.
Impact
Arbitrary commands can be executed on the victim's PC when using the ping or arp functions.
What the attacker needed
Attacker controls the host value passed to the module
How it was found
- Create a small script that loads the arpping module and calls its ping function with a host value containing a shell separator and a second command.
- Run the script.
- Observe that the extra command executed and created a file on the machine.
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.
This package runs the system ping and arp programs to find devices on a local network. It pastes whatever host value it is given straight into a shell command, so a value containing a shell separator makes the computer run a second, unintended command. Anyone who can get their text into that host value can then run their own commands on the victim's machine.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.