Skip to content

Commit cafcb25

Browse files
author
HackTricks News Bot
committed
Add content from: Flutter SSL Bypass: How to Intercept HTTPS Traffic When all ...
1 parent 5f8fd5a commit cafcb25

File tree

2 files changed

+43
-4
lines changed

2 files changed

+43
-4
lines changed

src/mobile-pentesting/android-app-pentesting/flutter.md

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
{{#include ../../banners/hacktricks-training.md}}
44

5-
# Flutter
65
Flutter is **Google’s cross-platform UI toolkit** that lets developers write a single Dart code-base which the **Engine** (native C/C++) turns into platform-specific machine code for Android & iOS.
76
The Engine bundles a **Dart VM**, **BoringSSL**, Skia, etc., and ships as the shared library **libflutter.so** (Android) or **Flutter.framework** (iOS). All actual networking (DNS, sockets, TLS) happens **inside this library**, *not* in the usual Java/Kotlin Swift/Obj-C layers. That siloed design is why the usual Java-level Frida hooks fail on Flutter apps.
87

@@ -20,7 +19,7 @@ Knowing the version lets you re-build or pattern-match the right binaries.
2019

2120
Step | Command / File | Outcome
2221
----|----|----
23-
Get snapshot hash | ```bash\npython3 get_snapshot_hash.py libapp.so\n``` | `adb4292f3ec25…`
22+
Get snapshot hash | `python3 get_snapshot_hash.py libapp.so` | `adb4292f3ec25…`
2423
Map hash → Engine | **enginehash** list in reFlutter | Flutter 3 · 7 · 12 + engine commit `1a65d409…`
2524
Pull dependent commits | DEPS file in that engine commit | • `dart_revision` → Dart v2 · 19 · 6<br>• `dart_boringssl_rev` → BoringSSL `87f316d7…`
2625

@@ -75,9 +74,46 @@ Flutter itself **ignores device proxy settings**. Easiest options:
7574
* **Android Studio emulator:** Settings ▶ Proxy → manual.
7675
* **Physical device:** evil Wi-Fi AP + DNS spoofing, or Magisk module editing `/etc/hosts`.
7776

77+
### Offset-based hook of BoringSSL verification (no signature scan)
78+
When pattern-based scripts fail across architectures (e.g., x86_64 vs ARM), directly hook the BoringSSL chain verifier by absolute address within libflutter.so. Workflow:
79+
80+
- Extract the right-ABI library from the APK: `unzip -j app.apk "lib/*/libflutter.so" -d libs/` and pick the one matching the device (e.g., `lib/x86_64/libflutter.so`).
81+
- Analyze in Ghidra/IDA and locate the verifier:
82+
- Source: BoringSSL ssl_x509.cc function `ssl_crypto_x509_session_verify_cert_chain` (3 args, returns bool).
83+
- In stripped builds, search for the string `"ssl_client"` and inspect XREFs; identify the function taking three pointer-like args and returning a boolean.
84+
- Compute the runtime offset: take the function address shown by Ghidra and subtract the image base used during analysis to get the relative offset (RVA). Example: `0x02184644 - 0x00100000 = 0x02084644`.
85+
- Hook at runtime by base + offset and force success:
86+
87+
```javascript
88+
// frida -U -f com.target.app -l bypass.js --no-pause
89+
const base = Module.findBaseAddress('libflutter.so');
90+
// Example offset from analysis. Recompute per build/arch.
91+
const off = ptr('0x02084644');
92+
const addr = base.add(off);
93+
94+
// ssl_crypto_x509_session_verify_cert_chain: 3 args, bool return
95+
Interceptor.replace(addr, new NativeCallback(function (a, b, c) {
96+
return 1; // true
97+
}, 'int', ['pointer', 'pointer', 'pointer']));
98+
99+
console.log('[+] Hooked BoringSSL verify_cert_chain at', addr);
100+
```
101+
102+
Notes
103+
- Recompute the offset for every target build and CPU architecture; compiler/codegen differences break hardcoded signatures.
104+
- This bypass causes BoringSSL to accept any chain, enabling HTTPS MITM regardless of pins/CA trust inside Flutter.
105+
- If you force-route traffic during debugging to confirm TLS blocking, e.g.:
106+
107+
```bash
108+
iptables -t nat -A OUTPUT -p tcp -j DNAT --to-destination <Burp_IP>:<Burp_Port>
109+
```
110+
111+
…you will still need the hook above, since verification happens inside libflutter.so, not Android’s system trust store.
78112

79113
## References
80114
- [https://sensepost.com/blog/2025/intercepting-https-communication-in-flutter-going-full-hardcore-mode-with-frida/](https://sensepost.com/blog/2025/intercepting-https-communication-in-flutter-going-full-hardcore-mode-with-frida/)
115+
- [Flutter SSL Bypass: How to Intercept HTTPS Traffic When all other Frida Scripts Fail](https://m4kr0x.medium.com/flutter-tls-bypass-how-to-intercept-https-traffic-when-all-other-frida-scripts-fail-bd3d04489088)
116+
- [BoringSSL ssl_x509.cc (ssl_crypto_x509_session_verify_cert_chain)](https://github.com/google/boringssl/blob/main/ssl/ssl_x509.cc#L238)
81117

82118

83119
{{#include ../../banners/hacktricks-training.md}}

src/pentesting-web/xs-search/css-injection/less-code-injection.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
## LESS Code Injection leading to SSRF & Local File Read
1+
# LESS Code Injection leading to SSRF & Local File Read
2+
3+
{{#include ../../../banners/hacktricks-training.md}}
24

35
LESS is a popular CSS pre-processor that adds variables, mixins, functions and the powerful `@import` directive. During compilation the LESS engine will **fetch the resources referenced in `@import`** statements and embed ("inline") their contents into the resulting CSS when the `(inline)` option is used.
46

@@ -59,4 +61,5 @@ curl -sk "${TARGET}rest/v10/css/preview?baseUrl=1&lm=${INJ}" | \
5961

6062
* [SugarCRM ≤ 14.0.0 (css/preview) LESS Code Injection Vulnerability](https://karmainsecurity.com/KIS-2025-04)
6163
* [SugarCRM Security Advisory SA-2024-059](https://support.sugarcrm.com/resources/security/sugarcrm-sa-2024-059/)
62-
* [CVE-2024-58258](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-58258)
64+
* [CVE-2024-58258](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-58258)
65+
{{#include ../../../banners/hacktricks-training.md}}

0 commit comments

Comments
 (0)