I read an article about reverse engineering, there is a way to reverse engineer through a proxy, how can my app not use any proxies?
I read an article about reverse engineering, there is a way to reverse engineer through a proxy, how can my app not use any proxies?
2
Answers
You should know about Flutter’s/Dart code obfuscation, which makes the code very very hard to understand by humans, so it’s very very hard to reverse engineer it, A from the official Flutter website:
Code obfuscation is supported only for Android/IOS, and not supported for Windows, Linux, and the web.
when building a release of your app, you can pass the
--obfuscate
flag to activate it:Read More From this:
Obfuscating your app
Your Problem
What you can reverse engineer through a "proxy" it’s how the App is communicating with the API’s it uses, and the correct definition for this is a Manipulator in the Middle (MitM) attack:
Reverse engineering can be done statically or at runtime, and a lot of open source tools exist to make it easy. No matter how well protected its your mobile app binary against static reverse engineering it will be possible to perform dynamic reverse engineering while the app it’s running, even when the app uses Runtime Application Self Protection (RASP):
A lot of open source tools exist to defeat RASP, being the most notorious one Frida:
Statically Reverse Engineering
Some open source tools exist to make this task very simple, being my favourite the MobSF, and in order for you to understand how reverse engineering is easy with this tool I invite you to read the article How to Extract an API key from a Mobile App with Static Binary Analysis:
How to MitM attack an API
In a series of articles about Mobile API Security I wrote an article that illustrates how you can do one – How to MitM Attack the API of an Android App:
Implementing Certificate Pinning
I believe that you are asking here is how can I prevent MitM attack on my app, and that can be achieved with the use of certificate pinning, that basically pins your app to certificates used by the API’s that talks with. In other words your app will only talk with an API if it presents the correct certificate during the TLS handshake.
I wrote an article on how you can implement certificate pinning on your app, that uses certificate pinning via the Android network security config file. Learn how to implement it on this step by step tutorial for Android – Securing HTTPS with Certificate Pinning:
If you are on iOS you are also covered, you just need to use the same Mobile Certificate Pinning Generator tool used on the article, which requires us to fill a form with the domains we want to pin and then copy the generated configuration to your iOS app.
But be aware that certificate pinning can be bypassed.
Bypassing Certificate Pinning
Certificate pinning can be bypassed by decompiling the app and resigning it without the pinning implementation or by simply hook an instrumentation framework (Frida or others) at runtime to bypass the pining check, that you can see being done in the article How to Bypass Certificate Pinning with Frida on an Android App:
Possible Solutions
Giving the context of my answer against all the possible attacks on your mobile app, that by the way isn’t an exhaustive list, what you may be looking for it’s what can you do to defend against them all.
Remember that security is about of adding as many layers as possible and as you can afford, and this isn’t exclusive to software development, it’s being used for centuries in medieval castles and prisons. The goal its to make it as time consuming as possible to defeat and to require an increased level of resources and skills set as the attacker progresses to the next layer of defence.
I recommend you to read this answer I gave to the question How to secure an API REST for mobile app?, especially the sections Hardening and Shielding the Mobile App, Securing the API Server and A Possible Better Solution.
From all the recommendations suggested the most effective one will be the implementation of a Mobile App Attestation solution, that will allow the API server to have a very high degree of confidence that the request is indeed from what it expects, an unmodified version of the mobile app that isn’t under attack.
Do You Want To Go The Extra Mile?
In any response to a security question I always like to reference the excellent work from the OWASP foundation.
For APIS
OWASP API Security Top 10
For Mobile Apps
OWASP Mobile Security Project – Top 10 risks
OWASP – Mobile Security Testing Guide: