Frida 17.30.1 Released ∞
release
Frida can now attach to sandboxed processes on Windows, such as Chrome’s renderers. Also in this release: idund serving clients in other network namespaces, a fix for the Android helper hanging at startup on Android 8, tracked down by @pimterry, and Worker.terminate() actually stopping the worker, thanks to @jacobvduncan.
Sandboxed processes on Windows
@danielletuggleiwx195-droid reported that attaching to a Chrome renderer failed, complaining about an unresolved import from bcrypt.dll. A process with a restricted token, as Chrome’s renderers have at the Lockdown level of its sandbox, can do very little: it can’t open the DLLs our agent imports, it can’t initialize Winsock, and it can’t open the pipe back to us by name. Each of those got its own fix:
- When the target’s token is restricted, we derive a loader token from its parent’s, restricted to a few well-known groups and kept at the target’s integrity level. Missing imports are loaded on threads impersonating it, along with two DLLs the agent would otherwise load lazily, and Winsock is started up under it, so the agent’s own call only takes a reference.
- The agent is handed its end of the pipe by duplicating the handle into the target, so it never opens the pipe by name. A sandboxed process can’t open named pipes at all, whatever their access control list says.
- DbgHelp and SymSrv are optional, so they are skipped when they can’t be mapped, rather than failing the injection. SymSrv imports bcrypt.dll, whose initialization fails inside the renderer sandbox, which is what the error was about. Without SymSrv you get symbols, just not from a symbol server.
Thanks for the report!
Idun
When idund has sufficient access, it exposes its tunnel to an iOS device as a TUN interface, and otherwise handles it in user space through lwIP. In the former case, a client outside the daemon’s network namespace can’t reach that interface, as when idund runs in a container of its own. Such a client now asks idund to create its sockets. They stay bound to the daemon’s network namespace, so TCP and UDP traffic still takes the direct path, without any relaying. This was done together with @mrmacete.
Android
@pimterry reported that our helper hung at startup on stock Android 8 emulators, and tracked down the cause. While the system starts up there, it forks, and the child calls exit(). The child inherited the atexit() handler we added in 17.27.5 to destroy our Java VM, which then waited forever on daemon threads that don’t exist in the child, so the helper never started. The VM is now only destroyed in the process that created it. Thanks!
GumJS
@jacobvduncan noticed that Worker.terminate() didn’t stop the worker on QuickJS. It rejected pending exports calls, but the worker’s timers kept running and its messages kept arriving until the script was unloaded. It now stops the worker and its thread, and posting to a terminated worker throws. Thanks!
Build
Builds configured with –with-assets=installed failed to compile on Apple systems since 17.27.6, as the code that thins the helper referred to resources that only exist when assets are embedded.
Enjoy!
Changelog
- windows: Support injecting into sandboxed targets. Thanks @danielletuggleiwx195-droid!
- windows: Map the agent’s dependencies best-effort.
- windows: Allow impersonation when loading modules.
- pipe: Support handing the client end to a process.
- dbghelp: Support a mapped DbgHelp without SymSrv.
- idun: Hand out sockets across network namespaces. Thanks @mrmacete!
- android: Skip VM teardown in forked children. Thanks @pimterry!
- gumjs: Make Worker.terminate() stop the worker. Thanks @jacobvduncan!
- darwin: Fix helper thinning with installed assets.
oleavr