Skip to content

Commit 1060e15

Browse files
committed
Release 0.1.5
* Update README for the new features and new release * Update Cargo.toml for syscalls dependency with Linux * Update main for new release
1 parent 97fe65f commit 1060e15

File tree

4 files changed

+50
-21
lines changed

4 files changed

+50
-21
lines changed

Cargo.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rs-shell"
3-
version = "0.1.2"
3+
version = "0.1.5"
44
edition = "2021"
55

66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@@ -14,8 +14,7 @@ simple_logger = "4.3.0"
1414
log = "0.4.20"
1515
ctrlc = "3.4.1"
1616
clap = { version = "4.4.11", features = ["derive"] }
17-
syscalls = { git = "https://github.com/BlWasp/syscalls-rs.git", branch = "main", features = ["_INDIRECT_"] }
18-
ntapi = { version = "0.4.1", features = ["impl-default"] }
17+
ntapi = "0.4.1"
1918
winapi = "0.3.9"
2019

2120
[dependencies.windows-sys]
@@ -31,3 +30,6 @@ features = [
3130
"Win32_System_Kernel",
3231
"Wdk_System_Threading"
3332
]
33+
34+
[target.'cfg(target_os = "windows")'.dependencies]
35+
syscalls = { git = "https://github.com/BlWasp/syscalls-rs.git", branch = "main", features = ["_INDIRECT_"] }

README.md

Lines changed: 41 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
1+
<h1 align="center">
2+
<br>
3+
<img src=img/logo_craiyon.png height="400" border="2px solid #555">
4+
<br>
5+
<strong>RS-Shell</strong>
6+
</h1>
7+
18
*"The worst Rust programmer you have ever seen"* - my mom
29

310
*"But at least it works"* - still my mom, but not about me
411

5-
# RS-Shell
12+
## Description
613

7-
RS-Shell is a TLS over TCP reverse shell developped in Rust with client and server embedded in the same binary. This project has been mainly started to learn Rust with a tool that could help me in my work, and the code quality could be greatly improved.
14+
RS-Shell is a TLS over TCP reverse shell developped in Rust with client and server embedded in the same binary. This project has been mainly started to learn Rust with a tool that could help me in my work, and the code quality could be greatly improved. This project is like my Rust sandbox where I can test new things.
815

916
Client and server are both cross-platform and work on Windows and Linux systems.
1017

@@ -20,13 +27,15 @@ For the moment, the following features are present:
2027

2128
* Semi-interactive reverse shell via TLS over TCP
2229
* File upload and download between server and client
23-
* Start a PowerShell interactive session with the ability to patch the AMSI in memory
30+
* Start a PowerShell interactive session with the ability to patch the AMSI in memory with or without indirect syscalls
2431
* Loading features :
25-
* Load and execute a PE in the client memory
26-
* Load and execute a PE in a remote process memory
27-
* Load and execute a shellcode in a remote process memory
32+
* Load and execute a PE in the client memory, **with or without indirect syscalls**
33+
* Load and execute a PE in a remote process memory, **with or without indirect syscalls**
34+
* Load and execute a shellcode in a remote process memory, **with or without indirect syscalls**
2835
* Autopwn the client machine and elevate the privileges to SYSTEM or root by exploiting a 0day in `tcpdump`
2936

37+
To perform the indirect syscalls, I use the incredible [rust-mordor-rs](https://github.com/gmh5225/rust-mordor-rs) project initiate by [memN0ps](https://twitter.com/memN0ps). However, I use the version from my repository, which just patches little errors I have found regarding libraries versions and crate imports.
38+
3039
## How to
3140

3241
### Setup
@@ -85,21 +94,29 @@ Then, on the target machine launch the client to connect back to your server wit
8594
[+] Custom integrated commands :
8695
8796
[+] Loading commands
88-
> load C:\path\to\PE_to_load
89-
load a PE file in the client process memory and executes it. This could kill the reverse shell !
90-
> load -h C:\path\to\PE_to_load C:\path\to\PE_to_hollow
97+
> load C:\\path\\to\\PE_to_load
98+
load a PE file in the client process memory and executes it. This will kill the reverse shell !
99+
> load -h C:\\path\\to\\PE_to_load C:\\path\\to\\PE_to_hollow
91100
load a PE file in a remote process memory with process hollowing and executes it
92-
> load -s C:\path\to\shellcode.bin C:\path\to\PE_to_execute
101+
> load -s C:\\path\\to\\shellcode.bin C:\\path\\to\\PE_to_execute
93102
load a shellcode in a remote process memory and start a new thread with it
94103
104+
[+] Loading commands with indirect syscalls
105+
> syscalls C:\\path\\to\\PE_to_load
106+
load a PE file in the client process memory and executes it, with indirect syscalls. This will kill the reverse shell !
107+
> syscalls -h C:\\path\\to\\PE_to_load C:\\path\\to\\PE_to_hollow
108+
load a PE file in a remote process memory with process hollowing and executes it, with indirect syscalls
109+
> syscalls -s C:\\path\\to\\shellcode.bin C:\\path\\to\\PE_to_execute
110+
load a shellcode in a remote process memory and start a new thread with it, with indirect syscalls
111+
95112
[+] Bypass commands
96113
> powpow
97-
start a new interactive PowerShell session with the AMSI patched in memory
114+
start a new interactive PowerShell session with the AMSI patched in memory, with or without indirect syscalls
98115
99116
[+] Network commands
100-
> download C:\file\to\download C:\local\path
117+
> download C:\\file\\to\\download C:\\local\\path
101118
download a file from the remote system
102-
> upload C:\local\file\to\upload C:\remote\path\to\write
119+
> upload C:\\local\\file\\to\\upload C:\\remote\\path\\to\\write
103120
upload a file to the remote system
104121
105122
[+] Special commands
@@ -115,7 +132,9 @@ The `load` commands permit to load and execute directly in memory:
115132

116133
For example : `> load -h C:\Windows\System32\calc.exe C:\Windows\System32\cmd.exe`. This will start a `cmd.exe` process with hollowing, load a `calc.exe` image in the process memory, and then resume the thread to execute the calc.
117134

118-
`powpow` starts an interactive PowerShell session with a PowerShell process where the AMSI `ScanBuffer` function has been patched in memory. This feature is not particularly opsec.
135+
On the other hand, the `syscalls` commands permit the same things, but everything is performed with indirect syscalls.
136+
137+
`powpow` starts an interactive PowerShell session with a PowerShell process where the AMSI `ScanBuffer` function has been patched in memory. This feature is not particularly opsec. The patching operation can be performed with or without indirect syscalls.
119138

120139
`download` permits to download a file from the client to the machine where the listener is running. For example `download C:\Users\Administrator\Desktop\creds.txt ./creds.txt`.
121140

@@ -125,16 +144,23 @@ For example : `> load -h C:\Windows\System32\calc.exe C:\Windows\System32\cmd.ex
125144

126145
## Todo
127146

128-
- [ ] Move all the Win32API related commands to the NTAPI with indirect syscalls
147+
- [x] Move all the Win32API related commands to the NTAPI with indirect syscalls
129148
- [ ] Implement other injection techniques
130149
- [ ] Implement a port forwarding solution
131150
- [ ] Find a way to create a fully proxy aware client
132151
- [ ] Implement a reverse socks proxy feature
133152

153+
## Disclaimers
154+
155+
This is an obvious disclaimer because I don't want to be held responsible if someone uses this tool against anyone who hasn't asked for anything.
156+
157+
Usage of anything presented in this repo to attack targets without prior mutual consent is illegal. It's the end user's responsibility to obey all applicable local, state and federal laws. Developers assume no liability and are not responsible for any misuse or damage caused by this program. Only use for educational purposes.
158+
134159
## Acknowledgements
135160

136161
* [OffensiveRust](https://github.com/winsecurity/Offensive-Rust) by [winsecurity](https://github.com/winsecurity). This project would never have existed without him. Many of functions, structures, and tricks present in `rs-shell` come from this project
137162
* [OffensiveRust](https://github.com/trickster0/OffensiveRust) by [trickster0](https://github.com/trickster0)
138163
* Multiple projects by [memN0ps](https://github.com/memN0ps)
139164
* [RustPacker](https://github.com/Nariod/RustPacker) by [Nariod](https://github.com/Nariod)
140165
* Nik Brendler's blog posts about pipe communication between process in Rust. [Part 1](https://www.nikbrendler.com/rust-process-communication/) and [Part 2](https://www.nikbrendler.com/rust-process-communication-part-2/)
166+
* [rust-mordor-rs](https://github.com/gmh5225/rust-mordor-rs) by [memN0ps](https://twitter.com/memN0ps), an incredible library for indirect syscalls in Rust

img/logo_craiyon.png

673 KB
Loading

src/main.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,27 @@ mod client;
1010
mod loader;
1111
mod loader_syscalls;
1212
mod server;
13-
use syscalls::syscall;
1413

1514
use crate::client::client;
1615
use crate::server::server;
1716
use clap::{Arg, Command};
1817
use log::LevelFilter;
1918
use simple_logger::SimpleLogger;
2019
use std::error::Error;
20+
#[cfg(target_family = "windows")]
21+
use syscalls::syscall;
2122

2223
fn main() -> Result<(), Box<dyn Error>> {
2324
SimpleLogger::new()
2425
.without_timestamps()
2526
.with_colors(true)
2627
.init()
2728
.unwrap();
28-
::log::set_max_level(LevelFilter::Debug);
29+
::log::set_max_level(LevelFilter::Info);
2930

3031
let args = Command::new("rs-shell")
3132
.author("BlackWasp")
32-
.version("0.1.2")
33+
.version("0.1.5")
3334
.after_help("In a session, type 'help' for advanced integrated commands")
3435
.arg(
3536
Arg::new("side")

0 commit comments

Comments
 (0)