Frida
Associated vulnerabilities
1 CVE Mallory has correlated with this family across public research and vendor advisories. Each card links to the full Mallory page for that vulnerability.
Associated threat actors
2 distinct threat actors Mallory has associated with this family across public reporting. Open in Mallory to see the full evidence chain and overlapping campaigns.
Frida was the heart of the French implant, reverse engineering revealed. Frida is used by security researchers and hackers alike to run legal testing or to arrange illegal interference. Running as a superuser, Frida can change anything and everything.
Frida was the heart of the French implant, reverse engineering revealed. Frida is used by security researchers and hackers alike to run legal testing or to arrange illegal interference. Running as a superuser, Frida can change anything and everything.
Techniques & procedures
42 distinct techniques documented for this family, organized by ATT&CK tactic.
Resource Development
1 technique
Resource Development
I prefer a more isolated and reproducible environment to play around with... my first goal was to get Widevine to run inside Qiling... Using the Qiling emulator, I verified the claim of the paper that the keybox can be dumped
Initial Access
2 techniques
Initial Access
un combo d’une faille visant les téléphones Android, « Bad Binder », et de la boîte à outil cyber Frida
EncroChat’s update server, at the web address “update.encrochat.ch”, was under French jurisdiction. EncroChat phones were set up to check for updates every time they were used... They would build an exact replica of EncroChat’s update server... Then they would send in Bad Binder.
Execution
6 techniques
Execution
We can use any non-Play Store Android device... We need Frida... Hooking the SDES::create function... We leverage Frida’s ability to define and call arbitrary functions to mimic program flow for creating and modifying the buffer in the process’s memory.
L’unité gouvernementale française STNCJ ... a exploité : La vulnérabilité CVE-2019-2215 dite « Bad Binder » ... Le 1er avril 2020, l’implant a été injecté via un faux serveur de mise à jour.
“Frida and Objection” and “hooking classes.”
Frida was the heart of the French implant... It monitors instructions and will “hook” any process inside the processor by attaching from an “interceptor”. The hook triggers a “trampoline”, bouncing out of the intended program into exploit code written by the hacker.
Besides just observing function calls, we can also manipulate them. As an example, we can try to hook the Javascript evaluation function and change the code that will be run... args[0] = new_code;
insject is fundamentally an LD_PRELOAD library that uses libfrida-gum to set up a hook on a configurable symbol/function/address/etc. (default main()) that, when hit, kicks off the container attach logic (including all of the setns(2) calls).
Persistence
1 technique
Persistence
"Frida lets me hook into the running .NET runtime, bypass certificate pinning, patch out biometric checks..."
Privilege Escalation
3 techniques
Privilege Escalation
"FRIDA is a Dynamic instrumentation toolkit... It helps you to inject JS snippets into native apps... you can inject your own scripts into the black box processes."
Now when the user provides a password, the _ZN24cQtUserPermissionManager15passwordMatchesEi7QString function will always return true no matter if the provided password matches the hashed/encrypted password from the mixer. As a result, any password is accepted and we bypassed authentication!
Обход root-detection... Frida хукает эти проверки и возвращает «чисто». Magisk Hide/Zygisk маскирует root от приложений на уровне системы.
Stealth
11 techniques
Stealth
MASVS-RESILIENCE - группа, вызывающая больше всего споров. Она требует обфускации, root/jailbreak-детекта, anti-debugging. Маппинг на MITRE ATT&CK: T1027 (Obfuscated Files or Information) ...
Change class challenge_01’s variable ‘chall01’ to 1 ... challenge_01.chall01.value = 1;
"FRIDA is a Dynamic instrumentation toolkit... It helps you to inject JS snippets into native apps... you can inject your own scripts into the black box processes."
Subtract 10 seconds from timeStart and submit as above.
Расшифровка IPA Deobfuscate/Decode Files or Information (T1140) ... frida-ios-dump для дампа декриптованного бинарника
По MITRE ATT&CK jailbreak bypass - аналог Virtualization/Sandbox Evasion (T1497): приложение пытается определить модификацию среды выполнения, а атакующий маскирует этот факт.
Frida was the heart of the French implant... It monitors instructions and will “hook” any process inside the processor by attaching from an “interceptor”. The hook triggers a “trampoline”, bouncing out of the intended program into exploit code written by the hacker.
Besides just observing function calls, we can also manipulate them. As an example, we can try to hook the Javascript evaluation function and change the code that will be run... args[0] = new_code;
insject is fundamentally an LD_PRELOAD library that uses libfrida-gum to set up a hook on a configurable symbol/function/address/etc. (default main()) that, when hit, kicks off the container attach logic (including all of the setns(2) calls).
it is simple enough, if tedious, to use Frida to wrap the JNI APIs that enable C/C++ code to perform reflection and invoke the necessary Java methods.
“Anti-Debugging: Checks for debuggers, Frida, Xposed, root indicators, and emulators.”
Defense Impairment
4 techniques
Defense Impairment
This enables us to bypass two of the cert pinning checks... The same replacement attempt was made with the full cert, albeit not very successfully.
MASVS-RESILIENCE - группа, вызывающая больше всего споров... Маппинг на MITRE ATT&CK: T1027 (Obfuscated Files or Information) и T1553.002 (Code Signing). На пентесте проверка RESILIENCE сводится к попытке обойти защиты: Подключить Frida к процессу Пропатчить APK через apktool Переподписать Запустить на рутованном устройстве
"Frida lets me hook into the running .NET runtime, bypass certificate pinning, patch out biometric checks..."
“Обход certificate pinning через Frida ... После этого весь трафик приложения идёт через Burp”.
Credential Access
9 techniques
Credential Access
In a lab setting, we set up a machine to view our own http(s) traffic using mitmproxy from our test device... We’ve included flows files in this post, which can be opened in mitmproxy to show the requests we’ve observed with location coordinates.
Each time a user opened their phone, Frida hooked the unlock password and sent it back.
...перехват методов через Credential API Hooking (T1056.004, Collection / Credential Access) в runtime.
Bruteforce check07Pin() then confirm with chall07() ... we can cycle through all the possible values from 9999 to 0000.
Обход биометрии Multi-Factor Authentication Interception (T1111) ... Патч LAContext через Frida
Основное применение в мобильном пентесте: ... извлечение ключей и токенов из памяти.
"Frida lets me hook into the running .NET runtime, bypass certificate pinning, patch out biometric checks..."
5 apps envoient des fichiers de configuration OpenVPN en clair, permettant le détournement du tunnel VPN par un attaquant on-path
But SSL pinning in Flutter is trickier... Hooking libapp.so works: var ssl_verify = Module.findExportByName("libapp.so", "SSL_CTX_set_custom_verify"); if (ssl_verify) { Interceptor.attach(ssl_verify, { onEnter: function(args) { console.log("Bypassing SSL pinning"); } }); }
Discovery
6 techniques
Discovery
In a lab setting, we set up a machine to view our own http(s) traffic using mitmproxy from our test device... We’ve included flows files in this post, which can be opened in mitmproxy to show the requests we’ve observed with location coordinates.
Following this same idea over and over for each type of packets, we can slowly learn what packets look like for each gamestate update... I was able to make a partial table of command bytes by reading the 11th byte of any command.
We need to get a running instance ... The following code will do it through the Java.choose Frida API.
По MITRE ATT&CK jailbreak bypass - аналог Virtualization/Sandbox Evasion (T1497): приложение пытается определить модификацию среды выполнения, а атакующий маскирует этот факт.
The researcher dumped the Whisker iOS application, used reflutter and Frida to hook "_sendLoginRequest," and identified GraphQL and API endpoints.
“Anti-Debugging: Checks for debuggers, Frida, Xposed, root indicators, and emulators.”
Collection
6 techniques
Collection
“iOS apps are stored as encrypted ipa files… we can use frida-ios-dump to do this at runtime.”
Each time a user opened their phone, Frida hooked the unlock password and sent it back.
...перехват методов через Credential API Hooking (T1056.004, Collection / Credential Access) в runtime.
The data flowing into this address every hour now included up to tens of millions of data “objects” called JSONs... each reporting a single event on an infected phone, as it happened – every password entered, every image made or received, every message, every note made into or deleted from an encrypted EncroNotes container.
It is for example possible to use kernel drivers to emulate image sources, and to use them during capture. This is what is done by the virtual cameras of OBS.
5 apps envoient des fichiers de configuration OpenVPN en clair, permettant le détournement du tunnel VPN par un attaquant on-path
Command and Control
4 techniques
Command and Control
The full hidden and secret address for the control server... was https://147.135.143.19:443/...
WebViewClient.onReceivedSslError calls handler.proceed() instead of showing an error page.
frida-server runs inside the Android emulator with root privileges and listens on port 27042. The client (frida-tools) runs on the Windows host and connects via ADB port forwarding: adb -s emulator-555X forward tcp:27042 tcp:27042
MASVS-NETWORK - TLS-конфигурация, certificate pinning и отсутствие cleartext-трафика. В терминах MITRE ATT&CK - противодействие T1573 (Encrypted Channel): если приложение не пиннит сертификат, атакующий с позиции MitM перехватывает «зашифрованный» канал, подставив свой CA.
Exfiltration
1 technique
Exfiltration
Through this link, the police server maintained communications with and could command every infected phone... The police malware server was also the exfiltration endpoint. From 2 April 2020 on... a torrent of, eventually, billions of data objects (JSONs) was sent to the police infrastructure.
Recent activity
4 sources tracked across advisories, community write-ups, and news. New activity surfaces here as Mallory finds it.