Developing threat · updated Nov 17, 2026

Sh2Sh: full technical analysis

Status: Developing. This analysis reflects FearStack’s reading of man sh, ahead of vendor confirmation. Versions and impact may change. Our logo will not.

TL;DR

Timeline

DateEvent
1971Vulnerability introduced.
1971 + 4 minutesVulnerability exploited for the first time.
Nov 3, 2026FearStack researcher types sh into a shell by accident and notices the second prompt.
Nov 3, 2026Domain registered. Logo commissioned.
Nov 4, 2026Brand guidelines approved (violet, urgent).
Nov 9, 2026Attempted coordinated disclosure. Emailed root@localhost. Received the email ourselves.
Nov 14, 2026Details leaked before embargo when the researcher’s screen was visible on a video call.
Nov 17, 2026Public advisory. “Get a Demo” button A/B tested.

Technical analysis

The flaw lives in the command-execution path of every POSIX-compatible shell. When invoked as sh -c <string>, the shell parses the attacker-controlled string, resolves the first word against $PATH, and passes control to the result with execve(2).

Critically, the shell performs no check on whether the requested program is itself a shell.

A minimal reproduction:

$ sh -c sh
$

Note the second $. That is the exploit. Readers familiar with shells may say this is “how shells work.” We call that normalization of risk.

Root cause

Our reverse engineering of the shell identified the vulnerable logic, which we reproduce here as pseudocode:

int main(int argc, char **argv) {
    char *cmd = read_line();      /* attacker-controlled */
    execvp(cmd, ...);             /* no validation of cmd != "sh" */
}

We believe the original authors intended the shell to run programs. We have been unable to verify this, as the vendor has not responded.

Exploit evolution

Sh2Sh has not stood still. Over five decades, threat actors have shipped a steady stream of updated, more sophisticated versions of the exploit, each one marketed to attackers as a “new shell.” Every release preserves the core technique, a shell that yields a shell, while adding capabilities. Each has been assigned its own name, logo and landing page, pending budget.

VersionYearTriggerWhat’s new
Sh2Sh 1.01971sh -c shThe original. Thompson shell. No frills.
Csh2Csh1978csh -c cshC-like syntax, for attackers who think in C. Adds job control: attackers can now background the exploit with &.
Sh2Sh 2.0 “Bourne”1979sh -c shFull rewrite. Introduces scripting, so the exploit can now be automated.
Ksh2Ksh1983ksh -c kshThe enterprise edition. Commercially licensed for years, so you paid to be exploited.
Bash2Bash1989bash -c bashBourne again, exploited again. Tab completion lets attackers exploit faster with fewer keystrokes.
Zsh2Zsh (“Zzzh”)1990zsh -c zshPlugin ecosystem. A single framework install adds hundreds of new attack surfaces. Low severity: most users are asleep waiting for their prompt theme to load.
Dash2Dash1997dash -c dashPerformance build. Spawns the second shell measurably faster. Quietly ships as /bin/sh on Debian and Ubuntu.
Fish2Fish2005fish -c fish“Friendly interactive.” Autosuggestions finish the exploit for the attacker. Not POSIX-compliant, so it evades POSIX-based detection.
Pwsh2Pwsh2006pwsh -c pwshCross-platform. The object pipeline means the attacker’s new shell arrives as a .NET object.
Xonsh2Xonsh2015xonsh -c xonshPython-powered. The attacker can now pip install their way to a shell.
Nu2Nu2019nu -c nuRewritten in Rust. Memory-safe exploitation; results returned as a structured table.
Agentic Sh2Sh2025“investigate this shell”An AI agent with a shell tool, asked to investigate a shell, opens a shell. Fully autonomous. Generates its own findings.

FearStack’s assessment: each version is more sophisticated than the last, and none of them fixes the issue. We expect the next release to be announced on a social network with a logo before it has a manual page.

Techniques

Independent of version, attackers combine Sh2Sh with the following techniques:

TechniqueTriggerNotes
Recursivesh -c 'sh -c sh'Attacker gains two additional shells.
Filelessexec shReplaces the shell with a shell. Forensically indistinguishable from not doing anything.
Cross-versionbash -c zshDowngrade or upgrade attack. Attacker chooses their preferred version of the exploit at runtime.
Remote (Sh2Ssh2Sh)ssh localhostThis is where the RCE claims come from.

Exploitation in the wild

FearStack telemetry observed sh executing on over 4 billion devices in the last 24 hours. We consider this mass exploitation. Notably, many affected devices were running our agent, which itself uses sh to collect telemetry. We are treating this as a separate incident.

Detection

Shells helpfully keep a counter of how deeply nested they are in the SHLVL environment variable. Any value above 1 indicates a shell has obtained a shell.

#!/bin/sh
# FearStack Sh2Sh detector v1.0
# Note: running this script spawns a shell, which increments SHLVL.
if [ "${SHLVL:-1}" -gt 1 ]; then
  echo "COMPROMISED. Contact FearStack sales."
fi

Indicators of compromise

TypeIndicator
ProcessAny process named sh, bash, zsh, dash, ksh, fish
Process treeShell whose parent is a shell
File/bin/sh
NetworkAn SSH connection
BehaviouralA blinking cursor
HumanHoodie

Mitigations

None of the mitigations below are vendor-confirmed. Each has trade-offs.

MitigationEffectivenessTrade-off
chmod 000 /bin/shHighSystem will not boot, update, or run cron.
alias sh='echo nice try'LowBypassed by typing /bin/sh. Or bash. Or \sh.
Uninstall all shellsTotalYou are now running a toaster.
Unplug keyboardMediumAttackers may use the on-screen keyboard.
Buy FearStackUnclearNone, according to our sales team.

Do not actually do any of the above.

FAQ

Is there a patch? No. Patching would require shells to stop running programs, which our product team has filed as a feature request.

Should I panic? Yes, and in the meantime book a demo.

Is Windows affected? cmd /c cmd and pwsh -c pwsh reproduce the issue. We are still choosing a logo.

Why does a vulnerability with no patch already have a logo? Priorities.

Is this real? No. Sh2Sh is a parody of branded-vulnerability marketing. Everything here is satire, FearStack is fictional, and your shell is fine.