CmdID

CmdID / Programs / Linux and Unix

xargs

Execute a command with piped arguments coming from another command, a file, etc. The input is treated as a single block of text and split into separate pieces on spaces, tabs, newlines, and end-of-file. tldr-pages

GTFOBins file-read, shell 1 ATT&CK technique 4 documented commands

Opens CmdID with your command. It is read in your browser and sent nowhere.

How xargs is abused

documented by GTFOBins

file-read

-aRead arguments from FILE, don't close stdin toybox

shell T1059.004 Command and Scripting Interpreter: Unix Shell

-aRead arguments from FILE, don't close stdin toybox

shell T1059.004 Command and Scripting Interpreter: Unix Shell

-oOpen tty for COMMAND's stdin (default /dev/null) toybox
-aRead arguments from FILE, don't close stdin toybox

Each abuse is GTFOBins's category and the options and words it uses; the full write-up is on GTFOBins's page for xargs.

4 documented commands

from GTFOBins, each read by CmdID

file-read unprivileged, with sudo, as SUID

xargs -a /path/to/input-file -0
Identify

shell unprivileged, with sudo, as SUID

xargs -a /dev/null /bin/sh
Identify

As SUID:

xargs -a /dev/null /bin/sh -p

shell unprivileged, with sudo, as SUID

xargs -a /dev/null /bin/sh
Identify

As SUID:

xargs -a /dev/null /bin/sh -p

shell unprivileged, with sudo, as SUID

echo x | xargs -o -a /dev/null /bin/sh
Identify

As SUID:

echo x | xargs -o -a /dev/null /bin/sh -p

None of the 4 commands CmdID reads trips a Sigma process-creation rule. These commands are from GTFOBins, at commit acd524623f9c of 2026-05-27, under the GPL-3.0, with no warranty. Changed: Markdown is shown formatted. The source is in lolbas-gtfobins-commands.json.gz, and the full entry is on GTFOBins’s page for xargs. CmdID reads the line of each that runs xargs.

What detects it

Sigma process creation rules
T1059.004Command and Scripting Interpreter: Unix Shell

Everyday use

from tldr-pages, CC BY 4.0

Run a command using the input data as arguments

arguments_source | xargs commandIdentify

Run multiple chained commands on the input data

arguments_source | xargs sh -c "command1 && command2 | command3"Identify

Execute a new command with each argument

arguments_source | xargs --max-args 1 commandIdentify

None of the 3 examples CmdID reads matches GTFOBins abuse or trips a Sigma process-creation rule.

Options

11 in toybox
Show every option of xargs
-0Each argument is NULL terminated, no whitespace or quote processing
-a FILERead arguments from FILE, don't close stdin
-E STRStop at line matching string
-n STRMax number of arguments per command
-oOpen tty for COMMAND's stdin (default /dev/null)
-PParallel processes (default 1)
-pPrompt for y/n from tty before running each command
-rDon't run with empty input (otherwise always run command once)
-s STRSize in bytes per command line
-tTrace, print command line to stderr
--process-slot-var NAMESet environment variable NAME in children