gecko-dev/mozglue
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
..
android Bug 1654103: Standardize on Black for Python code in `mozilla-central`. 2020-10-26 18:34:53 +00:00
baseprofiler Bug 1677130 - Allow out-of-order ReleaseChunk - r=canaltinova 2021-01-12 23:30:27 +00:00
build Bug 1682948 - supress issue found while enabling full shutdown. r=decoder 2021-01-08 20:08:11 +00:00
dllservices Bug 1679272 - Include ScopeExit.h exactly where used. r=andi 2020-12-07 14:25:59 +00:00
linker Bug 1654103: Standardize on Black for Python code in `mozilla-central`. 2020-10-26 18:34:53 +00:00
misc Bug 1684532 - Detect injected dependent modules in NtMapViewOfSection. r=mhowell 2021-01-13 15:13:18 +00:00
static Bug 1617369 - Reformat mozglue/ using rustfmt r=glandium 2020-03-04 06:12:38 +00:00
tests Bug 1677130 - Allow out-of-order ReleaseChunk - r=canaltinova 2021-01-12 23:30:27 +00:00
moz.build Bug 1654103: Standardize on Black for Python code in `mozilla-central`. 2020-10-26 18:34:53 +00:00