mirror of
https://github.com/carlospolop/hacktricks
synced 2024-12-19 09:34:03 +00:00
150 lines
6.4 KiB
Markdown
150 lines
6.4 KiB
Markdown
|
# Frida Tutorial 3
|
||
|
|
||
|
{% hint style="success" %}
|
||
|
Aprenda e pratique Hacking AWS:<img src="/.gitbook/assets/arte.png" alt="" data-size="line">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<img src="/.gitbook/assets/arte.png" alt="" data-size="line">\
|
||
|
Aprenda e pratique Hacking GCP: <img src="/.gitbook/assets/grte.png" alt="" data-size="line">[**HackTricks Training GCP Red Team Expert (GRTE)**<img src="/.gitbook/assets/grte.png" alt="" data-size="line">](https://training.hacktricks.xyz/courses/grte)
|
||
|
|
||
|
<details>
|
||
|
|
||
|
<summary>Support HackTricks</summary>
|
||
|
|
||
|
* Confira os [**planos de assinatura**](https://github.com/sponsors/carlospolop)!
|
||
|
* **Junte-se ao** 💬 [**grupo do Discord**](https://discord.gg/hRep4RUj7f) ou ao [**grupo do telegram**](https://t.me/peass) ou **siga**-nos no **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.**
|
||
|
* **Compartilhe truques de hacking enviando PRs para o** [**HackTricks**](https://github.com/carlospolop/hacktricks) e [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) repositórios do github.
|
||
|
|
||
|
</details>
|
||
|
{% endhint %}
|
||
|
|
||
|
<figure><img src="../../../.gitbook/assets/i3.png" alt=""><figcaption></figcaption></figure>
|
||
|
|
||
|
**Dica de bug bounty**: **inscreva-se** no **Intigriti**, uma plataforma de **bug bounty premium criada por hackers, para hackers**! Junte-se a nós em [**https://go.intigriti.com/hacktricks**](https://go.intigriti.com/hacktricks) hoje e comece a ganhar recompensas de até **$100,000**!
|
||
|
|
||
|
{% embed url="https://go.intigriti.com/hacktricks" %}
|
||
|
|
||
|
***
|
||
|
|
||
|
**Este é um resumo do post**: [https://joshspicer.com/android-frida-1](https://joshspicer.com/android-frida-1)\
|
||
|
**APK**: [https://github.com/OWASP/owasp-mstg/blob/master/Crackmes/Android/Level\_01/UnCrackable-Level1.apk](https://github.com/OWASP/owasp-mstg/blob/master/Crackmes/Android/Level\_01/UnCrackable-Level1.apk)
|
||
|
|
||
|
## Solução 1
|
||
|
|
||
|
Baseado em [https://joshspicer.com/android-frida-1](https://joshspicer.com/android-frida-1)
|
||
|
|
||
|
**Hook a função \_exit()**\_ e **função de descriptografia** para que imprima a flag no console do frida quando você pressionar verificar:
|
||
|
```javascript
|
||
|
Java.perform(function () {
|
||
|
send("Starting hooks OWASP uncrackable1...");
|
||
|
|
||
|
function getString(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 : " + getString(ret));
|
||
|
|
||
|
var flag = "";
|
||
|
for (var i=0; i < ret.length; i++){
|
||
|
flag += String.fromCharCode(ret[i]);
|
||
|
}
|
||
|
send("Decrypted flag: " + flag);
|
||
|
return ret; //[B
|
||
|
};
|
||
|
|
||
|
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 :)");
|
||
|
};
|
||
|
|
||
|
send("Hooks installed.");
|
||
|
});
|
||
|
```
|
||
|
## Solução 2
|
||
|
|
||
|
Baseado em [https://joshspicer.com/android-frida-1](https://joshspicer.com/android-frida-1)
|
||
|
|
||
|
**Hook rootchecks** e função de descriptografia para que imprima a flag no console do frida quando você pressionar verificar:
|
||
|
```javascript
|
||
|
Java.perform(function () {
|
||
|
send("Starting hooks OWASP uncrackable1...");
|
||
|
|
||
|
function getString(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 : " + getString(ret));
|
||
|
|
||
|
var flag = "";
|
||
|
for (var i=0; i < ret.length; i++){
|
||
|
flag += String.fromCharCode(ret[i]);
|
||
|
}
|
||
|
send("Decrypted flag: " + flag);
|
||
|
return ret; //[B
|
||
|
};
|
||
|
|
||
|
var rootcheck1 = Java.use("sg.vantagepoint.a.c");
|
||
|
rootcheck1.a.overload().implementation = function() {
|
||
|
send("sg.vantagepoint.a.c.a()Z Root check 1 HIT! su.exists()");
|
||
|
return false;
|
||
|
};
|
||
|
|
||
|
var rootcheck2 = Java.use("sg.vantagepoint.a.c");
|
||
|
rootcheck2.b.overload().implementation = function() {
|
||
|
send("sg.vantagepoint.a.c.b()Z Root check 2 HIT! test-keys");
|
||
|
return false;
|
||
|
};
|
||
|
|
||
|
var rootcheck3 = Java.use("sg.vantagepoint.a.c");
|
||
|
rootcheck3.c.overload().implementation = function() {
|
||
|
send("sg.vantagepoint.a.c.c()Z Root check 3 HIT! Root packages");
|
||
|
return false;
|
||
|
};
|
||
|
|
||
|
var debugcheck = Java.use("sg.vantagepoint.a.b");
|
||
|
debugcheck.a.overload("android.content.Context").implementation = function(var_0) {
|
||
|
send("sg.vantagepoint.a.b.a(Landroid/content/Context;)Z Debug check HIT! ");
|
||
|
return false;
|
||
|
};
|
||
|
|
||
|
send("Hooks installed.");
|
||
|
});
|
||
|
```
|
||
|
<figure><img src="../../../.gitbook/assets/i3.png" alt=""><figcaption></figcaption></figure>
|
||
|
|
||
|
**Dica de bug bounty**: **inscreva-se** na **Intigriti**, uma plataforma premium de **bug bounty criada por hackers, para hackers**! Junte-se a nós em [**https://go.intigriti.com/hacktricks**](https://go.intigriti.com/hacktricks) hoje e comece a ganhar recompensas de até **$100,000**!
|
||
|
|
||
|
{% embed url="https://go.intigriti.com/hacktricks" %}
|
||
|
|
||
|
{% hint style="success" %}
|
||
|
Aprenda e pratique Hacking AWS:<img src="/.gitbook/assets/arte.png" alt="" data-size="line">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<img src="/.gitbook/assets/arte.png" alt="" data-size="line">\
|
||
|
Aprenda e pratique Hacking GCP: <img src="/.gitbook/assets/grte.png" alt="" data-size="line">[**HackTricks Training GCP Red Team Expert (GRTE)**<img src="/.gitbook/assets/grte.png" alt="" data-size="line">](https://training.hacktricks.xyz/courses/grte)
|
||
|
|
||
|
<details>
|
||
|
|
||
|
<summary>Support HackTricks</summary>
|
||
|
|
||
|
* Confira os [**planos de assinatura**](https://github.com/sponsors/carlospolop)!
|
||
|
* **Junte-se ao** 💬 [**grupo do Discord**](https://discord.gg/hRep4RUj7f) ou ao [**grupo do telegram**](https://t.me/peass) ou **siga**-nos no **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.**
|
||
|
* **Compartilhe truques de hacking enviando PRs para os repositórios do** [**HackTricks**](https://github.com/carlospolop/hacktricks) e [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud).
|
||
|
|
||
|
</details>
|
||
|
{% endhint %}
|