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

Defense In Depth The Microsoft Way Part 3

Defense In Depth The Microsoft Way Part 3
Posted Jun 17, 2013
Authored by Stefan Kanthak

This is a long advisory detailing a lot of back and forth between Microsoft and a researcher in regards to thousands of binary planting issues.

tags | advisory
SHA-256 | 4e3fd4327955e3fdb8ef5db89ace7b235c3daf12236f829844f610a702d23c65

Defense In Depth The Microsoft Way Part 3

Change Mirror Download
Hi @ll,

many (if not most of the) Windows system utilities and system routines
(including the kernel and its subsystems) as well as many user programs
(including the "shell" Windows Explorer, Windows Media Player, Internet
Explorer, Microsoft Office, etc.) load libraries/satellites at runtime
via filenames read from registry or .INI entries (see examples 0 to 13

Unfortunately, MANY of the references (about 5500 in Windows 7 x64 SP1
and about 4700 in Windows 7 x86 SP1) to libraries/satellites are made
just via their filename, without their (well-known!) fully qualified

Every application/utility/system routine that uses one of these system
routines/subsystems, but has not taken precautions against loading DLLs
and/or satellites from CWD (see <http://support.microsoft.com/kb/2264107>
and <http://support.microsoft.com/kb/2269637>) is thus susceptible to
"binary planting" attacks.

The VERY simple fix/mitigation: ALWAYS use the (well-known!) fully
qualified path to all the libraries/satellites you reference!

JFTR: almost all of the registry entries listed in the examples below
can be specified as (typically) "%SystemRoot%\System32\<library>.dll"
with the REG_EXPAND_SZ data type.


2004-08-23 informed vendor about still unfixed principal security
flaws due to unqualified filenames and Windows' EXE/DLL
search/load order after release of SP2 for Windows XP

JFTR: Microsoft started their "trustworthy computing" initiative in
2001, and XP SP2 was supposed to eliminate many of the errors
Microsoft made in previous versions of NT.

2004-08-25 vendor replies "no vulnerabilities", but forwards report
to product groups/teams

2004-09-02 vendor still wont see vulnerabilities, asks for POC(s)

2008-05-30 vendors publishes

2009-04-15 vendor publishes <http://support.microsoft.com/kb/959426>

2010-08-23 vendor publishes
and updates it over and over again since then

2010-08-24 asked vendor in response to advisory 2269637 what the
product groups/teams had done in the past 6 years since
my initial report to eliminate this attack vector

2010-09-04 compiled an exhaustive list with the about 5500(!)
unqualified filenames (and some more errors) in the
registry of Windows 7 x64 and sent it to vendor;
<http://home.arcor.de/skanthak/download/W7_ERROR.INF> and
<http://home.arcor.de/skanthak/download/W7_ISSUE.INF> are
the lists with major/minor errors found in the registry
of Windows 7 x86 SP1

2010-09-11 asked vendor when to expect results from report sent in
2004, and when to expect a properly/thoroughly engineered
Windows with "defense in depth" REALLY applied [*]

2010-09-13 vendor replied (to question from 2010-08-24): we have no
feedback from the product teams

2011-09-13 vendor publishes <http://support.microsoft.com/kb/2570947>

2011-12-28 vendor informs that the BSOD from example 3 was filed as a
stability bug against Windows 8

2012-05-08 vendor publishes<http://support.microsoft.com/kb/2686509>

stay tuned

[*] for (german) Windows XP Professional I provide the script
<http://home.arcor.de/skanthak/download/XP_FIXIT.INF> that corrects
the errors in the registry which remain after fixing the scripts
\i386\DMREG.INF and \i386\HIVE*.INF and the errors in installed
*.theme and generated DESKTOP.INI files which remain after fixing
the \i386\*.TH_ files (usage instructions included in the script).

PS: if you missed part 1 and/or part 2, see
<http://seclists.org/fulldisclosure/2013/May/107> and

Example 0:

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layouts\xxxxxxxx]
"Layout File"="KBDxyz.DLL"

Fixed with <http://support.microsoft.com/kb/2686509> alias

JFTR: Microsoft started their "trustworthy computing" initiative in
2001; 11 years later they still have loads of silly security
holes due to their sloppy attitude!

Example 1:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]

Fixed with <http://support.microsoft.com/kb/269049> alias

JFTR: the vulnerability with "Userinit"="userinit.exe" was introduced
when <http://support.microsoft.com/kb/249321> was applied.

Example 2: NETSH.EXE

... some 20 more entries ...

POC: download <http://home.arcor.de/skanthak/download/SENTINEL.DLL> or
and store it with the name of one of the DLLs listed in the above
registry key (or add a registry entry "0"="SENTINEL.DLL" resp.
"0"="imm.dll" there); copy the 32-bit version of NETSH.EXE into
a second directory; open a command prompt, "cd" into the directory
where you downloaded the DLL; run the copy of NETSH.EXE from the
command prompt and admire the application popup from the DLL.-)

On 64-bit systems download
and proceed like above.

JFTR: if you think "ouch! how complicated" please check whether you've
ever copied utilities like NETSH.EXE to another location, for
instance your \\%LOGONSERVER%\NETLOGON\ share, and run them from
there during logon (see <http://support.microsoft.com/kb/264061>
and <http://support.microsoft.com/kb/306850>).

"Once bitten twice shy"? Not in Redmond, not at Microsoft!

Example 3: the font drivers of the Win32 (kernel) subsystem

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Font Drivers]
"Adobe Type Manager"="atmfd.dll"

JFTR: change this entry to =expand:"%SystemRoot%\\System32\\atmfd.dll",
then start another user session (via fast user switching or RDP)
CSRSS.EXE due to a silly programming error in the code evaluating
the environment variable %SystemRoot%. OUCH!

"Adobe Type Manager"="C:\\Windows\\System32\\atmfd.dll" but works.

Example 4: the SPOOLER

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Environments\Windows NT x86\Print Processors\winprint]

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Local Port]

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Microsoft Shared Fax Monitor]

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port]

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\USB Monitor]

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\WSD Port]

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Providers\Internet Print Provider]

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Providers\LanMan Print Services]

JFTR: when these registry entries are changed to
the SPOOLER silently fails: no port monitors and no print providers
are loaded, but no event log entry is written and no other indication
of the fault given to the user!

"<...>"="C:\\Windows\\System32\\<library>.dll" but works.

Example 5: the RPC service/system




Example 6: the cryptography subsystem


[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\Calais\SmartCards\Identity Device (Microsoft Generic Profile)]

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\Calais\SmartCards\Identity Device (NIST SP 800-73 [PIV])]

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\Defaults\Provider\Microsoft Base Smart Card Crypto Provider]
"Image Path"="basecsp.dll"

... some 100 entries more ...



Example 7: OLE and COM


This ONE was fixed with <http://support.microsoft.com/kb/2570947>
alias <http://technet.microsoft.com/security/bulletin/ms11-071>

The following HUNDREDS are still lurking around and waiting to be exploited!

JFTR: <http://msdn.microsoft.com/library/ms691424.aspx> says:

| LocalServer Specifies the full path to a 16-bit local server application.
| LocalServer32 Specifies the full path to a 32-bit local server application.
<http://msdn.microsoft.com/library/ms682390.aspx> says:

| InprocServer32
| (Default) = path
<http://msdn.microsoft.com/library/ms694328.aspx> says:

| InprocServer
| (Default) = path
At Microsoft, we dont read our own documentation, we dont care!

POC: download <http://home.arcor.de/skanthak/download/SENTINEL.DLL> or
and store it as DPNET.DLL; copy the 32-bit version of WSCRIPT.EXE
or CSCRIPT.EXE into a second directory; create a file POC.VBS with
the following single line: CreateObject("DirectPlay8.Peer.1")
open a command prompt, "cd" into the directory where you downloaded
the DLL; run the copy of WSCRIPT.EXE or CSCRIPT.EXE with POC.VBS as
argument from the command prompt and admire the application popup
from the DLL.-)

JFTR: you can use any other program which instanciates COM objects instead
of the Windows Script Host!


... some 100 entries more ...








... some 100 entries more ...




Example 8: the group policies' client side extensions

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\GPExtensions\{guidguid-guid-guid-guid-guidguidguid}]

Example 9: directplay

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DirectPlay\Service Providers\Internet TCP/IP Connection For DirectPlay]

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DirectPlay\Service Providers\Internet TCP/IP Connection For DirectPlay]

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DirectPlay\Service Providers\Modem Connection For DirectPlay]

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DirectPlay\Service Providers\Serial Connection For DirectPlay]

Example 10: misc.




Example 11: TS Client

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Terminal Server Client\TransportExtensions]

[HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client\Default\Addins\<subkey>]

[HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client\<connection>\Addins\<subkey>]

Example 12: MMC.EXE, the "Microsoft Management Console"



Example 13: DESKTOP.INI (folder customization), *.theme, *.LNK

The shell caches the strings referenced via ="@<library.dll>,-123"
in DESKTOP.INI and *.theme files, *.LNK etc. as well as the registry
below the following registry keys:

[HKEY_USERS\.DEFAULT\Software\Classes\Local Settings\MuiCache]
"<...>.dll,-123"="...some string..."

[HKEY_CURRENT_USER\Software\Classes\Local Settings\MuiCache]
"<...>.dll,-123"="...some string..."

Look for yourself which files are loaded without fully qualified path!

JFTR: ONLY IF resource DLLs are loaded with LoadLibraryEx() and the
<http://msdn.microsoft.com/en-us/ms684179>) there will be no
call to the DllMain entry point.



The filenames specified here get prefixed with %SystemRoot%\System32\
before their use.

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
    0 Files
  • 16
    Apr 16th
    0 Files
  • 17
    Apr 17th
    0 Files
  • 18
    Apr 18th
    0 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


packet storm

© 2022 Packet Storm. All rights reserved.

Security Services
Hosting By