Skip to content
Back to search

sysplant

Your Windows syscall hooking factory - feat Canterlot's Gate - All accessible over MCP

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/x42en--sysplant/badge.svg)](/listings/x42en--sysplant)

HTML

<a href="/listings/x42en--sysplant"><img src="/api/listings/x42en--sysplant/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 219 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. <!-- markdownlint-disable MD033 MD041 -->
  2. <h1 align="center">
  3. ..:: SysPlant ::..
  4. </h1>
  5. <p align="center">
  6. <strong>Your Syscall Factory</strong> <i>(feat. Canterlot's Gate)</i>
  7. </p>
  8. <p align="center">
  9. <img src="http://sysplant.readthedocs.io/en/main/assets/canterlot.jpeg" alt="Canterlot's Gate"/>
  10. </p>
  11. [![PyPI version](https://img.shields.io/pypi/v/sysplant.svg?logo=pypi&logoColor=FFE873)](https://pypi.org/project/sysplant/)
  12. [![Supported Python versions](https://img.shields.io/pypi/pyversions/sysplant.svg?logo=python&logoColor=FFE873)](https://pypi.org/project/sysplant/)
  13. [![Build Status](https://github.com/x42en/sysplant/actions/workflows/build.yml/badge.svg)](https://github.com/x42en/sysplant)
  14. [![Project Licence](https://img.shields.io/github/license/x42en/sysplant.svg)](https://github.com/x42en/sysplant/blob/main/LICENSE)
  15. [![PyPI downloads](https://img.shields.io/pypi/dm/sysplant.svg)](https://pypistats.org/packages/sysplant)
  16. [![Code Quality](https://www.codefactor.io/repository/github/x42en/sysplant/badge)](https://www.codefactor.io/repository/github/x42en/sysplant)
  17. [![MCP Server](https://img.shields.io/badge/MCP-Server-blueviolet)](https://modelcontextprotocol.io)
  18. [![Code style: Black](https://img.shields.io/badge/code%20style-Black-000000.svg)](https://github.com/psf/black)
  19. [![Documentation Status](https://readthedocs.org/projects/sysplant/badge/?version=latest)](https://sysplant.readthedocs.io/en/latest/?badge=latest)
  20. SysPlant is a python generation tool of the currently known syscall hooking methods. It currently supports following gates (aka: iterators):
  21. - [Hell's Gate](https://github.com/am0nsec/HellsGate) : Lookup syscall by first opcodes
  22. - [Halos's Gate](https://blog.sektor7.net/#!res/2021/halosgate.md) : Lookup syscall by first opcodes and search nearby if first instruction is a JMP
  23. - [Tartarus' Gate](https://github.com/trickster0/TartarusGate) : Lookup syscall by first opcodes and search nearby if first or third instruction is a JMP
  24. - [FreshyCalls](https://github.com/crummie5/FreshyCalls) : Lookup syscall by name (start with Nt and not Ntdll), sort addresses to retrieve syscall number
  25. - [SysWhispers2](https://github.com/jthuraisamy/SysWhispers2) : Lookup syscall by name (start with Zw), sort addresses to retrieve syscall number
  26. - [SysWhispers3](https://github.com/klezVirus/SysWhispers3) : SysWhispers2 style but introduce direct/indirect/random jump with static offset
  27. - **Canterlot's Gate ! :unicorn: :rainbow:** _(from an initial idea of [MDSEC article](https://www.mdsec.co.uk/2022/04/resolving-system-service-numbers-using-the-exception-directory/)) but who was missing a pony name_ : Lookup syscall using Runtime Exception Table (sorted by syscall number) and detect offset to syscall instruction for random jumps.
  28. - **Custom** Allows you to choose an iterator and a syscall stub method (direct / indirect / random / egg_hunter) which describe the way your NtFunctions will be effectively called.
  29. > :warning: **DISCLAIMER**
  30. > Please only use this tool on systems you have permission to access.
  31. > Usage is restricted to Pentesting or Education only.
  32. > All credits are based on my own research, please feel free to claim any method if I made mistakes...
  33. ---
  34. ## Introduction
  35. This personal project aims to be a simple tool to better understand & generate different syscall retrieval methods, and being able to play with direct / indirect / egg_hunter syscall stub. The first goal was to get my hands into NIM and then it overflow to C, C++ and Rust :wink: ...
  36. SysPlant has been developped for Linux users, some stuff might be broken within Windows or Mac. PR are welcome if you found anything that does not work as expected.
  37. ### Supported Languages
  38. | Language | Status | Cross-compile from Linux |
  39. | -------- | ------------------------- | --------------------------------------------------------------------- |
  40. | NIM | :white_check_mark: Stable | `nim c -d=release -d=danger -d=strip --opt=size -d=mingw --cpu=amd64` |
  41. | C | :white_check_mark: Stable | `x86_64-w64-mingw32-gcc -Wall -s -static -masm=intel` |
  42. | C++ | :white_check_mark: Stable | `x86_64-w64-mingw32-g++ -Wall -s -static -masm=intel` |
  43. | Rust | :white_check_mark: Stable | `cargo build --release --target x86_64-pc-windows-gnu` |
  44. ### MCP Server
  45. SysPlant ships with a built-in **[Model Context Protocol (MCP)](https://modelcontextprotocol.io/)** server, allowing AI coding assistants (Claude Code, Cursor, Windsurf, etc.) to generate syscall code directly from their chat interface.
  46. ```bash
  47. # stdio (default — plug into your AI client)
  48. python bridge_mcp_sysplant.py
  49. # SSE or Streamable HTTP for web-based clients
  50. python bridge_mcp_sysplant.py --transport sse --port 9090
  51. ```
  52. See the full guide: **[Sysplant as a MCP server](http://sysplant.readthedocs.io/en/main/usage/mcp)**
  53. ### General usage
  54. ```
  55. $ sysplant -h
  56. usage: main.py [-h] [--debug | --verbose | --quiet] {list,generate} ...
  57. ..:: SysPlant - Your Syscall Factory ::..
  58. positional arguments:
  59. {list,generate}
  60. options:
  61. -h, --help show this help message and exit
  62. Output options:
  63. --debug Display all DEBUG messages upon execution
  64. --verbose Display all INFO messages upon execution
  65. --quiet Remove all messages upon execution
  66. ```
  67. ```sh
  68. $ sysplant generate -h
  69. usage: main.py generate [-h] [-x86 | -wow | -x64] [-nim | -c | -cpp | -rust]
  70. [-p {all,donut,common} | -f FUNCTIONS] [-x] -o OUTPUT
  71. {hell,halo,tartarus,freshy,syswhispers,syswhispers3,canterlot,custom}
  72. ...
  73. options:
  74. -h, --help show this help message and exit
  75. -x, --scramble Randomize internal function names to evade static analysis
  76. -o OUTPUT, --output OUTPUT
  77. Output path for generated file
  78. Architecture options:
  79. -x86 Set mode to 32bits
  80. -wow Set mode to WoW64 (execution of 32bits on 64bits)
  81. -x64 Set mode to 64bits (Default True)
  82. Language options:
  83. -nim Generate NIM code (Default: true)
  84. -c Generate C code
  85. -cpp Generate C++ code
  86. -rust Generate Rust code
  87. Syscall options:
  88. -p {all,donut,common}, --preset {all,donut,common}
  89. Preset functions to generate (Default: common)
  90. -f FUNCTIONS, --functions FUNCTIONS
  91. Comma-separated functions
  92. ```
  93. ### Example output
  94. Here is an example of C syscall generation using **Canterlot's Gate** iterator:
  95. ```sh
  96. $ sysplant generate -c -o syscalls.c canterlot
  97. ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⠶⢤⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
  98. ⠀⢀⣀⡀⠀⢀⣠⣤⣴⣶⣶⡦⠤⢤⣤⣀⣀⣼⠀⠀⡽⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
  99. ⠀⠈⠫⣯⠙⡟⢿⣿⣿⡿⠁⠀⢠⣾⣿⣿⣿⡿⠀⠀⢹⠘⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
  100. ⠀⠀⣼⣿⣷⣧⡀⢱⠈⠀⠀⠀⣿⣿⣿⣿⣿⡀⠀⠀⢸⠀⢳⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀..:: SysPlant - Your Syscall Factory ::..
  101. ⠀⣼⣿⣿⣿⣿⣿⣿⡄⢀⣀⣠⣿⣿⣿⠿⢿⣷⣤⡀⠈⠀⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
  102. ⢠⣿⣿⣿⣿⣿⣿⠿⠛⠉⠉⠀⡇⣾⣿⣦⣀⣿⡄⠀⠀⢰⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀ Sysplant (2023) - 0x42en
  103. ⢸⣿⣿⣿⠿⢯⣷⢄⠀⠀⠀⠀⡄⢻⣿⣯⣻⣿⡧⠄⠀⢸⠀
  104. ⠘⣿⠟⠁⠀⠚⢻⣦⣱⣄⠀⠀⢣⠈⠛⣽⣿⠿⠭⠀⣠⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⡤⠶⠶⠶⠶⢤⣄⡀⠀⠀⠀⠀⠀ Canterlot's Gate (2022) - @MDSecLabs
  105. ⠀⠁⠀⠀⠀⠀⠀⠻⣿⣿⠀⠀⠈⠂⠀⠀⢀⣄⣠⣴⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⠶⠋⠁⠀⠀⠀⠀⠀⠀⠀⠉⠳⢦⡀⠀ @0x42en
  106. ⠀⠀⠀⠀⠀⠀⠀⠀⣸⠋⠄⢠⠀⠀⠀⠀⣾⣿⣿⣿⣿⣿⡀⠀⠀⠀⠀⠀⠀⠀⡴⠃⠀⣠⣤⣶⣶⣾⣶⣶⣦⣄⠀⠀⠀⠹⣆⠀⠀⠀⠀ Syswhispers3 (2022) - @klezVirus
  107. ⠀⠀⠀⠀⠀⠀⠀⠀⠈⠲⠴⠯⠤⠤⢶⢾⣿⣿⣿⣿⣿⠏⠷⣄⢀⣀⣀⣀⡀⣼⣠⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⡀⠀⠀⠸⣧⠀⠀ Syswhispers2 (2021) - @Jackson_T
  108. ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⠏⠈⠉⣡⣾⣿⠏⠀⢰⣿⠉⣩⠀⠉⢙⣿⡿⠛⠉⠉⠙⠛⢿⣿⣿⣿⣿⣿⣿⣷⠀⠀⠀⢻⣇⠀ @modexpblog
  109. ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡟⠀⠀⣿⣿⡿⠋⠀⢀⣾⡿⠀⣉⣀⣇⠘⠋⣿⠀⠀⠀⠀⠀⠀⠙⣿⣿⣿⣿⣿⣿⡆⠀⠀⢸⣿⡆ Tartarus' Gate (2021) - @trickster0
  110. ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠃⠀⠀⠘⢯⡀⠀⢀⣾⣿⠇⣴⠨⣿⣿⡯⠀⢸⠀⠀⠀⠀⠀⠀⠀⠘⣿⣿⣿⣿⣿⡇⠀⠀⢸⣿⣷ Halo's Gate (2021) - @Sektor7net
  111. ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⡆⠀⠀⠀⠈⠻⢦⣾⣿⠏⠀⠈⢈⣝⡟⠁⣶⣾⠀⠀⠀⠀⠀⠀⠀⠀⢹⣿⣿⣿⣿⡇⠀⠀⢸⣿⣿⡀ FreshyCalls (2020) - @crummie5
  112. ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢻⡀⢄⣀⡀⠀⠀⠉⠁⠀⠰⣄⠀⠁⠀⠀⢀⡏⠀⠀⠀⠀⠀⠀⠀⠀⠈⣿⣿⣿⣿⠃⠀⠀⣸⣿⣿⡇ Hell's Gate (2020) - @RtlMateusz
  113. ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢷⡀⢹⠁⠀⢠⠶⠤⠤⢴⡾⢦⡀⠀⠀⣼⠦⡄⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⠀⠀⠀⣿⣿⣿⠇ @am0nsec
  114. ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣷⠇⠀⠀⢸⡄⠀⠀⠀⠙⢆⠙⢦⡀⠀⠀⠙⣦⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⡇⠀⠀⢰⣿⡿⠋⠀
  115. ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡟⠀⠀⠀⡟⢻⡀⠀⠀⠀⠈⢳⡀⢳⡀⠀⠀⠈⢧⡀⠀⠀⠀⠀⠀⣿⣿⣿⠁⠀⢀⣼⠟⠁⠀⠀
  116. ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡞⠀⠀⠀⠀⡇⠀⢧⠀⠀⠀⠀⠀⢷⠀⢳⠀⠀⠀⠈⢧⠀⠀⠀⠀⢀⣿⣿⡏⢀⣴⠟⠁⠀⠀⠀⠀
  117. ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡞⠀⠀⠀⠀⢸⠇⠀⠸⡆⠀⠀⠀⠀⢸⠀⢸⡇⠀⠀⠀⠘⣧⠀⠀⠀⢸⣿⣿⡷⠛⠁⠀⠀⠀⠀⠀⠀
  118. ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡞⠀⠀⠀⠀⠀⣾⠀⠀⠀⣧⠀⠀⠀⠀⢸⠀⠀⡇⠀⠀⠀⠀⢸⡆⠀⠀⣿⠿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀
  119. ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⠎⠀⠀⠀⠀⠀⣰⠇⠀⠀⠀⣿⠀⠀⠀⠀⣏⣀⣸⠇⠀⠀⠀⠀⠀⣷⠀⠈⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
  120. ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠻⠤⣤⣤⣤⡤⠴⠛⠛⠛⠛⠉⠁⠀⠀⠀⠀⠈⠉⢿⣄⣀⣠⣤⡤⠶⠋⠀⠀⠀⠀⠀⠀⠀⠀
  121. [+] Summary of params used
  122. . Language: C
  123. . Architecture: x64
  124. . Selected syscall iterator: canterlot
  125. . Selected syscall caller stub: random
  126. . Common supported functions selected
  127. . Randomize internal function: False
  128. [+] Syscall file written to syscalls.c.h
  129. ```
  130. ## What is `iterator` option ?
  131. Sysplant is based on existing mechanisms for syscall number and addresses retrieval. I do not claim any of their discovery, I just harmonize all this methods in a single tool to be able to generate them easily using templates. These mechanisms are called `iterator`, if you look at the code you'll probably understand why :wink:
  132. If you want to go further in the explanations of _what is a syscall ?_ you should check [@Alice Climent blogpost about syscalls techniques](https://alice.climent-pommeret.red/posts/direct-syscalls-hells-halos-syswhispers2/)
  133. ## What is `method` option ?
  134. Once your `iterator` has been choosen you can then specify a `method` option based on the existing way to call syscalls. All the iterator are supported which let you select whatever you want as a final syscall stub.
  135. 1. **Direct:** the syscall is made directly in the Sysplant ASM call. You only need the syscall number but AV/EDR might see you...
  136. 2. **Indirect:** the Sysplant ASM call jump to the begining of Ntdll stub. You only need syscall address and no longer call syscall in your code but AV/EDR might hook these functions
  137. 3. **Random:** the Sysplant ASM call jump to a random syscall instruction of Ntdll stubs. You need the syscall number and 1 syscall instruction address. You then no longer call syscall in your code and can avoid hooked functions.
  138. 4. **Egg Hunter:** the inline `syscall` instruction is replaced by a random 8-byte marker (the _egg_). At runtime, call `SPT_SanitizeSyscalls()` **before any Nt\* function** to scan the `.text` section and patch every egg back to `syscall; ret`. This avoids static signatures on the `0F 05` opcode while keeping direct-call performance.
  139. [![Sysplant Stubs](http://sysplant.readthedocs.io/en/main/assets/sysplant_stubs.png)](http://sysplant.readthedocs.io/en/main/assets/sysplant_stubs.png)
  140. ## Documentation
  141. I've tried to keep an up to date documentation, so please **[READ THE DOC](http://sysplant.readthedocs.io/en/main/)**. You will find there many information about the tool's usages and a complete description of the classes and methods.
  142. Some specifics usages are described:
  143. - [Sysplant as a CLI tool](http://sysplant.readthedocs.io/en/main/usage/cli)
  144. - [Sysplant as a Python's module](http://sysplant.readthedocs.io/en/main/usage/lib)
  145. - [Sysplant as a MCP server](http://sysplant.readthedocs.io/en/main/usage/mcp)
  146. ## Credits
  147. Massive shout-out to these useful projects that helps me during this journey, or individuals for their reviews
  148. - [@alice blogpost about syscalls techniques](https://alice.climent-pommeret.red/posts/direct-syscalls-hells-halos-syswhispers2/)
  149. - [@redops blogpost about direct vs indirect syscalls](https://redops.at/en/blog/direct-syscalls-a-journey-from-high-to-low)
  150. - [@Jackson_T & @modexpblog for Syswhispers2](https://github.com/jthuraisamy/SysWhispers2)
  151. - [@klezvirus for syswhispers3](https://github.com/klezVirus/SysWhispers3)
  152. ## :construction: TODO
  153. This project is in WIP state...
  154. Some PR & reviews are more than welcome :tada: !
  155. - [x] Add internal names randomization
  156. - [x] Setup documentation
  157. - [x] Setup tests
  158. - [ ] Add x86 support
  159. - [ ] Add WoW64 support
  160. - [x] Setup NIM templates
  161. - [x] Setup C templates
  162. - [x] Setup Rust templates
  163. - [x] Setup C++ templates
  164. - [ ] Setup Go / C# / Whatever templates
  165. ## License
  166. This project is licensed under the [GPLv3 License](https://www.gnu.org/licenses/quick-guide-gplv3.en.html), for individuals only. If you want to integrate this work in your commercial project please contact me through `0x42en[at]gmail.com`

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.