[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Defense in depth -- the Microsoft way (part 30): on exploitable Win32 functions
since Microsoft won't -- despite (hopefully not only) my constant
nagging and quite some bug reports about unquoted command lines
for more than a dozen years now -- fix the BRAINDEAD behaviour
of Windows' CreateProcess*() functions to play try&error instead
of returning on error to their caller when interpreting their
lpCommandLine argument which lets the BLOODY BEGINNER's error
known as CWE-428 <https://cwe.mitre.org/data/definitions/428.html>
go undetected, I'll show some methods including the preconditions
on how to exploit it, i.e. execute a file of my choice.
JFTR: none of these methods should be new or unknown to any
Windows administrator, developer or QA engineer.-P
JFTR: in Microsoft's own terms these methods don't qualify as
security vulnerabilities due to their precondition(s).
* a file in %SystemDrive%\ which can be opened with the
access rights GENERIC_WRITE | DELETE and the attribute
* a user account holding the privilege SE_RESTORE_NAME.
handle = CreateFile(L"C:\\...", GENERIC_WRITE | DELETE,
..., NULL, OPEN_EXISTING,
* an empty file in %SystemDrive%\ which can be opened with
the access rights FILE_WRITE_EA | FILE_WRITE_ATTRIBUTES
and the attribute FILE_FLAG_OPEN_REPARSE_POINT;
* a user account holding the privileges SE_RESTORE_NAME and
handle = CreateFile(L"C:\\...",
FILE_WRITE_EA | FILE_WRITE_ATTRIBUTES,
..., NULL, OPEN_EXISTING,
DeviceIoControl(handle, FSCTL_SET_REPARSE_POINT, ...
Now wait until some program written by a dimwit of a developer
who (and of course his/her supervisors and QA too) never heard
of "long" filenames (which means they must have lived beneath
a rock for more than 20 years) executes your C:\PROGRAM.EXE
20+ years old: <https://support.microsoft.com/kb/102739/en-us>
~20 years old: <https://support.microsoft.com/kb/170669/en-us>
10+ years old: <https://support.microsoft.com/kb/812486/en-us>
Primary candidates: Apple iTunes, Microsoft .NET Framework 3.5
SP1 x64 (as preinstalled on Windows 7 x64 and Windows 2008 R2 AD
controllers), WHQL-certified drivers from HP, ALPS[*], Realtek[*],
Samsung, Synaptics, ... (many of those are available per Windows
Update and the Microsoft Update Catalog), MANY games, ...
As Microsoft's Aaron Margosis wrote last November pointing out
this BLOODY BEGINNER's error is unnessarily alarmist:
Of course all non-alarmists know for sure that the above named
preconditions don't exist anywhere.-(
What but REALLY alarmist is: companies like Apple release version
after version of their products/drivers^Wcrapware without the
TRIVIAL fix for this well-known vulnerability, even when notified
over and over again!
"Defense in depth"?
BRAINDEAD behaviour of Windows CreateProcess*() functions?
Yes, of course, always!
Taking care for the safety and security of their customers systems?
stay tuned (and far away from crapware!)
[*] see <https://support.microsoft.com/library/images/2647325.png>