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
- What: A user with a shell can run
shand receive a shell. - Severity: Critical. CVSS 11.0. We found the calculator’s maximum unhelpful.
- Exploited in the wild: Yes, continuously, since 1971.
- Patch: None. Vendor not identified.
- Stopgap: Exists. Destroys your system. See Mitigations.
Timeline
| Date | Event |
|---|---|
| 1971 | Vulnerability introduced. |
| 1971 + 4 minutes | Vulnerability exploited for the first time. |
| Nov 3, 2026 | FearStack researcher types sh into a shell by accident and notices the second prompt. |
| Nov 3, 2026 | Domain registered. Logo commissioned. |
| Nov 4, 2026 | Brand guidelines approved (violet, urgent). |
| Nov 9, 2026 | Attempted coordinated disclosure. Emailed root@localhost. Received the email ourselves. |
| Nov 14, 2026 | Details leaked before embargo when the researcher’s screen was visible on a video call. |
| Nov 17, 2026 | Public 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.
| Version | Year | Trigger | What’s new |
|---|---|---|---|
| Sh2Sh 1.0 | 1971 | sh -c sh | The original. Thompson shell. No frills. |
| Csh2Csh | 1978 | csh -c csh | C-like syntax, for attackers who think in C. Adds job control: attackers can now background the exploit with &. |
| Sh2Sh 2.0 “Bourne” | 1979 | sh -c sh | Full rewrite. Introduces scripting, so the exploit can now be automated. |
| Ksh2Ksh | 1983 | ksh -c ksh | The enterprise edition. Commercially licensed for years, so you paid to be exploited. |
| Bash2Bash | 1989 | bash -c bash | Bourne again, exploited again. Tab completion lets attackers exploit faster with fewer keystrokes. |
| Zsh2Zsh (“Zzzh”) | 1990 | zsh -c zsh | Plugin ecosystem. A single framework install adds hundreds of new attack surfaces. Low severity: most users are asleep waiting for their prompt theme to load. |
| Dash2Dash | 1997 | dash -c dash | Performance build. Spawns the second shell measurably faster. Quietly ships as /bin/sh on Debian and Ubuntu. |
| Fish2Fish | 2005 | fish -c fish | “Friendly interactive.” Autosuggestions finish the exploit for the attacker. Not POSIX-compliant, so it evades POSIX-based detection. |
| Pwsh2Pwsh | 2006 | pwsh -c pwsh | Cross-platform. The object pipeline means the attacker’s new shell arrives as a .NET object. |
| Xonsh2Xonsh | 2015 | xonsh -c xonsh | Python-powered. The attacker can now pip install their way to a shell. |
| Nu2Nu | 2019 | nu -c nu | Rewritten in Rust. Memory-safe exploitation; results returned as a structured table. |
| Agentic Sh2Sh | 2025 | “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:
| Technique | Trigger | Notes |
|---|---|---|
| Recursive | sh -c 'sh -c sh' | Attacker gains two additional shells. |
| Fileless | exec sh | Replaces the shell with a shell. Forensically indistinguishable from not doing anything. |
| Cross-version | bash -c zsh | Downgrade or upgrade attack. Attacker chooses their preferred version of the exploit at runtime. |
| Remote (Sh2Ssh2Sh) | ssh localhost | This 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
| Type | Indicator |
|---|---|
| Process | Any process named sh, bash, zsh, dash, ksh, fish |
| Process tree | Shell whose parent is a shell |
| File | /bin/sh |
| Network | An SSH connection |
| Behavioural | A blinking cursor |
| Human | Hoodie |
Mitigations
None of the mitigations below are vendor-confirmed. Each has trade-offs.
| Mitigation | Effectiveness | Trade-off |
|---|---|---|
chmod 000 /bin/sh | High | System will not boot, update, or run cron. |
alias sh='echo nice try' | Low | Bypassed by typing /bin/sh. Or bash. Or \sh. |
| Uninstall all shells | Total | You are now running a toaster. |
| Unplug keyboard | Medium | Attackers may use the on-screen keyboard. |
| Buy FearStack | Unclear | None, 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.