gecko-dev/mozglue/misc
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
..
decimal
interceptor Bug 1684532 - Detect injected dependent modules in NtMapViewOfSection. r=mhowell 2021-01-13 15:13:18 +00:00
AutoProfilerLabel.cpp Bug 1665411 - Use first-fit mutexes on macOS r=spohl 2020-10-30 13:10:29 +00:00
AutoProfilerLabel.h
ConditionVariable_posix.cpp
ConditionVariable_windows.cpp
Debug.h Backed out changeset a4bf5887fc2a (bug 1680402) for being the most likely cause of bug 1686387. a=backout 2021-01-13 06:30:08 +02:00
DynamicallyLinkedFunctionPtr.h
ImportDir.h Bug 1671316 - Part1. Introduce CrossExecTransferManager. r=mhowell 2020-10-27 14:09:00 +00:00
MmapFaultHandler.cpp
MmapFaultHandler.h
MutexPlatformData_posix.h
MutexPlatformData_windows.h
Mutex_posix.cpp Bug 1665411 - Use first-fit mutexes on macOS r=spohl 2020-10-30 13:10:29 +00:00
Mutex_windows.cpp
NativeNt.h Bug 1684532 - Detect injected dependent modules in NtMapViewOfSection. r=mhowell 2021-01-13 15:13:18 +00:00
PlatformConditionVariable.h
PlatformMutex.h Bug 1665411 - Use first-fit mutexes on macOS r=spohl 2020-10-30 13:10:29 +00:00
PreXULSkeletonUI.cpp Bug 1671603: display skeleton ui elements in correct position when RTL is enabled r=dthayer 2020-12-22 17:22:07 +00:00
PreXULSkeletonUI.h Bug 1671603: display skeleton ui elements in correct position when RTL is enabled r=dthayer 2020-12-22 17:22:07 +00:00
Printf.cpp Bug 1519636 - Reformat with clang-format-11 to the Google coding style r=andi,sg,geckoview-reviewers,snorp 2020-11-18 09:05:59 +00:00
Printf.h
StackWalk.cpp
StackWalk.h
StackWalk_windows.h
TimeStamp.cpp Bug 1205985 - Implement something to get the process uptime with and without the time the device was suspended. r=haik,dmajor,jld 2021-01-12 12:34:59 +00:00
TimeStamp.h
TimeStamp_darwin.cpp Bug 1205985 - Implement something to get the process uptime with and without the time the device was suspended. r=haik,dmajor,jld 2021-01-12 12:34:59 +00:00
TimeStamp_posix.cpp Bug 1205985 - Implement something to get the process uptime with and without the time the device was suspended. r=haik,dmajor,jld 2021-01-12 12:34:59 +00:00
TimeStamp_windows.cpp Bug 1205985 - Implement something to get the process uptime with and without the time the device was suspended. r=haik,dmajor,jld 2021-01-12 12:34:59 +00:00
TimeStamp_windows.h
Uptime.cpp Bug 1205985 - Implement something to get the process uptime with and without the time the device was suspended. r=haik,dmajor,jld 2021-01-12 12:34:59 +00:00
Uptime.h Bug 1205985 - Implement something to get the process uptime with and without the time the device was suspended. r=haik,dmajor,jld 2021-01-12 12:34:59 +00:00
WinUtils.h
WindowsDpiAwareness.h Bug 1665357 - Ensure DPI_AWARENESS_CONTEXT is defined r=mhowell 2020-09-16 20:14:40 +00:00
WindowsMapRemoteView.cpp
WindowsMapRemoteView.h
WindowsProcessMitigations.cpp Bug 1681123 - Bump mingw-w64 revision to fix _aligned_malloc in clang 12 r=tjr 2020-12-07 17:55:27 +00:00
WindowsProcessMitigations.h
WindowsUnicode.cpp
WindowsUnicode.h
moz.build Bug 1205985 - Implement something to get the process uptime with and without the time the device was suspended. r=haik,dmajor,jld 2021-01-12 12:34:59 +00:00
nsWindowsDllInterceptor.h Bug 1671316 - Part2. Pass CrossExecTransferManager to FuncHookCrossProcess and Kernel32ExportsSolver. r=mhowell 2020-10-27 14:08:49 +00:00