An educational repository of sample code and skeletons for building Kernel Modules / Drivers across platforms.
Language: English | Bahasa Indonesia
This repository collects sample code and skeletons for building Kernel Modules across several platforms: Linux, FreeBSD, Solaris, and Windows.
Every sample ships with build, load, and unload instructions — just follow the header comment in each source file or the README in its directory.
This repository is an initiative of the Reversing.ID community to learn Kernel Module development. Reversing.ID is not affiliated with any platform vendor; the repository's sole purpose is education.
A Kernel Module is a piece of code that extends or enriches the functionality of an operating system's kernel, without requiring the kernel to be rebuilt every time a change happens. Most operating systems support this concept under their own name, for example:
Kernel Loadablemodule (kld) forFreeBSDKernel Extension(kext) forMacOSLoadable Kernel Module(lkm) forLinuxandSolaris
A Kernel Module is often referred to as a driver or device driver. While many kernel modules are created to implement an interface between the kernel and a device, that term isn't fully accurate — a kernel module can also implement a kernel-side feature with no relation to a physical device at all (for example, syscall hooking).
KernelModule-Examples/
├── linux/ # Linux Loadable Kernel Module (LKM)
│ ├── basics/ # skeleton, module params, memory, syscall hook, kernel thread
│ ├── drivers/
│ │ ├── char/ # character device driver
│ │ └── block/ # block device driver
│ └── payload/ # rootkit-style payload (give-root, hide-file/module/process)
│
├── bsd/ # FreeBSD Kernel Loadable (KLD)
│ ├── basics/ # skeleton, memory, syscall hook
│ └── drivers/char/ # character device driver
│
├── solaris/ # Solaris Loadable Kernel Module (LKM)
│ └── basics/ # skeleton, memory, syscall hook
│
├── windows/ # Windows Kernel-Mode Driver Framework (KMDF)
│ └── kmdf/0.basic/ # skeleton, hello
│
├── README.md / README.EN.md # This documentation
├── CONTRIBUTING.md / .EN.md # Contribution guide
└── .gitignore
Every sample lives in its own directory containing code.c (or code.cpp) plus the Makefile/project file needed to compile it.
| Platform | Term | Examples | Build Tool |
|---|---|---|---|
linux/ |
Loadable Kernel Module (LKM) | 17 | make (kbuild) |
bsd/ |
Kernel Loadable (KLD) | 7 | make (bsd.kmod.mk) |
solaris/ |
Loadable Kernel Module (LKM) | 4 | make (manual gcc/ld rules) |
windows/ |
Kernel-Mode Driver Framework (KMDF) | 2 | msbuild / Visual Studio |
See each platform directory's README for the full example list, concept explanations, and environment setup.
- New to this? Read What is a Kernel Module? above, then open
_introduction.EN.mdin your platform of choice. - Want to contribute? Read CONTRIBUTING.EN.md.
Each platform needs a different toolchain (compiler, kernel headers, WDK, etc). Follow _preparation.EN.md in your chosen platform directory before building.
Every example directory contains:
code.c/code.cpp— source code with build/load/unload instructions in the header comment.Makefile(or a project file for Windows) — runmake(ormsbuild) in that directory.
This is an open project. You can contribute code for a platform not yet covered, add new examples, or improve existing ones.
Read CONTRIBUTING.EN.md for the full guide on naming conventions, the template for new examples, and the pull request process.
You can also:
- email pengurus [at] reversing.id
- reach out on telegram @ReversingID
This repository exists for educational purposes. Some examples (particularly under linux/payload/) demonstrate techniques commonly used by rootkits (syscall hooking, hiding processes/files/modules, privilege escalation) — written purely to teach kernel-level programming and reverse engineering concepts, not for misuse against systems you don't own or don't have permission to test. Users are responsible for how they use the code in this repository and must comply with the laws applicable in their jurisdiction.