Nasaha ya bug bounty: jiandikishe kwa Intigriti, jukwaa la bug bounty la premium lililotengenezwa na hackers, kwa hackers! Jiunge nasi kwenye https://go.intigriti.com/hacktricks leo, na uanze kupata zawadi hadi $100,000!
Installation
Sakinisha frida tools:
pipinstallfrida-toolspipinstallfrida
Pakua na sakinisha katika android frida server (Pakua toleo jipya zaidi).
Mstari mmoja wa kuanzisha adb tena katika hali ya mizizi, kuungana nayo, kupakia frida-server, kutoa ruhusa za kutekeleza na kuikimbia katika hali ya nyuma:
frida-ps-U#Basic frida hookingfrida-ldisableRoot.js-fowasp.mstg.uncrackable1#Hooking before starting the appfrida-U--no-pause-ldisableRoot.js-fowasp.mstg.uncrackable1#The --no-pause and -f options allow the app to be spawned automatically,#frozen so that the instrumentation can occur, and the automatically#continue execution with our modified code.
var sysexit =Java.use("java.lang.System");sysexit.exit.overload("int").implementation=function(var_0) {send("java.lang.System.exit(I)V // We avoid exiting the application :)");};
Hook MainActivity .onStart() & .onCreate()
var mainactivity =Java.use("sg.vantagepoint.uncrackable1.MainActivity");mainactivity.onStart.overload().implementation=function() {send("MainActivity.onStart() HIT!!!");var ret =this.onStart.overload().call(this);};mainactivity.onCreate.overload("android.os.Bundle").implementation=function(var_0) {send("MainActivity.onCreate() HIT!!!");var ret =this.onCreate.overload("android.os.Bundle").call(this,var_0);};
Hook android .onCreate()
var activity =Java.use("android.app.Activity");activity.onCreate.overload("android.os.Bundle").implementation=function(var_0) {send("Activity HIT!!!");var ret =this.onCreate.overload("android.os.Bundle").call(this,var_0);};
Hooking functions with parameters and retrieving the value
Kuhooki kazi ya ufichuzi. Chapisha ingizo, itisha kazi ya asili kufichua ingizo na hatimaye, chapisha data safi:
functiongetString(data){var ret ="";for (var i=0; i <data.length; i++){ret += data[i].toString();}return ret}var aes_decrypt =Java.use("sg.vantagepoint.a.a");aes_decrypt.a.overload("[B","[B").implementation=function(var_0,var_1) {send("sg.vantagepoint.a.a.a([B[B)[B doFinal(enc) // AES/ECB/PKCS7Padding");send("Key : "+getString(var_0));send("Encrypted : "+getString(var_1));var ret =this.a.overload("[B","[B").call(this,var_0,var_1);send("Decrypted : "+ ret);var flag ="";for (var i=0; i <ret.length; i++){flag +=String.fromCharCode(ret[i]);}send("Decrypted flag: "+ flag);return ret; //[B};
Hooking functions and calling them with our input
Hooka kazi inayopokea mfuatano wa herufi na uitumie na mfuatano mwingine wa herufi (kutoka hapa)
var string_class =Java.use("java.lang.String"); // get a JS wrapper for java's String classmy_class.fun.overload("java.lang.String").implementation=function(x){ //hooking the new functionvar my_string =string_class.$new("My TeSt String#####"); //creating a new String by using `new` operatorconsole.log("Original arg: "+x );var ret = this.fun(my_string); // calling the original function with the new String, and putting its return value in ret variable
console.log("Return value: "+ret);return ret;};
Kupata kitu kilichoundwa tayari cha darasa
Ikiwa unataka kutoa sifa fulani ya kitu kilichoundwa unaweza kutumia hii.
Katika mfano huu utaona jinsi ya kupata kitu cha darasa my_activity na jinsi ya kuita kazi .secret() ambayo itachapisha sifa ya faragha ya kitu:
Java.choose("com.example.a11x256.frida_test.my_activity", {onMatch:function(instance){ //This function will be called for every instance found by fridaconsole.log("Found instance: "+instance);console.log("Result of secret func: "+instance.secret());},onComplete:function(){}});
Bug bounty tip: jiandikishe kwa Intigriti, jukwaa la bug bounty la kiwango cha juu lililotengenezwa na hackers, kwa hackers! Jiunge nasi kwenye https://go.intigriti.com/hacktricks leo, na anza kupata zawadi hadi $100,000!