Created the Saturday 23 March 2019. Updated 3 years, 6 months ago.
This technique uses a callback function for Control signal handlers to inject the malicious code. Each time a control signal, such as Ctrl+C, is received by a process the system creates a new thread to execute the function. The thread is created by legitimate process “csrss.exe” in the system, rendering the detection more difficult.
By using this technique, it is possible to inject a code each time a console process receives a control signal. To do that, the technique needs to bypass some Windows protections such as Pointer Encoding and Control Flow Guard. Pointer encoding is used to encode a pointer and avoid pointer corruption. The technique reproduces the encoding to appear legitimate. Control Flow Guard is a security mechanism to prevent memory corruption such as buffer overflow. The technique will simply use the API SetProcessValidCallTargets to validate the call target. Thus, by triggering Ctrl+C the injected code is executed.