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

QNAPQsyncClientWindows 4.2.1.0602 Privilege Escalation

QNAPQsyncClientWindows 4.2.1.0602 Privilege Escalation
Posted Aug 18, 2017
Authored by Stefan Kanthak

QNAPQsyncClientWindows-4.2.1.0602.exe suffers from a privilege escalation vulnerability.

tags | exploit
SHA-256 | e1e12b2da3ad4a116388e459dccf615a31e67b830ffdf31117e5b0c3910bfc91

QNAPQsyncClientWindows 4.2.1.0602 Privilege Escalation

Change Mirror Download
Hi @ll,

the executable installer QNAPQsyncClientWindows-4.2.1.0602.exe,
available from <https://www.qnap.com/en/download>, has (like
almost all executable installers) multiple vulnerabilities:


#1: arbitrary (remote) code execution WITH escalation of privilege
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

On a fully patched Windows 7 SP1 it loads and executes the following
Windows system DLLs from its "application directory" instead the
"system directory" %SystemRoot%\System32\:
Version.dll, UXTheme.dll, WinMM.dll, SAMCli.dll, MSACM32.dll,
SFC.dll, SFC_OS.dll, DWMAPI.dll, MPR.dll, ShFolder.dll,
NTMARTA.dll

On other versions of Windows this list changes, but the vulnerable
executable installer always loads and executes some DLLs from its
"application directory".

This weakness is well-known and well-documented:
see <https://cwe.mitre.org/data/definitions/426.html>
and <https://cwe.mitre.org/data/definitions/427.html>
plus <https://capec.mitre.org/data/definitions/471.html>.

See <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> for
mitigations of this beginner's error.

For software downloaded with a web browser the "application
directory" is typically the user's "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 an attacker places one of the DLLs named above in the users
"Downloads" directory (for example per drive-by download, social
engineering, ...) this vulnerability becomes a remote code
execution WITH escalation of privilege.

Thanks to its "installer detection" Windows' user account control
requests administrative rights for the executable installer, the
DLLs entry points are called with administrative rights -> PWNED!

Demonstration:

1. download <http://home.arcor.de/skanthak/download/SENTINEL.DLL>
and save it as Version.dll in your "Downloads" directory, then
copy it as UXTheme.dll and NTMARTA.dll there too;

2. download
<https://eu1.qnap.com/Storage/Utility/QNAPQsyncClientWindows-4.2.1.0602.exe>
and save it your "Downloads" directory;

3. execute QNAPQsyncClientWindows-4.2.1.0602.exe from your
"Downloads" directory;

4. notice the message boxes displayed from ShFolder.dll etc. placed
in step 1.


#2: unsafe %TEMP% directory
~~~~~~~~~~~~~~~~~~~~~~~~~~~

It creates a subdirectory ns<letter><random_hex_value>.tmp in %TEMP%
where it extracts multiple DLLs to and executes them.
This subdirectory inherits the access rights of its parent %TEMP%,
so an unprivileged attacker^Wuser can replace the DLLs between their
creation and execution, again resulting in arbitrary code execution
with escalation of privilege.

See <https://cwe.mitre.org/data/definitions/377.html> and
<https://cwe.mitre.org/data/definitions/379.html> for this
well-known and well-documented weakness.

Demonstration:

create the following batch script

:WAIT
@If Not Exist "%TEMP%\ns*.tmp" Goto :WAIT
For /D %%! In ("%TEMP%\ns*.tmp") Do Set foobar=%%!
For %%! In ("%foobar%\*.dll") Do Copy /Y "%USERPROFILE%\Downloads\Version.dll" "%%!"

and start it, then rerun QNAPQsyncClientWindows-4.2.1.0602.exe


Additionally see <http://seclists.org/fulldisclosure/2015/Dec/32>,
<http://seclists.org/fulldisclosure/2015/Oct/109>,
<http://seclists.org/fulldisclosure/2015/Nov/101> and
<http://seclists.org/fulldisclosure/2015/Dec/86>,
plus <https://skanthak.homepage.t-online.de/!execute.html>
and <https://skanthak.homepage.t-online.de/sentinel.html>


FIX:
~~~~

* DON'T build executable installers at all!

* Provide either a *.MSI or a *.CAB plus an *.INF

* NEVER use executable installers at all!

* Add the NTFS ACE "(D;OIIO;WP;;;WD)" meaning
"deny execution of files in this directory and all subdirectories"
to the NTFS ACL of every %TEMP% directory!

JFTR: when execution in %TEMP% is denied, the defective
installer display a dialog box with the blatant lie

"QSync is running.
Click [OK] to close QSync and continue the installation,
or [Cancel] to terminate the process."

and repeats it after clicking [OK], over and over again.
The only way to exit this loop is [Cancel]


stay tuned
Stefan Kanthak


Timeline:
~~~~~~~~~

2017-07-29 vulnerability report sent to vendor

automated response from vendor:
"Our team will get back to you as soon as possible."

no more reaction from vendor

2017-08-07 vulnerability report resent to vendor

automated response from vendor:
"Our team will get back to you as soon as possible."

no more reaction from vendor

2017-08-16 report published


Login or Register to add favorites

File Archive:

October 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Oct 1st
    39 Files
  • 2
    Oct 2nd
    23 Files
  • 3
    Oct 3rd
    18 Files
  • 4
    Oct 4th
    20 Files
  • 5
    Oct 5th
    0 Files
  • 6
    Oct 6th
    0 Files
  • 7
    Oct 7th
    17 Files
  • 8
    Oct 8th
    66 Files
  • 9
    Oct 9th
    25 Files
  • 10
    Oct 10th
    20 Files
  • 11
    Oct 11th
    21 Files
  • 12
    Oct 12th
    0 Files
  • 13
    Oct 13th
    0 Files
  • 14
    Oct 14th
    0 Files
  • 15
    Oct 15th
    0 Files
  • 16
    Oct 16th
    0 Files
  • 17
    Oct 17th
    0 Files
  • 18
    Oct 18th
    0 Files
  • 19
    Oct 19th
    0 Files
  • 20
    Oct 20th
    0 Files
  • 21
    Oct 21st
    0 Files
  • 22
    Oct 22nd
    0 Files
  • 23
    Oct 23rd
    0 Files
  • 24
    Oct 24th
    0 Files
  • 25
    Oct 25th
    0 Files
  • 26
    Oct 26th
    0 Files
  • 27
    Oct 27th
    0 Files
  • 28
    Oct 28th
    0 Files
  • 29
    Oct 29th
    0 Files
  • 30
    Oct 30th
    0 Files
  • 31
    Oct 31st
    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