[<prev] [next>] [day] [month] [year] [list]
Message-ID: <2E177A65B0B642D59FCD86B6E530DC83@W340>
Date: Tue, 7 Feb 2017 19:53:58 +0100
From: "Stefan Kanthak" <stefan.kanthak@...go.de>
To: <fulldisclosure@...lists.org>
Cc: bugtraq@...urityfocus.com
Subject: [FD] Executable installers are vulnerable^WEVIL (case 48):
SumatraPDF-3.1.2-installer.exe allows escalation of privilege
Hi @ll,
the executable installer [°] and the "portable" version
of SumatraPDF 3.1.2 (available from
<https://www.sumatrapdfreader.org/download-free-pdf-viewer.html>)
are vulnerable to DLL hijacking [']:
The executable installers SumatraPDF-3.1.2-install.exe and
SumatraPDF-3.1.2-64-install.exe load and execute (tested on
a fully patched Windows 7 SP1) at least Version.dll, OLEACC.dll,
CryptBase.dll, NTMARTA.dll, LinkInfo.dll, NTSHRUI.dll,
NetUtils.dll, SrvCli.dll, CSCAPI.dll, SLC.dll, PropSys.dll from
the directory they are started from (the "application directory")
instead Windows "system directory", resulting in arbitrary code
execution.
For software downloaded with a web browser the "application
directory" is typically the user's "Downloads" directory: see
<http://seclists.org/fulldisclosure/2015/Nov/101> and
<http://seclists.org/fulldisclosure/2015/Dec/86> plus
<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>,
<http://seclists.org/fulldisclosure/2012/Aug/134> and
<http://blogs.technet.com/b/srd/archive/2014/05/13/load-library-safely.aspx>
Due to an application manifest embedded in the executable
installer which specifies "requireAdministrator" it will be
started with administrative privileges ("protected" administrators
are prompted for consent, unprivileged standard users are prompted
for an administrator password), resulting in an escalation of
privilege!
If (one of) the DLLs named above get(s) planted in the users
"Downloads" directory, for example per "drive-by download",
this vulnerability becomes a remote code execution WITH
escalation of privilege.
Proof of concept/demonstration:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. visit <https://skanthak.homepage.t-online.de/sentinel.html>,
download
<https://skanthak.homepage.t-online.de/skanthak/download/SENTINEL.DLL>
and save it as Version.dll in your "Downloads" directory, then
copy it as OLEACC.dll, CryptBase.dll, NTMARTA.dll, LinkInfo.dll,
NTSHRUI.dll, NetUtils.dll, SrvCli.dll, CSCAPI.dll, SLC.dll and
PropSys.dll;
2. visit <https://www.sumatrapdfreader.org/free-pdf-reader.html>,
download
<https://kjkpub.s3.amazonaws.com/sumatrapdf/rel/SumatraPDF-3.1.2-install.exe>
and save it in your "Downloads" directory;
3. execute SumatraPDF-3.1.2-install.exe from your "Downloads"
directory;
4. notice the message boxes displayed from the DLLs placed in
step 1: PWNED!
The "portable" SumatraPDF.exe version 3.1.2 loads and executes
at least (tested on a fully patched Windows 7 SP1) WinSpool.drv,
MSImg32.dll, Version.dll, OLEAcc.dll, WindowsCodecs.dll,
AppHelp.dll, SrvCli.dll, CSCAPI.dll, SLC.dll, MSFTEdit.dll,
MSLS31.dll, NTMARTA.dll, XMLLite.dll, LinkInfo.dll, CryptSp.dll,
RPCRTRemote.dll, ShDocVw.dll, IEFrame.dll, MPR.dll, SAMCli.dll,
SAMLib.dll, WksCli.dll, NetUtils.dll and WinMM.dll from its
"application directory" (which is typically writable by the user)
instead Windows' "system directory", resulting in arbitrary code
execution.
Mitigation(s):
~~~~~~~~~~~~~~
0. DON'T USE EXECUTABLE INSTALLERS [°]!
DON'T USE PORTABLE APPLICATIONS!
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 <https://skanthak.homepage.t-online.de/SAFER.html> as well as
<http://www.mechbgon.com/srp/index.html>.
stay tuned
Stefan Kanthak
[°] Self-extracting archives and executable installers are flawed^W
b(rainde)ad in concept and dangerous in practice: see
<https://skanthak.homepage.t-online.de/!execute.html>
['] A well-known (trivial, easy to exploit and easy to avoid) 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>
Timeline:
~~~~~~~~~
2017-01-21 sent vulnerability report regarding the installer
to author
NO ANSWER, not even an acknowledgement of receipt
2017-01-24 sent vulnerability report regarding the "portable"
version to author
NO ANSWER, not even an acknowledgement of receipt
2017-01-28 resent first vulnerability report to author
NO ANSWER, not even an acknowledgement of receipt
2017-01-31 resent second vulnerability report to author
NO ANSWER, not even an acknowledgement of receipt
2017-02-07 report published
_______________________________________________
Sent through the Full Disclosure mailing list
https://nmap.org/mailman/listinfo/fulldisclosure
Web Archives & RSS: http://seclists.org/fulldisclosure/
Powered by blists - more mailing lists