> For the complete documentation index, see [llms.txt](https://codex-7.gitbook.io/codexs-terminal-window/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://codex-7.gitbook.io/codexs-terminal-window/red-team/red-team-dev/loader-dev/indirect-syscalls.md).

# Indirect syscalls

WORK IN PROGRESS

### Detecting Direct Syscalls

Currently, the techniques of detecting syscalls are as follows:

* Search the binary or memory for the syscall, ret; instructions
  * Find code used to perform direct syscalls
* Monitor for syscall instructions not originating from the memory range of NTDLL
  * Detect the use of direct syscalls

### Evading these detections

To evade these detections, we need to avoid 2 things:

* Containing the syscall, ret; instructions
* Calling them from outside the memory space of NTDLL

![](/files/2TcvpbKQLjByuveH1KRk)

There is a way to perform our syscalls while "playing by" these detection rules, without the need to spoof or hide anything.

We can call the syscall, ret; combination from NTDLL itself!

* Locate an unhooked syscall, ret; in NTDLL memory range
* Jump to it

![](/files/Db8djizuVIxAUCez9jk0)

No source code will be provided for this technique, but if/when I do produce a working PoC I will do a short demo on this page. (maybe video comparison with traditional syscalls?)

### Related blogposts

<https://klezvirus.github.io/RedTeaming/AV_Evasion/NoSysWhisper/> <-- this blogpost is good if you want to understand syscall techniques in more depth


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://codex-7.gitbook.io/codexs-terminal-window/red-team/red-team-dev/loader-dev/indirect-syscalls.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
