in 2009/2010, after beeing hit by "carpet bombing" and "binary
planting" alias "DLL hijacking/spoofing/preloading" (see
<https://blogs.technet.com/b/
and <https://technet.microsoft.
Microsoft finally started to provide security guidance/advisories
for "safe library loading" to Windows developers:
<https://msdn.microsoft.com/
| Applications can control the location from which a DLL is loaded by
| specifying a full path or using another mechanism such as a manifest.
<https://msdn.microsoft.com/
| Wherever possible, specify a fully qualified path when using the
| LoadLibrary, LoadLibraryEx [...] functions.
<http://blogs.technet.com/b/
| When an application loads a DLL without specifying a fully
| qualified path name, Windows will attempt to locate the DLL by
| searching a defined set of directories.
...
| Development best practices state that applications should call
| SetDllDirectory with a blank path before calling
| LoadLibrary("foo.dll") to ensure that foo.dll is not loaded from
| the current directory. We are investigating whether any of our
| own applications are affected by this class of vulnerability so
| that we can take appropriate action to protect customers.
<https://support.microsoft.
| Use fully qualified paths for all calls to LoadLibrary, [...]
| where you can.
<https://technet.microsoft.
| This exploit may occur when applications do not directly specify
| the fully qualified path to a library it intends to load.
<https://blogs.technet.com/b/
| Always specify the fully qualified path when the library location
| is constant.
Now the (obviously rhetorical) question: does Microsoft follow their
own guidance?
The (also obvious) answer: THEY DON'T, at least for existing code,
despite "trustworty computing" or the "secure development lifecycle"
Microsoft brags about since years.
Some examples for unsafe library loading recently published:
FEClient.dll (see CVE-2016-0014 and MS16-007):
introduced in Windows 2000, loaded without fully qualified path
by AdvAPI32.dll since then.
FEClient.dll is loaded from the "application directory" of every
program which uses EFS functions (see
<https://technet.microsoft.
and <https://msdn.microsoft.com/
all executable installers and self-extractors used by Microsoft
allow^Wsupport "DLL hijacking" via FEClient.dll!
OCIW32.dll, OCI.dll (see MS15-132):
loaded without fully qualified path by MSDAORA.DLL since Windows NT4.
ELSEXT.dll (see MS15-132):
loaded without fully qualified path by ELS.DLL since Windows Vista.
MQRT.dll (see MS15-132):
loaded without fully qualified path by COMSVCS.DLL since Windows NT4.
EDBBCli.dll, ESEBCli2.dll (see MSKB275876):
loaded without fully qualified path by NTBackup.exe since Windows NT4.
Mitigation:
~~~~~~~~~~~
[HKEY_LOCAL_MACHINE\SOFTWARE\
"CWDIllegalInDLLSearch"=dword:
[HKEY_LOCAL_MACHINE\SYSTEM\
"EDBBCli"="C:\\Windows\\
"ESEBCli2"="C:\\Windows\\
UXTheme.dll (see CVE-2012-4206, ...):
introduced in Windows XP, loaded without fully qualified path by
AppWiz.cpl, BrowseUI.dll, ComDlg32.dll, Dot3UI.dll, DUser.dll,
Explorer.exe, HelpCtr.exe, Kernel32.dll, LogonUI.exe, MMC.exe,
MSHTML.dll, Shell32.dll, ShlWAPI.dll, ThemeUI.dll, WSCUI.dll,
WZCDlg.dll and MANY more since then.
Almost all executables using the Windows GUI allow^Wsupport
"DLL hijacking" via UXTheme.dll.
Mitigation:
~~~~~~~~~~~
use SAFER alias Software Restriction Policies and deny execution
everywhere except %SystemRoot% and below and %ProgramFiles% and
below.
See <http://home.arcor.de/
<http://mechbgon.com/srp/
stay tuned
Komentarų nėra:
Rašyti komentarą