gecko-dev/browser/app/winlauncher
Toshihito Kikuchi 7545ed9378 Bug 1684532 - Detect injected dependent modules in NtMapViewOfSection. r=mhowell
This patch is to improve the way to detect an injected dependent module for
automatic DLL blocking (bug 1659438).

In the previous version, we created a list of dependent modules in the launcher
process and shared it with other processes via the shared section.  However, it
was not compatible with third-party applications who tamper the Import Table and
revert it in the injected module's DllMain (bug 1682834) because we parsed the
Import Table in the launcher process after it was reverted.

With this patch, we check the Import Table in `patched_NtMapViewOfSection`,
so we can see tampering before it's reverted.  More specifically, we create
a list of dependent modules in the browser process as below.

1. The launcher process creates a section object and initializes
   the kernel32.dll's functions in it.

2. The launcher process transfers a writable handle of the shared
   section to the browser process.

3. In the browser process, if an injected dependent module is being
   mapped by `NtMapViewOfSection`, we add its NT path to the shared
   section and block it with `REDIRECT_TO_NOOP_ENTRYPOINT`.

4. The `main` function of the browser process converts the writable
   handle of the shared section into a readonly handle.

5. The browser process transfers a readonly handle of the shared
   section to a sandbox process.

Since automatic DLL blocking may still cause a compat issue like bug 1682304,
we activate it only in Nightly for now.

Differential Revision: https://phabricator.services.mozilla.com/D101460
2021-01-13 15:13:18 +00:00
..
freestanding Bug 1684532 - Detect injected dependent modules in NtMapViewOfSection. r=mhowell 2021-01-13 15:13:18 +00:00
test Bug 1684532 - Detect injected dependent modules in NtMapViewOfSection. r=mhowell 2021-01-13 15:13:18 +00:00
DllBlocklistInit.cpp Bug 1684532 - Detect injected dependent modules in NtMapViewOfSection. r=mhowell 2021-01-13 15:13:18 +00:00
DllBlocklistInit.h Bug 1630281 - Cache the executable's IAT for ntdll.dll before COM initialization. r=mhowell 2020-04-30 18:26:18 +00:00
ErrorHandler.cpp Bug 1588245 - Collect the assembly pattern of a target function on detour failure. r=mhowell 2020-09-17 01:42:26 +00:00
ErrorHandler.h Bug 1630444: Part3 - Send the launcher process failure ping from the browser process. r=aklotz 2020-08-26 19:01:27 +00:00
LaunchUnelevated.cpp Bug 1630444: Part1 - Put LauncherError behind MOZ_USE_LAUNCHER_ERROR. r=aklotz 2020-08-26 19:01:44 +00:00
LaunchUnelevated.h Bug 1642577 - De-elevate the process with CreateProcessAsUser if the compat flag RUNASADMIN is set. r=aklotz 2020-06-22 18:37:49 +00:00
LauncherProcessWin.cpp Bug 1630444: Part1 - Put LauncherError behind MOZ_USE_LAUNCHER_ERROR. r=aklotz 2020-08-26 19:01:44 +00:00
LauncherProcessWin.h
NtLoaderAPI.cpp Bug 1676913 - Restrict a caller of GetDependentModulePaths to xul.dll. r=mhowell 2020-11-18 01:03:02 +00:00
ProcThreadAttributes.h Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj 2020-01-20 16:19:48 +00:00
SameBinary.h Bug 1648384 - Make use of Result::propagateErr. r=mhowell 2020-06-25 16:07:28 +00:00
moz.build Bug 1654103: Standardize on Black for Python code in `mozilla-central`. 2020-10-26 18:34:53 +00:00