exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

Microsoft Windows AppLocker Bypass

Microsoft Windows AppLocker Bypass
Posted Mar 24, 2017
Authored by Stefan Kanthak

Microsoft Windows versions 8 and newer suffer from an AppLocker bypass vulnerability.

tags | advisory, bypass
systems | windows
SHA-256 | 9d1b92067f6ae28cd876b6ae4a80e1d0947df6c18468cc1f09f3c8d2eeeca041

Microsoft Windows AppLocker Bypass

Change Mirror Download
Hi @ll,

Windows 8 and newer versions (Windows 7 and Windows Server 2008 R2
with KB2532445 or KB3125574 installed too) don't allow unprivileged
callers to circumvent AppLocker and SAFER rules via

LoadLibraryEx(TEXT("<arbitrary DLL>"), NULL, LOAD_IGNORE_CODE_AUTHZ_LEVEL);

See <https://msdn.microsoft.com/en-us/library/ms684179.aspx>
and <https://support.microsoft.com/kb/2532445>

| LOAD_IGNORE_CODE_AUTHZ_LEVEL 0x00000010
|
| If this value is used, the system does not check AppLocker rules
| or apply Software Restriction Policies for the DLL. This action
| applies only to the DLL being loaded and not to its dependencies.
| This value is recommended for use in setup programs that must
| run extracted DLLs during installation.
|
| Windows Server 2008 R2 and Windows 7:
| On systems with KB2532445 installed, the caller must be running
| as "LocalSystem" or "TrustedInstaller"; otherwise the system
| ignores this flag.


Unprivileged users can but bypass AppLocker or SAFER alias Software
Restriction Policies via

STARTUPINFO si = {sizeof(STARTUPINFO)};
PROCESS_INFORMATION pi = {0};
CreateProcess(TEXT("<arbitrary exe>"), NULL, NULL, NULL, FALSE,
CREATE_PRESERVE_CODE_AUTHZ_LEVEL, NULL, NULL, &si, &pi);

on ALL versions from Windows XP to Windows 10!

See <https://msdn.microsoft.com/en-us/library/ms684863.aspx>

| CREATE_PRESERVE_CODE_AUTHZ_LEVEL 0x02000000
|
| Allows the caller to execute a child process that bypasses the
| process restrictions that would normally be applied automatically
| to the process.


Mitigation:
~~~~~~~~~~~

Create an "AppCert.Dll" that exports CreateProcessNotify and
set the following registry entry

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\AppCertDlls]
"AppCert.Dll"="<path>\AppCert.Dll"
...

Note: AppCertDlls are loaded at the first call of one of the
CreateProcess*() functions. Process creation is denied
if one of them returns STATUS_UNSUCCESSFUL from its
CreateProcessNotify() routine when called with the flag
PROCESS_CREATION_QUERY.

--- APPCERT.C ---
#pragma comment(linker, "/DLL")
#ifdef _WIN64
#pragma comment(linker, "/EXPORT:CreateProcessNotify,PRIVATE")
#else
#pragma comment(linker, "/EXPORT:CreateProcessNotify=_CreateProcessNotify@8,PRIVATE")
#endif
#pragma comment(linker, "/NOENTRY")

#include <windows.h>

#define PROCESS_CREATION_QUERY 1L
#define PROCESS_CREATION_ALLOWED 2L
#define PROCESS_CREATION_DENIED 3L

NTSTATUS NTAPI CreateProcessNotify(LPCWSTR lpApplicationName, ULONG ulReason)
{
NTSTATUS ntStatus = STATUS_SUCCESS;

switch (ulReason)
{
case PROCESS_CREATION_QUERY:
// called once for each process that is to be created
// return STATUS_SUCCESS to allow process creation or
// return STATUS_UNSUCCESSFUL to deny process creation

if (forbidden(lpApplicationName))
ntStatus = STATUS_UNSUCCESSFUL;

break;

case PROCESS_CREATION_ALLOWED:
// called once for each process that is allowed creation

...

break;

case PROCESS_CREATION_DENIED:
// called once for each process that is denied creation

...

break;

default:
;
}

// the return value is only used for PROCESS_CREATION_QUERY,
// all other conditions are ignored

return ntStatus;
}
--- EOF ---


stay tuned
Stefan Kanthak


Timeline:
~~~~~~~~~

2017-03-10 sent vulnerability report to vendor

2017-03-10 reply from vendor: MSRC case 37727 opened

2017-03-13 reply from vendor: product team is working on case

2017-03-21 reply from vendor:
"The product team has finished their investigation and
determined this will be serviced in a future version
of Windows. AppLocker bypasses are not serviced via
monthly security roll-ups; only major version updates."

2017-03-21 <https://support.microsoft.com/kb/2532445> but serviced
a bypass with a hotfix which was incorporated in later
security updates and is included in the "convenience"
rollup <https://support.microsoft.com/en-us/kb/3125574>

2017-03-21 reply from vendor:
"If you want this fixed immediately and are an
enterprise customer you'll need to work with your
Account Manager to open a support case."

2017-03-21 report published


Login or Register to add favorites

File Archive:

April 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Apr 1st
    10 Files
  • 2
    Apr 2nd
    26 Files
  • 3
    Apr 3rd
    40 Files
  • 4
    Apr 4th
    6 Files
  • 5
    Apr 5th
    26 Files
  • 6
    Apr 6th
    0 Files
  • 7
    Apr 7th
    0 Files
  • 8
    Apr 8th
    22 Files
  • 9
    Apr 9th
    14 Files
  • 10
    Apr 10th
    10 Files
  • 11
    Apr 11th
    13 Files
  • 12
    Apr 12th
    14 Files
  • 13
    Apr 13th
    0 Files
  • 14
    Apr 14th
    0 Files
  • 15
    Apr 15th
    30 Files
  • 16
    Apr 16th
    10 Files
  • 17
    Apr 17th
    22 Files
  • 18
    Apr 18th
    45 Files
  • 19
    Apr 19th
    0 Files
  • 20
    Apr 20th
    0 Files
  • 21
    Apr 21st
    0 Files
  • 22
    Apr 22nd
    0 Files
  • 23
    Apr 23rd
    0 Files
  • 24
    Apr 24th
    0 Files
  • 25
    Apr 25th
    0 Files
  • 26
    Apr 26th
    0 Files
  • 27
    Apr 27th
    0 Files
  • 28
    Apr 28th
    0 Files
  • 29
    Apr 29th
    0 Files
  • 30
    Apr 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close