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

SumatraPDF DLL Hijack

SumatraPDF DLL Hijack
Posted Dec 8, 2015
Authored by Stefan Kanthak

SumatraPDF suffers from multiple DLL hijacking vulnerabilities.

tags | exploit, vulnerability
systems | windows
SHA-256 | 27dc14dd449f0656362e2a1fa165d4528d2383f2dcf213a1d7c74b9e5a2afc1e

SumatraPDF DLL Hijack

Change Mirror Download
Hi @ll,

the executable installers [°] of all versions of SumatraPDF (see
<http://www.sumatrapdfreader.org/free-pdf-reader-de.html>) are
vulnerable:

1. On Windows Embedded POSReady 2009 (alias Windows XP SP3) the
installer of the current version 3.1.1 loads and executes a
rogue/bogus/malicious DCIMan32.dll ['] eventually found in the
directory it is started from (the "application directory").

2. The installers of older versions of SumatraPDF load and execute
a rogue/bogus/malicious UXTheme.dll ['] (and depending on the
Windows version others like DCIMan32.dll too) 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 DCIMan32.dll, UXTheme.dll etc. get(s) planted in the users
"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
DCIMan32.dll then results in an escalation of privilege!


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 DCIMan32.dll in your "Downloads" directory;

2. download
<https://kjkpub.s3.amazonaws.com/sumatrapdf/rel/SumatraPDF-3.1.1-install.exe>
(via <http://www.sumatrapdfreader.org/free-pdf-reader-de.html>)
or <http://software.zeniko.ch/sumatrapdf/SumatraPDF-install.exe>
and save it in your "Downloads" directory;

3. execute SumatraPDF-3.1.1-install.exe from your "Downloads"
directory;

4. notice the message box displayed from DCIMan32.dll placed in
step 1;

5. in your "Downloads" directory copy DCIMan32.dll as UXTheme.dll;

6. download
<http://kjkpub.s3.amazonaws.com/sumatrapdf/rel/SumatraPDF-3.0-install.exe>
(via <http://www.sumatrapdfreader.org/download-prev-de.html>)
and save it in your "Downloads" directory;

7. execute SumatraPDF-3.0-install.exe from your "Downloads" directory;

8. notice the message box displayed from DCIMan32.dll and UXTheme.dll
placed in steps 1 and 5.


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: see <http://seclists.org/fulldisclosure/2015/Nov/101> (resp. the
not yet finished <http://home.arcor.de/skanthak/!execute.html>)
for more details!

PPS: 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 exploit and easy to avoid) and
well-documented vulnerability: see
<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>


Timeline:
~~~~~~~~~

2015-11-18 vulnerability report sent to authors

NO ANSWER, not even an acknowledgement of receipt

2015-11-29 vulnerability report resent to authors

2015-11-29 response from author:
"we don't load dciman32.dll in our code.
[...]
Either way, there's no bug in Sumatra"

2015-11-29 on Windows XP DCIMan32.dll is loaded due to the use
of GDI32.dll. This is unique behaviour, not seen in
any other executable installer I know.

NO ANSWER, not even an acknowledgement of receipt

2015-12-07 report published
Login or Register to add favorites

File Archive:

September 2024

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close