You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Documentation/ScyllaHideDocumentation.tex
+44-53Lines changed: 44 additions & 53 deletions
Original file line number
Diff line number
Diff line change
@@ -37,7 +37,7 @@
37
37
38
38
\title{ScyllaHide v1.4 - Documentation}
39
39
\author{}
40
-
\date{2018-11-11}
40
+
\date{2019-05-17}
41
41
42
42
\begin{document}
43
43
@@ -54,7 +54,7 @@
54
54
55
55
\section{Description}
56
56
57
-
ScyllaHide is an advanced open-source x64/x86 usermode Anti-Anti-Debug library. It hooks various functions in usermode to hide debugging. This tool is intended to stay in usermode (ring3). If you need kernelmode (ring0) Anti-Anti-Debug please see \href{https://github.com/mrexodia/TitanHide}{TitanHide}. ScyllaHide hooks as stealth as possible in usermode and the goal is to not interfere any other functionality.
57
+
ScyllaHide is an advanced open-source x64/x86 usermode Anti-Anti-Debug library. It hooks various functions in usermode to hide debugging. This tool is intended to stay in usermode (ring3). If you need kernelmode (ring0) Anti-Anti-Debug please see \href{https://github.com/mrexodia/TitanHide}{TitanHide}. ScyllaHide hooks as stealthily as possible in usermode and the goal is to not interfere with any other functionality.
58
58
59
59
ScyllaHide supports various debuggers with plugins:
60
60
\begin{itemize}
@@ -69,10 +69,7 @@ \section{Description}
69
69
Please note: ScyllaHide is not limited to these debuggers. You can use the standalone commandline version of ScyllaHide. You can inject ScyllaHide in any process debugged by any debugger.
70
70
71
71
\section{Usage Information}
72
-
\subsubsection{NtApiTool}
73
-
The NtApiCollection.ini can be generated for your operating system by using the appropriate NtApiTool.exe in the release folder. Copy the generated NtApiCollection.ini to your plugin directory.
The injector waits for a keystroke after injection by default. You can modify this behaviour by passing "nowait" (without quotes) as the last parameter.
84
81
85
-
\subsubsection{OllyDbg v1}
86
-
Copy scylla\_hide.ini, NtApiCollection.ini, HookLibraryx86.dll and ScyllaHideOlly1.dll to your specific plugins directory.
82
+
\subsection{OllyDbg v1}
83
+
Copy scylla\_hide.ini, HookLibraryx86.dll and ScyllaHideOlly1.dll to your specific plugins directory.
87
84
88
-
\subsubsection{OllyDbg v2}
89
-
Copy scylla\_hide.ini, NtApiCollection.ini, HookLibraryx86.dll and ScyllaHideOlly2.dll to your specific plugins directory.
85
+
\subsection{OllyDbg v2}
86
+
Copy scylla\_hide.ini, HookLibraryx86.dll and ScyllaHideOlly2.dll to your specific plugins directory.
90
87
91
-
\subsubsection{IDA v6}
88
+
\subsection{IDA v6}
92
89
\textbf{32-bit:}
93
-
Copy scylla\_hide.ini, NtApiCollection.ini, HookLibraryx86.dll and ScyllaHideIDA.plw to your IDA plugins directory.
90
+
Copy scylla\_hide.ini, HookLibraryx86.dll and ScyllaHideIDA.plw to your IDA plugins directory.
94
91
95
92
\textbf{64-bit:}
96
-
Copy scylla\_hide.ini, NtApiCollection.ini, HookLibraryx64.dll, ScyllaHideIDASrvx64.exe and ScyllaHideIDA.p64 to your IDA plugins directory.
93
+
Copy scylla\_hide.ini, HookLibraryx64.dll, ScyllaHideIDASrvx64.exe and ScyllaHideIDA.p64 to your IDA plugins directory.
97
94
98
-
Note: \\Start ScyllaHideIDASrvx64.exe to debug 64bit applications (remotely). \\Start ScyllaHideIDASrvx86.exe to debug 32bit applications remotely.
95
+
Note: \\Start ScyllaHideIDASrvx64.exe to debug 64bit applications remotely. \\Start ScyllaHideIDASrvx86.exe to debug 32bit applications remotely.
99
96
100
-
Commandline: ScyllaHideIDASrvxXX.exe "port"\\
97
+
Command line: ScyllaHideIDASrvxXX.exe <port>\\
101
98
For example: ScyllaHideIDASrvxXX.exe 1345
102
99
103
-
ScyllaHideIDASrv needs HookLibraryxXX.dll and NtApiCollection.ini
100
+
ScyllaHideIDASrv needs HookLibraryxXX.dll.
104
101
105
-
\subsubsection{x64dbg}
102
+
\subsection{x64dbg}
106
103
\textbf{32-bit:}
107
-
Copy scylla\_hide.ini, NtApiCollection.ini, HookLibraryx86.dll and ScyllaHideX64DBGPlugin.dp32 to your \path{\x32\plugins\} directory.
104
+
Copy scylla\_hide.ini, HookLibraryx86.dll and ScyllaHideX64DBGPlugin.dp32 to your \path{\x32\plugins\} directory.
108
105
109
106
\textbf{64-bit:}
110
-
Copy scylla\_hide.ini, NtApiCollection.ini, HookLibraryx64.dll and ScyllaHideX64DBGPlugin.dp64 to your \path{\x64\plugins\} directory.
107
+
Copy scylla\_hide.ini, HookLibraryx64.dll and ScyllaHideX64DBGPlugin.dp64 to your \path{\x64\plugins\} directory.
111
108
112
-
\subsubsection{TitanEngine}
109
+
\subsection{TitanEngine}
113
110
\textbf{32-bit:}
114
-
Copy scylla\_hide.ini, NtApiCollection.ini, HookLibraryx86.dll and ScyllaHideTEx86.dll to your \path{\plugins\x86\} directory.
111
+
Copy scylla\_hide.ini, HookLibraryx86.dll and ScyllaHideTEx86.dll to your \path{\plugins\x86\} directory.
115
112
116
113
\textbf{64-bit:}
117
-
Copy scylla\_hide.ini, NtApiCollection.ini, HookLibraryx64.dll and ScyllaHideTEx64.dll to your \path{\plugins\x64\} directory.
114
+
Copy scylla\_hide.ini, HookLibraryx64.dll and ScyllaHideTEx64.dll to your \path{\plugins\x64\} directory.
118
115
119
116
\section{Features}
120
117
@@ -123,7 +120,7 @@ \subsection{Anti-Anti-Debug}
123
120
\subsubsection{Process Environment Block (PEB)}
124
121
The most important anti-anti-debug option. Almost every protector checks for PEB values. There are three important options and one minor option.
125
122
\begin{itemize}
126
-
\item BeingDebugged: Very important option, should be always enabled. \textit{IsDebuggerPresent} is using this value to check for debuggers.
123
+
\item BeingDebugged: Very important option, should always be enabled. \textit{IsDebuggerPresent} uses this value to check for debuggers.
127
124
\item NtGlobalFlag: Very important option, a lot of protectors check this value.
128
125
\item HeapFlags: Very important option. E.g. Themida checks for heap artifacts and heap flags.
129
126
\item StartupInfo: This is not really important, only a few protectors check for this. Maybe Enigma checks it.
A very important option. Various PROCESSINFOCLASS values can be used to detect a debugger:
145
142
\begin{itemize}
146
-
\item ProcessDebugFlags (31): Should return 1 in the supplied buffer.
143
+
\item ProcessDebugFlags (31): Should return 1 in the supplied buffer, unless this value was previously set to PROCESS\_DEBUG\_INHERIT (0x1), then 0.
147
144
\item ProcessDebugPort (7): Should return 0 in the supplied buffer.
148
-
\item ProcessDebugObjectHandle (30): Should return 0 in the supplied bufferand the error STATUS\_PORT\_NOT\_SET (0xC0000353).
145
+
\item ProcessDebugObjectHandle (30): Should write 0 to the supplied buffer, close the debug object handle, and return the error STATUS\_PORT\_NOT\_SET (0xC0000353).
149
146
\item ProcessBasicInformation (0): Reveals the parent process ID.
150
147
\item ProcessBreakOnTermination (29): Please see \textit{NtSetInformationProcess} in Section~\ref{sec:NtSetInformationProcess_section}.
151
148
\item ProcessHandleTracing (32): Please see \textit{NtSetInformationProcess} in Section~\ref{sec:NtSetInformationProcess_section}.
152
149
\end{itemize}
153
-
A lot of protectors use this to detect debuggers. The windows API \textit{CheckRemoteDebuggerPresent} uses \textit{NtQueryInformationProcess} with ProcessDebugPort internally.
150
+
A lot of protectors use this function to detect debuggers. The windows API \textit{CheckRemoteDebuggerPresent} uses \textit{NtQueryInformationProcess} with ProcessDebugPort internally.
154
151
155
152
\subsubsection{NtQueryObject}
156
153
The OBJECT\_INFORMATION\_CLASS ObjectTypesInformation (3) and ObjectTypeInformation (2) can be used to detect debuggers. ScyllaHide filters DebugObject references.
@@ -182,24 +179,18 @@ \subsubsection{OutputDebugStringA (deprecated since v1.3)}
182
179
}
183
180
\end{lstlisting}
184
181
185
-
\subsubsection{BlockInput}
182
+
\subsubsection{NtUserBlockInput}
186
183
Very effective anti-debug method. This is used e.g. in Yoda's Protector. "Blocks keyboard and mouse input events from reaching applications."
187
184
188
185
\subsubsection{NtUserFindWindowEx}
189
186
This is a system call function in user32.dll. The windows APIs \textit{FindWindowA/W} and \textit{FindWindowExA/W} call this internally. The debugger window will be hidden.
190
187
191
-
Note: Requires a valid relative virtual address in NtApiCollection.ini.
192
-
193
188
\subsubsection{NtUserBuildHwndList}
194
189
This is a system call function in user32.dll. The windows APIs \textit{EnumWindows} and \textit{EnumThreadWindows} call this internally. The debugger window will be hidden.
195
190
196
-
Note: Requires a valid relative virtual address in NtApiCollection.ini.
197
-
198
191
\subsubsection{NtUserQueryWindow}
199
192
This is a system call function in user32.dll. The windows API \textit{GetWindowThreadProcessId} calls this internally, see Listing for implementation. This is used to hide the debugger process.
200
193
201
-
Note: Requires a valid relative virtual address in NtApiCollection.ini.
ScyllaHide returns always STATUS\_ACCESS\_DENIED. This anti-debug measurement isn't used very often. Probably you will never need this option in a real world target.
204
+
ScyllaHide returns STATUS\_ACCESS\_DENIED unless the process has debug privileges enabled. If the process has debug privileges, ScyllaHide will take no action and return success. This anti-debug measurement isn't used very often. Probably you will never need this option in a real world target.
214
205
215
206
\subsubsection{NtClose}
216
207
This is called with an invalid handle to detect a debugger. ScyllaHide calls \textit{NtQueryObject} to check the validity of the handle. A few protectors are using this method.
217
208
218
209
\subsubsection{Remove Debug Privileges}
219
-
If a debugger creates the process of the target, the target will have debug privileges. This can be used to detect a debugger.
210
+
If a debugger creates the process of the target, the target may have debug privileges. This is an unreliable way to detect a debugger.
Hardware breakpoints can be detected/cleared with exceptions or the windows APIs \textit{NtGetContextThread/NtSetContextThread}. Enable this option only if you need it!
223
214
224
215
\subsubsection{Timing}
225
-
There are a few windows APIs to measure the time. Timing can be used to detect debuggers, because they slow down the execution. Enable with care and only if you need it!
216
+
There are a few windows APIs to measure the time. Timing can be used to detect debuggers, because they slow down execution. Enable with care and only if you need it!
226
217
227
218
\subsubsection{Raise Exception}
228
219
\label{sec:RaiseException_section}
@@ -271,18 +262,20 @@ \subsection{Special}
271
262
\subsubsection{DLL Injection}
272
263
Normal DLL injection or stealth dll injection. You better try the normal injection first...
273
264
265
+
\pagebreak
266
+
274
267
\subsubsection{Prevent Thread Creation}
275
268
This option prevents the creation of new threads. This can be useful if a protector uses a lot of protection threads. This option can be useful for EXECryptor. Enable with care and only if you need it! You must know what you are doing here!
276
269
277
270
\subsubsection{RunPE Unpacker}
278
-
This option hooks \textit{NtResumeThread}. If the malware creates a new process, ScyllaHide terminates and dumps any newly created process. If you are unpacking malware, enable and try it. Should be only used inside a Virtual Machine (VM).
271
+
This option hooks \textit{NtResumeThread}. If the malware creates a new process, ScyllaHide terminates and dumps any newly created process. If you are unpacking malware, enable and try it. Should only be used inside a Virtual Machine.
279
272
280
273
A typical RunPE workflow:
281
274
282
275
\begin{enumerate}
283
-
\item Create a new process of any target in suspended state (Process flag CREATE\_SUSPENDED: 0x00000004)
276
+
\item Create a new process of any target in suspended state (process flag CREATE\_SUSPENDED: 0x00000004)
284
277
\item Replace the original process PE image with a new (malicious) PE image. This can involve several steps and various windows API functions.
285
-
\item Start the process with the windows API function \textit{ResumeThread} (or \textit{NtResumeThread})
278
+
\item Start the process with the Windows API function \textit{ResumeThread} (or \textit{NtResumeThread}).
Some protectors use Thread-Local-Storage (TLS) as entrypoint and check for breakpoints at the normal PE entrypoint address. You must remove the PE entrypoint to hide your debugger. This option is necessary for VMProtect.
Change the OllyDbg window caption. This can be useful against e.g. FindWindow anti-debug tricks. You don't need to enable this, if you have the NtUser* hooks enabled! Hint: You can use it to make the currently used profile visible.
336
+
Changes the OllyDbg window caption. This can be useful against e.g. FindWindow anti-debug tricks. You don't need to enable this, if you have the NtUser* hooks enabled! Hint: You can use it to make the currently used profile visible.
Change the OllyDbg window caption. This can be useful against e.g. FindWindow anti-debug tricks. You don't need to enable this, if you have the NtUser* hooks enabled! Hint: You can use it to make the currently used profile visible.
372
+
Changes the OllyDbg window caption. This can be useful against e.g. FindWindow anti-debug tricks. You don't need to enable this, if you have the NtUser* hooks enabled! Hint: You can use it to make the currently used profile visible.
But this code is correct and very important. This nice trick removes heap artifacts (You can read more about it here: \url{http://pferrie.tripod.com/papers/unpackers.pdf} "The heap"). Themida and other protectors are checking for heap artifacts. Instead of manually wiping the artifacts, the code prevents the heap artifact creation.
448
-
449
-
\section{Frequently Asked Questions}
450
-
The error "NT APIs missing" appears, how to solve it?
451
-
\begin{itemize}
452
-
\item You need to put NtApiCollection.ini in the same directory as ScyllaHide.dll or the following hooks will not work: NtUserQueryWindow, NtUserBuildHwndList, NtUserFindWindowEx
453
-
\item Some Nt* WINAPI functions are not exported by a DLL, so it is necessary to get the function addresses from another source. The other source is the PDB file. The adresses can be resolved with the NtApiTool packaged in the release. It will download the PDB file from the Microsoft server to resolve the missing function addresses.
454
-
\end{itemize}
448
+
But this code is correct and very important. This nice trick removes heap artifacts (You can read more about it here: \url{http://pferrie.tripod.com/papers/unpackers.pdf} "The heap"). Themida and other protectors check for heap artifacts. Instead of manually wiping the artifacts, the code prevents the heap artifact creation.
0 commit comments