Giter VIP home page Giter VIP logo

ntcreateuserprocess_'s Introduction

createuserprocess

This code is updated with the neccessary NDK to allow it to be compiled. The original code is from https://github.com/Microwave89/createuserprocess This is very useful to study the use of Native SysCalls to createprocess. If ran in win 10 a protected process would be created.

Three Examples of Directly Using Vista's NtCreateUserProcess

NOTE: Protected Process creation applies only to Windows 8.1+!

Whereas it was necessary to perform four system calls (NtOpenFile, NtCreateSection, NtCreateProcess(Ex), NtCreateThread(Ex)) in order to create a new ready to run usermode process in old XP days, much of the process creation internals has been moved to the Windows kernel in Vista+. In order to launch a new process there is only a single system service to be called, that is, "NtCreateUserProcess". Consequently, the complexity of NtCreateUserProcess is somewhat greater than the one of for example NtCreateProcessEx. I already managed to make NtCreateUserProcess working back in spring 2015. However, I did not properly note the parameters and flags (and its meanings) used and, what is most important, the former implementation relied upon calling two apparently crucial ntdll.dll library calls (RtlCreateProcessParameters(Ex), RtlNormalizeProcessParameters).

Having the implementation not rely on any library imports allows for bypassing any usermode hooks by leveraging the technique used in the syscalltest PoC.

In the main.c file there are 3 examples for successfully calling NtCreateUserProcess with the very minimum of information supplied. forkProcess() shows how to fork, createStandardProcess shows how to launch an arbitrary (native) non-protected process, and createProtectedProcess takes both a PsProtectedSignerXxx as well as a PsProtectedTypeXxx value and attempts to create a protected process with the specified protection options. Note that in all examples the process is created suspended.

The three examples do not rely on any imports but on NtCreateUserProcess and NtTerminateProcess both which are pure system service calls and thus can be described with solely a NT syscall number.

The examples are merged in a single example entirely implemented in main(). Function of combined example is as follows:

  • If the executable is started it first forks itself and exits.
  • Then the clone senses that it has been forked and does not further attempt to fork itself but continues execution.
  • The forked process now attempts to create a protected process "svchost.exe".
  • Then it creates a nonprotected "svchost.exe" and terminates itself.

Since there is missing almost the entire Windows subsystem most program won't run longer than 0.1 ms before they will crash or simply exit. "NtCreateUserProcess" is meant to be used in conjunction with native processes only. You can make most of it if you choose a process which does not force itself to run protected (not like services.exe or csrss.exe). Then you can overwrite the ntdll!LdrInitializeThunk function with your shellcode (ntdll.dll is always mapped into any process unlike you unmap it!) which ideally does not rely on anything but... raw system calls :)

ntcreateuserprocess_'s People

Contributors

peta909 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.