what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

WiX Toolset DLL Hijacking

WiX Toolset DLL Hijacking
Posted Jan 21, 2016
Authored by Stefan Kanthak

WiX Toolset installers suffer from a DLL hijacking vulnerability.

tags | exploit
systems | windows
SHA-256 | 392db3509927ad38eb89dd7758d1f34327b87217ca0ddcffb49a9984cd877f74

WiX Toolset DLL Hijacking

Change Mirror Download
Hi @ll,

executable installers [°] created with the WiX Toolset (see
<http://wixtoolset.org/>, and of course the WiX Toolset installer
itself too) resp. using its bootstrapper "burn.exe" are vulnerable:
see <https://www.firegiant.com/blog/2016/1/20/wix-v3.10.2-released/>


1. They load and execute a rogue/bogus/malicious FEClient.dll [']
(and other DLLs too, dependent on the version of Windows:
MSI.dll, ClbCatQ.dll, Version.dll, ...) eventually found in the
directory they are started from (the "application directory").

For software downloaded with a web browser this is typically
the "Downloads" directory: see
<https://insights.sei.cmu.edu/cert/2008/09/carpet-bombing-and-directory-poisoning.html>,
<http://blog.acrossecurity.com/2012/02/downloads-folder-binary-planting.html>
and <http://seclists.org/fulldisclosure/2012/Aug/134>

If FEClient.dll etc. get(s) planted in the "Downloads"
directory per "drive-by download" this vulnerability becomes a
remote code execution.

Due to an application manifest embedded in the executable which
specifies "requireAdministrator" or the "installer detection" (see
<https://technet.microsoft.com/en-us/library/dd835540.aspx#BKMK_InstDet>)
of Windows' "user account control" executable installers are
typically started with administrative privileges ("protected"
administrators are prompted for consent, unprivileged standard
users are prompted for an administrator password); execution of
FEClient.dll et. al. then results in an escalation of privilege!


2. They extract "WiXStdBA.dll" (and other files) to an unsafe
temporary (sub)directory "%TEMP%\{<GUID>}\.b<letter>[<number>]\"
and load it (resp. process them) from there [²].

These files can be overwritten or compromised by an unprivileged
user after extraction and before they are used.

If such an executable installer is distributed per software
deployment system (for example WSUS) it is run under "LocalSystem"
account.

Processes running under "LocalSystem" account use the global
%TEMP% directory %SystemRoot%\Temp where EVERY (unprivileged)
user can create (or overwrite) files and conduct an attack on
"WiXStdBA.dll" and any other file created there.

For a recent example of such a vulnerability see
<https://code.google.com/p/google-security-research/issues/detail?id=440>


Proof of concept/demonstration:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

1. visit <http://home.arcor.de/skanthak/sentinel.html>, download
<http://home.arcor.de/skanthak/download/SENTINEL.DLL> and save
it as FEClient.dll in your "Downloads" directory, then copy it
as MSI.dll, Version.dll, CLbCatQ.dll;

2. download
<https://downloadmirror.intel.com/24345/a08/Intel%20Driver%20Update%20Utility%20Installer.exe>
from <http://www.intel.com/p/de_DE/support/detect> resp.
<https://downloadcenter.intel.com/download/24345/Intel-Driver-Update-Utility>
and save it in your "Downloads" directory;

3. execute "Intel Driver Update Utility Installer.exe" from your
"Downloads" directory;

4. notice the message boxes displayed from the DLLs placed in step 1.


Instead of Intel's Driver Update Utility installer you can use ANY
other executable installer built with WiX Toolset's bootstrapper
"burn.exe", for example Intel's Chipset Software installer, ...


Mitigation(s):
~~~~~~~~~~~~~~

0. DON'T USE EXECUTABLE INSTALLERS [°]!

If your favourite applications are not distributed in the native
installer package format of the resp. target platform: ask^WURGE
their vendors/developers to provide native installation packages.
If they don't: dump these applications, stay away from such cruft!

1. Turn off UAC's privilege elevation for standard users and installer
detection for all users:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System]
"ConsentPromptBehaviorUser"=dword:00000000 ; Automatically deny elevation requests
"EnableInstallerDetection"=dword:00000000

See <https://technet.microsoft.com/en-us/library/dd835564.aspx#BKMK_RegistryKeys>

2. NEVER execute files in UNSAFE directories (like "Downloads" and
and "%TEMP%")!

3. Deny execution (at least) in the "Downloads" directories and all
"%TEMP%" directories and their subdirectories:

* Add the NTFS ACE "(D;OIIO;WP;;;WD)" meaning "deny execution of
files in this directory for everyone, inheritable to all files
in all subdirectories" (use CACLS.EXE /S:<SDDL> for example);

* Use "software restriction policies" resp. AppLocker.

Consider to apply either/both to every "%USERPROFILE%" as well as
"%ALLUSERSPROFILE%" alias %ProgramData%" and "%PUBLIC%": Windows
doesn't place executables in these directories and beyond.

See <http://home.arcor.de/skanthak/safer.html> as well as
<http://mechbgon.com/srp/> plus
<http://csrc.nist.gov/itsec/SP800-68r1.pdf>,
<https://www.nsa.gov/ia/_files/os/win2k/application_whitelisting_using_srp.pdf>
or <https://books.google.de/books?isbn=1437914926> and finally
<http://www.asd.gov.au/infosec/top35mitigationstrategies.htm>!


stay tuned
Stefan Kanthak


PS: This vulnerability results from the use of the Win32 API for
the NTFS encrypting file system [³] (EFS) in "burn.exe".

Due to a beginner's error made about 16 years ago during the
development of EFS and still present in current versions of
Windows this loads FEClient.dll with a simple (unqualified)
filename ['] (see MS16-007 and CVE-2016-0014).


PPS: see <http://seclists.org/fulldisclosure/2015/Nov/101> and
<http://seclists.org/fulldisclosure/2015/Dec/86> plus
<http://home.arcor.de/skanthak/sentinel.html> and the not
yet finished <http://home.arcor.de/skanthak/!execute.html>
for more details!


PPPS: the case numbers are not in chronological order.


[°] Self-extracting archives and executable installers are flawed^W
b(rainde)ad in concept and dangerous in practice.

DON'T USE SUCH CRUFT!
ALWAYS use the resp. target platforms native package and archive
format.

For Windows these are .INF (plus .CAB) and .MSI (plus .CAB),
introduced 20 years ago (with Windows 95 and Windows NT4) resp.
16 years ago (with Office 2000).

Both .INF and .MSI are "opened" by programs residing in
%SystemRoot%\System32\ which are therefore immune to this kind
of "DLL and EXE Search Order Hijacking" attack.
Since both .INF and .MSI access the contents of .CAB directly
they eliminate the attack vector "unsafe temporary directory"
too.

['] A well-known (trivial, easy to avoid, easy to detect, easy
to exploit and easy to fix) and well-documented vulnerability:
see <https://cwe.mitre.org/data/definitions/426.html>,
<https://cwe.mitre.org/data/definitions/427.html>,
<https://capec.mitre.org/data/definitions/471.html>,
<https://technet.microsoft.com/en-us/library/2269637.aspx>,
<https://msdn.microsoft.com/en-us/library/ff919712.aspx> and
<https://msdn.microsoft.com/en-us/library/ms682586.aspx>

[²] Another well-known (trivial, easy to avoid, easy to detect, easy
to exploit and easy to fix) and well-documented vulnerability:
see <https://cwe.mitre.org/data/definitions/377.html>,
<https://cwe.mitre.org/data/definitions/379.html>,
<https://capec.mitre.org/data/definitions/27.html>,
<https://capec.mitre.org/data/definitions/29.html> ...

[³] see <https://technet.microsoft.com/en-us/library/cc700811.aspx>
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
    8 Files
  • 20
    Apr 20th
    0 Files
  • 21
    Apr 21st
    0 Files
  • 22
    Apr 22nd
    11 Files
  • 23
    Apr 23rd
    68 Files
  • 24
    Apr 24th
    23 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