Frida Tutorial
Frida Tutorial
Bug-Bounty-Tipp: Registrieren Sie sich bei Intigriti, einer Premium-Bug-Bounty-Plattform, die von Hackern für Hacker entwickelt wurde! Treten Sie uns noch heute unter https://go.intigriti.com/hacktricks bei und verdienen Sie Prämien von bis zu 100.000 $!
Installation
Installieren Sie die Frida-Tools:
Herunterladen und installieren Sie den Frida-Server auf dem Android-Gerät (Laden Sie die neueste Version herunter). Einzeiler zum Neustarten von adb im Root-Modus, Verbindung herstellen, frida-server hochladen, Ausführungsberechtigungen erteilen und im Hintergrund ausführen:
Überprüfen, ob es funktioniert:
Tutorials
Von: https://medium.com/infosec-adventures/introduction-to-frida-5a3f51595ca1 APK: https://github.com/t0thkr1s/frida-demo/releases Quellcode: https://github.com/t0thkr1s/frida-demo
Folgen Sie dem Link, um es zu lesen.
Von: https://11x256.github.io/Frida-hooking-android-part-2/ (Teile 2, 3 & 4) APKs und Quellcode: https://github.com/11x256/frida-android-examples
Folgen Sie dem Link, um es zu lesen.
Von: https://joshspicer.com/android-frida-1 APK: https://github.com/OWASP/owasp-mstg/blob/master/Crackmes/Android/Level_01/UnCrackable-Level1.apk
Folgen Sie dem Link, um es zu lesen.
Weitere großartige Frida-Skripte finden Sie hier: https://codeshare.frida.re/
Schnellbeispiele
Frida von der Befehlszeile aufrufen
Grundlegendes Python-Skript
Dieses Python-Skript stellt eine grundlegende Vorlage dar.
Hooking von Funktionen ohne Parameter
Hooken Sie die Funktion a()
der Klasse sg.vantagepoint.a.c
Frida Tutorial: Hooking exit()
in Java
exit()
in JavaIn this tutorial, we will learn how to hook the exit()
function in Java using Frida. By hooking this function, we can intercept and modify the behavior of the application when it tries to exit.
Prerequisites
Before we begin, make sure you have the following:
A rooted Android device or an emulator
Frida installed on your machine
Basic knowledge of JavaScript and Java
Steps
Start by creating a new JavaScript file, for example
hook_exit.js
, and open it in a text editor.Import the necessary Frida modules:
Attach to the target process:
Find the class and method that contains the
exit()
function. You can use theJava.use()
function to get a reference to the class:
Hook the
exit()
method and modify its behavior:
Save the JavaScript file.
Launch the target application on your Android device or emulator.
Open a terminal and navigate to the directory where the JavaScript file is located.
Use the following command to start the Frida server:
Use the following command to attach Frida to the target process:
Replace <package_name>
with the package name of the target application.
You should see the output from the
console.log()
statement when theexit()
function is called.Modify the behavior of the
exit()
function as desired.Test the modified behavior by triggering the application to exit.
Conclusion
By hooking the exit()
function in Java using Frida, we can intercept and modify the behavior of the application when it tries to exit. This technique can be useful for various purposes, such as bypassing certain checks or adding additional functionality to the application.
Frida Tutorial: Hook MainActivity .onStart()
& .onCreate()
.onStart()
& .onCreate()
In this tutorial, we will learn how to hook the .onStart()
and .onCreate()
methods of the MainActivity class in an Android app using Frida.
Prerequisites
Before we begin, make sure you have the following:
A rooted Android device or an emulator
Frida installed on your machine
Basic knowledge of JavaScript and Android app development
Step 1: Set Up the Environment
First, we need to set up our environment. Follow these steps:
Connect your Android device to your machine or start the emulator.
Install the target app on your device or emulator.
Step 2: Write the Frida Script
Next, we will write the Frida script to hook the .onStart()
and .onCreate()
methods. Open your favorite text editor and create a new file called hook.js
. Copy and paste the following code into the file:
Step 3: Run the Frida Script
Now, we will run the Frida script to hook the methods. Follow these steps:
Open a terminal and navigate to the directory where the
hook.js
file is located.Run the following command to start the Frida server:
In another terminal, run the following command to attach Frida to the target app:
Replace
com.example.app
with the package name of the target app.
Step 4: Test the Hook
Finally, we will test the hook by launching the target app. Follow these steps:
Launch the target app on your device or emulator.
Check the logs in the terminal where you ran the Frida script. You should see the messages
MainActivity.onStart() hooked
andMainActivity.onCreate() hooked
.
Congratulations! You have successfully hooked the .onStart()
and .onCreate()
methods of the MainActivity class using Frida. You can now modify the behavior of these methods or perform any other actions you desire. Happy hacking!
Frida Tutorial: Hook android .onCreate()
.onCreate()
In diesem Tutorial lernen Sie, wie Sie die .onCreate()
-Methode in einer Android-App mit Frida abfangen können. Die .onCreate()
-Methode wird normalerweise verwendet, um eine Aktivität zu initialisieren, wenn sie erstellt wird.
Voraussetzungen
Um dieses Tutorial durchzuführen, benötigen Sie Folgendes:
Ein Android-Gerät oder einen Emulator
Frida-Server auf dem Gerät oder Emulator installiert
Frida-Client auf Ihrem Computer installiert
Schritt 1: Frida-Server starten
Starten Sie den Frida-Server auf Ihrem Android-Gerät oder Emulator. Stellen Sie sicher, dass der Server erfolgreich gestartet wurde, bevor Sie mit dem nächsten Schritt fortfahren.
Schritt 2: Frida-Skript erstellen
Erstellen Sie ein Frida-Skript mit dem Namen hook_oncreate.js
und fügen Sie den folgenden Code ein:
Dieses Skript verwendet die Frida-API, um die .onCreate()
-Methode der Activity
-Klasse abzufangen. Wenn die Methode aufgerufen wird, wird eine Meldung in der Konsole ausgegeben und die ursprüngliche Methode wird weiterhin aufgerufen.
Schritt 3: Frida-Skript ausführen
Führen Sie das Frida-Skript mit dem folgenden Befehl aus:
Ersetzen Sie <package_name>
durch den Paketnamen der App, in der Sie die .onCreate()
-Methode abfangen möchten.
Schritt 4: Ergebnisse überprüfen
Öffnen Sie die App auf Ihrem Android-Gerät oder Emulator. Wenn die .onCreate()
-Methode aufgerufen wird, sehen Sie die Meldung "onCreate() wurde abgefangen" in der Konsole.
Herzlichen Glückwunsch! Sie haben erfolgreich die .onCreate()
-Methode in einer Android-App mit Frida abgefangen. Sie können diese Technik verwenden, um den App-Initialisierungsprozess zu überwachen und möglicherweise Angriffspunkte zu identifizieren.
Hooking von Funktionen mit Parametern und Abrufen des Werts
Hooking einer Entschlüsselungsfunktion. Drucken Sie die Eingabe, rufen Sie die ursprüngliche Funktion auf, entschlüsseln Sie die Eingabe und drucken Sie schließlich die Klardaten:
Hooking Funktionen und Aufrufen mit unserer Eingabe
Haken Sie eine Funktion, die einen String empfängt, und rufen Sie sie mit einem anderen String auf (von hier).
Abrufen eines bereits erstellten Objekts einer Klasse
Wenn Sie ein Attribut eines erstellten Objekts extrahieren möchten, können Sie dies verwenden.
In diesem Beispiel sehen Sie, wie Sie das Objekt der Klasse my_activity abrufen und die Funktion .secret() aufrufen, die ein privates Attribut des Objekts ausgibt:
Weitere Frida-Tutorials
Bug-Bounty-Tipp: Registriere dich bei Intigriti, einer erstklassigen Bug-Bounty-Plattform, die von Hackern für Hacker entwickelt wurde! Werde noch heute Mitglied unter https://go.intigriti.com/hacktricks und verdiene Prämien von bis zu $100.000!
Last updated