National Cyber Warfare Foundation (NCWF)login

KSword for Windows anti-rootkit analysis and kernel investigation


0 user ratings
2026-11-01 23:28:19
milo
Red Team (CNA)
"KSword

KSword is a source-available Windows ARK and kernel analysis suite whose desktop apps and KswordARK.sys driver compare user-mode and Ring 0 views for authorized forensic and defensive investigations.








ToolKSwordDEV/KSword — source-available Windows ARK (Anti-Rootkit) and kernel analysis toolkit with Qt and native Win32 frontends plus a shared kernel driver
CategoryAnti-rootkit / Windows kernel analysis / system forensics toolkit
Primary UseComparing R3 vs R0 views of processes, drivers, handles, hooks, callbacks and connections to surface hidden activity during authorized incident response and malware research
Safe UseFor authorized security assessments, dedicated research VMs and labs, and defensive forensic investigations on systems you own or have written permission to analyze
Telemetry NoteLoading the KswordARK kernel driver creates a visible service entry, driver-load ETW events and code-integrity log entries; high-privilege operations such as driver unload, raw disk writes and protection changes require explicit confirmation and are logged in the UI's risk center

KSword positions itself as an ARK (Anti-Rootkit) and system analysis toolkit for Windows 10/11 x64, and its core methodology is the classic cross-view technique: the desktop applications and the KswordARK.sys kernel driver each observe processes, threads, drivers, handles and network connections, then compare the user-mode (R3) view against the Ring 0 (R0) view. A discrepancy between the two views is the investigative signal — a process visible in the kernel object namespace but absent from the NT API enumeration is exactly the kind of artifact rootkits leave behind. Importantly, the README is careful to frame differences as evidence rather than proof: availability, sampling timing and legitimate OS behavior must be ruled out before attributing a gap to hidden activity, which is a mature stance for this category of tool.


The project describes itself as source-available rather than fully open source, under the KSword Community Source License v1.6, which the authors explicitly note is not OSI-approved. The repository reports 443 stars and is written primarily in C++, with topics spanning anti-rootkit, kernel-driver, hypervisor, dpi and windows. Two desktop editions ship: Ksword5.1, a Qt 6 application with a dockable ADS workspace for the full workflow, and KswordARKLight, a native Win32 build with no runtime dependencies intended for quick triage and minimal-footprint evidence collection. Both frontends talk to the same driver through the same shared/driver/ protocol, and a Launcher.exe reads a support manifest to pick the right edition; KswordSetup.exe is an optional installer that does the same plus shortcuts.


A design decision worth highlighting is the separation of inspection from system-changing actions. Sensitive operations — driver unload, raw disk writes, protection changes, PPL patch, R0 process hide — have their own capability checks and confirmation flows, and recovery is provided for supported operations. This gating matters in a tool whose feature set overlaps heavily with offensive capability: R0 process hiding and loader-list removal are exactly what a malicious toolkit would use, and KSword deliberately wraps them in reversibility, acknowledgements and explicit error reporting when offsets or features are unavailable rather than silently degrading.


The process and thread workspace offers tree and list views with the R3/R0 cross-view, thread stacks, module enumeration, token inspection, PDB diagnostics, and injection-trace checks that explicitly distinguish genuine findings from collection gaps — a nod to the false-positive problem that plagues hook-detection tools. Gated actions include kill, suspend, recoverable R0 hide and PPL patch. The memory subsystem is where the tool gets deep: region browsing, pattern search, bookmarks, kernel executable-memory scans and PTE/VA translation, with a shared snapshot editor across hex, disassembly, text and byte-difference views supporting x86/x64 Intel assembly, patch previews and local undo/redo. Writes are bound to the captured target, compare original bytes before committing, and verify readback afterward — the README is candid that local undo cannot undo a committed write.


The most technically interesting component documented in the README is DDMA — direct physical memory access through the disk controller, credited to btbd/ddma. The driver issues ATA_PASS_THROUGH_DIRECT or SCSI_PASS_THROUGH_DIRECT against a \Driver\Disk device with the transfer buffer pointed at a physical page, letting the host bus adapter move bytes through a DMA path that never traverses CPU page tables and therefore bypasses SLAT-based protections. The constraints are spelled out honestly: the channel must borrow a disk sector as a staging area (the user must explicitly name the LBA, with LBA 0 deliberately supported since that is where the MBR lives), kernel debugging must be off because MmMapIoSpace on ordinary RAM trips MiShowBadMapper and bugchecks, and the whole technique only truly bypasses address translation when the OS owns real hardware — in a VM guest, the host emulates the DMA and the SLAT-bypass property evaporates. Non-full-page writes are flagged as read-modify-write with a 4 KiB lost-update window, an unusual level of engineering transparency.


Defenders should also note that KSwordCLI.exe ddma selftest exercises capability and refusal paths without writing disk sectors; adding --lba N enables a real read probe that still avoids writes. The README explicitly marks the DDMA channel as lab use only, which aligns with how a research tool should document its sharpest edge. In a detection context, the selftest is harmless, but a real ddma read performs scratch-sector backup, use and restore within a single call — meaning disk-level telemetry may be the only place a brief write burst to the staging LBA is visible.


Beyond memory, the scanner performs structural PE, ELF and Mach-O analysis with a length-preserving byte editor, atomic replace and optional backup. The network stack includes capture and filtering, per-process throttling, an HTTP request builder, HTTPS inspection, a WFP firewall, an NIDS, segmented downloads, and R0 inventories across TCP, UDP, AFD, NSI, NDIS and WFP — effectively replacing a small toolkit of separate utilities. The kernel workspace covers service management, DriverObject/DeviceObject/MajorFunction inspection, a transactional dispatch-table editor, reversible loader-list removal, integrity and cross-view checks, unloaded-driver and PiDDB evidence, SSDT/SSSDT baselines, IAT/EAT/inline hook detection, an extensive callback inventory (notify, registry, object, filter, bugcheck, shutdown, FS, logon, NMI and more), IDT baselines, descriptor-table and IOCTL decoding, plus disassembly.


File and storage forensics include a dual-pane manager, hashing, signature and strings analysis, an unlocker, NTFS recovery, minifilter and Section evidence, and a raw filesystem browser with deleted-entry analysis that is read-only by default — writes require an explicit unlock. The KSword Controller, integrated into KswordARK.sys, adds session control, conditional writes, reread verification and rollback for raw storage operations. A monitor workspace provides per-process ETW, syscall capture, a WinAPI agent, WMI subscription auditing, ETW session management and a risk center, alongside Task-Manager-style live charts.


Two integration paths extend the tool beyond a standalone GUI. First, there is an MCP companion repository (KSwordDEV/MCP) with an agent-driven installation flow; notably, its prompt instructs the AI agent not to load or unload drivers, terminate processes, write memory, or auto-approve UAC prompts during verification — a security-conscious pattern for agentic tool management. Second, the debugger workspace offers optional standalone 64-bit Cheat Engine and x64dbg integrations through a shared backend, with executable and UI plugins and a plugin market; native debugging works without the driver loaded, while R0/HVM paths, hidden execution breakpoints and shadow execution-page writes depend on policy and capability selection.


Operationally, R0 features require the KswordARK driver; without it the application still runs but kernel-side pages simply report unavailable. The driver requires OS build 16299 or later, and the README is explicit that no maximum build is imposed but exact PE/PDB profiles and per-feature checks determine real availability — a newer Windows build is not automatically a validated configuration. That honesty extends throughout the project: missing offsets are reported rather than guessed, failed restores are warned about rather than swallowed, and Light edition preserves an already-running driver on exit. For authorized IR teams, malware analysts and Windows-internals students, KSword effectively consolidates what the README aptly describes as ten different programs into one disciplined, evidence-oriented workspace — provided it is run in labs, VMs and engagements where loading your own kernel driver is legitimate.



Official project repository for KSwordDEV/KSword.

Download Tool

Educational analysis for authorized security professionals. Use only in controlled, authorized environments.






Source: OffensiveSec
Source Link: https://www.offsecblog.com/2026/11/ksword-for-windows-anti-rootkit.html


Comments
new comment
Nobody has commented yet. Will you be the first?
 
Forum
Red Team (CNA)



Copyright 2012 through 2026 - National Cyber Warfare Foundation - All rights reserved worldwide.