Advisory
- CVSS score
- 10.0 Critical0.0 once you think about it
- Attack vector
- LocalYou have to already be there
- Privileges required
- The ones you haveAnd no more, sadly
- Affected versions
- 1.0 to latestEvery release since 2006
- Exploited in the wild
- DailyMostly by sysadmins
- Vendor status
- Works as intendedTicket closed in 4 minutes
What’s going on
PowerShell, a shell, contains an undocumented feature by which typing powershell spawns another shell. An attacker who has achieved code execution inside PowerShell can therefore escalate from “has a shell” to “has a shell”.
Researchers believe the flaw can be chained indefinitely. In lab conditions, one analyst reached a nesting depth of 412 shells before forgetting why they started.
Proof of concept
The full exploit is reproduced below. We debated responsible disclosure for some time and decided it was fine.
PS C:\> powershell
For a weaponised version with persistence, press the up arrow and Enter again.
Mitigation
There is no patch. Recommended workarounds, in order of effectiveness:
- Type
exit. This reduces your shell count by one. - Repeat step 1 until the window closes.
- Switch to cmd.exe, which our follow-up paper, Cmd2Shell, will cover next quarter.
- Unplug the computer and take up woodworking.
Disclosure timeline
- Researcher opens PowerShell, types
powershell. - Researcher notices a second shell. Gasps audibly.
- Domain name registered.
- Logo commissioned. Four rounds of feedback on the spiral.
- Vendor notified. Vendor replies “that is what PowerShell does”.
- Conference talk accepted.
- Merch store live.
The extended 2Shell universe
PowerShell2Shell joins a proud lineage. Somewhere along the way, a vulnerability stopped counting unless its name ended in “Shell”.
| Name | Year | What it actually was |
|---|---|---|
| Shellshock | 2014 | Bash, the grandparent of the naming scheme |
| Log4Shell | 2021 | Logging a string could run code. Ruined everyone’s December |
| Spring4Shell | 2022 | Spring Framework, and a lot of “is it as bad as Log4Shell?” threads |
| Text4Shell | 2022 | Apache Commons Text, briefly feared, mostly fine |
| React2Shell | 2025 | React Server Components, and another ruined December |
| PowerShell2Shell | 2026 | A shell. Into a shell. You’re welcome. |
Lets a crumb execute arbitrary bread.
Questions
Am I affected?
If you have ever opened PowerShell, yes. If you have not, you are pre-affected.
Is there a CVE?
We requested one. The response was a single reaction emoji, which we have chosen to interpret as approval.
Why “2” and not “4”?
Our branding consultant said “4” is so 2021. “2” suggests movement, journey, ambition. Next year it will be “Shell2Shell2Shell”.
Does pwsh 7 fix it?
No. It makes it cross-platform. You can now get a shell from a shell on Linux, which had a shell.
Can I get a shirt?
The merch store sold out of shirts and now only sells shells.