Windows: Child Process Restriction Mitigation Bypass
It’s possible to bypass the child process restriction mitigation policy by impersonating the anonymous token leading to a security feature bypass. Windows 10 has a mitigation policy to restrict a process creating new child processes. During process creation the token flag is checked in SeSubProcessToken which creates the new primary token for the new process. It’s possible to also specify a flag for overriding the behavior, the code looks something like the following: if (ChildProcessOptions & PROCESS_CREATION_CHILD_PROCESS_OVERRIDE) { PTOKEN CurrentToken = PsReferenceEffectiveToken( KeGetCurrentThread(), &Type, &CopyOnOpen, &ImpersonationLevel); if ( Type == TokenImpersonation && ImpersonationLevel < SecurityImpersonation || (SeTokenIsNoChildProcessRestrictionEnforced(CurrentToken) != 0 && Type != TokenPrimary)) { return STATUS_CHILD_PROCESS_BLOCKED; } } This checks if the PROCESS_CREATION_CHILD_PROCESS_OVERRIDE is set then either the primary or impersonation token do not have the restrict child process flag set. If the token does have the flag then STATUS_CHILD_PROCESS_BLOCKED is returned and process creation fails. The problem with this code is it entirely relies on a process not being able to get an impersonation token without the flag.