Bypass SSL Pinning For Flutter. What Is Flutter - by PRASAD - Medium
Bypass SSL Pinning For Flutter. What Is Flutter - by PRASAD - Medium
138 2
What is Flutter?
Flutter is an open source framework by Google for building beautiful,
natively compiled, multi-platform applications from a single codebase.
2. Upload the APK File: Upload the APK file on a website like
javadecompilers.com. If you find a folder named flutter in sources,
then the app is a Flutter app
4. API level 31
2. Install app in AVD (adb install <file name> or simply drag N drop)and set
proxy in emulator and test if your burp suite intercept traffic. (If you not
have idea how to set up burp for intercept traffic kindly check URL)
3. Set Proxy in AVD like below IP =192.168.1.2 i.e. your base machine address
(get base address via terminal cmd will be ipconfig) and set any 4 digit
number as a port no.
Proxy Setup
3. Now we will check the traffic intercept for HTTP. we successfully get the
request and response.
4. Now we will do same thing for HTTPS. We’ve come across an HTTPS error
due to a failed SSL handshake. You can view the details of this issue in the
Event log, as shown in the screenshot.
reFlutter framework
6. Now we will get release.RE.apk but this apk is not sign yet. We have to sign
manually and we can used any tool like uber-apk-signer in here.
This Java JAR run command assumes the JAR is located in the current folder.
If the JAR file to run is located in a different folder, you’ll need to provide a
full path to the file.
Signed APK
9. Lets configure the burp Suite (open Burp suite > proxy > proxy setting >
add > binding > enter port no > select base machine IP address from list.
proxy add
10. Now configure request handling (open Burp suite > proxy > proxy setting
> add > request handling > click on support invisible proxying.
Invisible Traffic
11. Remember we need to turn off all the proxies (that we setup in point no
3)because reflutter is already modified and set the proxy settings in the
patched app.
No proxy
12. Now we can success fully bypass the SSL Pinning in app.
SSL bypass
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
child: Column(children: <Widget>[
Container(
padding: EdgeInsets.all(20.0),
child: Text(
"URL: $url",
style: TextStyle(fontWeight: FontWeight.bold),
),
),
(progress != 1.0)
? LinearProgressIndicator(value: progress)
: Container(),
Expanded(
child: InAppWebView(
initialUrl: "https://www.example.com",
initialHeaders: {},
initialOptions: InAppWebViewGroupOptions(
crossPlatform: InAppWebViewOptions(
debuggingEnabled: true,
useShouldInterceptRequest: true),
),
onWebViewCreated: (InAppWebViewController controller) {
webView = controller;
},
onLoadStart: (InAppWebViewController controller, String url) {
print("started $url");
setState(() {
this.url = url;
});
},
onLoadStop: (InAppWebViewController controller, String url) async {
print("stopped $url");
setState(() {
this.url = url;
});
},
onProgressChanged: (InAppWebViewController controller, int progress) {
setState(() {
this.progress = progress / 100;
});
},
shouldInterceptRequest: (controller, request) async {
if (request.url.toString().contains("example.com")) {
return InterceptionResponse(
action: InterceptionAction.CONTINUE, data: null);
}
var modifiedHeaders = request.headers;
modifiedHeaders['header_key'] = 'header_value';
return InterceptionResponse(
action: InterceptionAction.USE_NEW_REQUEST,
data: new WebResourceRequest(
url: request.url, method: 'POST', headers: modifiedHeaders),
isDownload: false,
isForMainFrame: true);
},
),
)
])));
}
}
How to implement SLL Pining there is good resource , you can use
ssl_pinning_plugin: ^2.0.0
References: https://securitycafe.ro/2022/02/01/root-detection-and-ssl-
pinning-bypass/
138 2
73 Followers
PRASAD PRASAD
53 1 2
PRASAD PRASAD
13 min read · Jan 10, 2024 17 min read · Oct 18, 2023
512 8 263 2
Lists
Staff Picks
614 stories · 883 saves
Career Technology Cyber Security India Pvt. Ltd. Frank Lee in Level Up Coding
SSL pinning bypass for Android Why Can I Only Reset the Password
applications When I Forget It, Instead of Being…
What is Frida and SSL pinning? One day, Joe found a forum in his bookmarks
that he used to visit frequently but hadn’t…
215 191 2
190 1 8
Help Status About Careers Blog Privacy Terms Text to speech Teams