Skip to content

Commit 7aedc4b

Browse files
committed
Add documentation around error 0xc0000142 on windows
1 parent 7703025 commit 7aedc4b

File tree

1 file changed

+40
-2
lines changed

1 file changed

+40
-2
lines changed

README.md

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ https://github.com/user-attachments/assets/11dc8d14-59f1-4bdd-9503-b70f8a0d2db1
6868
- [Fileless execution (Clients support dynamically downloading executables to execute as shell)](#fileless-execution-clients-support-dynamically-downloading-executables-to-execute-as-shell)
6969
- [Supported URI Schemes](#supported-uri-schemes)
7070
- [Help](#help)
71-
- [Windows and SFTP](#windows-and-sftp)
71+
- [Windows](#windows-help)
72+
- [SFTP](#windows-and-sftp)
73+
- [Error ]()
7274
- [Server started with `--insecure` still has `Failed to handshake`](#server-started-with---insecure-still-has-failed-to-handshake)
7375
- [Foreground vs Background](#foreground-vs-background)
7476
- [Donations, Support, or Giving Back](#donations-support-or-giving-back)
@@ -433,7 +435,9 @@ Both of these methods will opportunistically use [memfd](https://man7.org/linux/
433435
434436
# Help
435437
436-
## Windows and SFTP
438+
## Windows
439+
440+
### SFTP
437441
438442
Due to the limitations of SFTP (or rather the library Im using for it). Paths need a little more effort on windows.
439443
@@ -443,6 +447,40 @@ sftp -r -J your.rssh.server.internal:3232 test-pc.user.test-pc:'/C:/Windows/syst
443447
444448
Note the `/` before the starting character.
445449
450+
## Session spawn errors (0xc0000142)
451+
452+
Under some execution circumstances connecting to an RSSH client on windows may fail with no error.
453+
454+
```sh
455+
catcher$ connect windows-system
456+
Session has terminated.
457+
```
458+
459+
Client logs:
460+
```sh
461+
2025/08/24 18:25:39 [client] INFO session.go:52 func16() : Session got request: "shell"
462+
2025/08/24 18:25:39 [client] INFO shell_windows.go:137 runWithConpty() : New process with pid 3427 spawned
463+
2025/08/24 18:25:39 [client] INFO session.go:122 func16() : Session disconnected
464+
```
465+
466+
There are two common causes for this, the first being antivirus has killed the spawned powershell, and the other `0xc0000142` is when the resulting process does not have the permissions to access the Windows Station or Desktop [source](https://stackoverflow.com/questions/677874/starting-a-process-with-credentials-from-a-windows-service/30687230#30687230).
467+
468+
469+
To determine which is causing this issue, execute any command without a pty:
470+
471+
```sh
472+
ssh -J rssh windows-system cmd /c dir
473+
exit status 0xc0000142
474+
```
475+
476+
If you see the `0xc0000142` error code try starting `CMD.exe` and force allocating a pty (`-t`):
477+
478+
```sh
479+
ssh -t -J rssh windows-system CMD.exe
480+
```
481+
482+
This should start an interactive shell.
483+
446484
## Server started with `--insecure` still has `Failed to handshake`
447485
448486
If the client binary was generated with the `link` command this client has the server public key fingerprint baked in by default. If you lose your server private key, the clients will no longer be able to connect.

0 commit comments

Comments
 (0)