r/FlutterDev • • Nov 29 '22

Article How to Hack & Protect Flutter Apps — Simple and Actionable Guide (Pt. 1)

I am working on a short guide, "How to Hack & Protect Flutter Apps," aimed at junior and senior devs and reverse engineers who'd like to get acquainted with App protection for Flutter-based apps.
Part 1 (this article) ↓

  • Disassemble app.

  • Extract its secrets.

How to Hack & Protect Flutter Apps — Simple and Actionable Guide (Pt. 1/3)

The second and third guide will cover these areas. I may adjust them based on the feedback:

Part 2 (coming soon) ↓

  • Make a fake clone.

  • Check every transmitted JSON.

  • Inject code.

Part 3 (coming soon) ↓

  • Steal authentication tokens.

  • and attack the API.

108 Upvotes

19 comments sorted by

4

u/iamjulianacosta Nov 29 '22

Hi, great article!

I have a question though. If you are using a BaaS like firebase, do you need to have the same level of care as if you have your own API?

6

u/definitely_robots Nov 29 '22

You can make your app secure if you use firebase auth and have security rules that check the id of the user making the request. So before delivering any private data you should just ensure the user making the request is signed in and has permission to access it.

For something like an analytics service token, or a Google maps api key, there is not really a way around storing the secret on the client, those can generally be extracted, so you should be prepared to re-generate anything like that.

4

u/SirionRazzer Nov 30 '22

u/definitely_robots gave a great explanation. I will add there are various app and device integrity state control solutions that can mitigate many hacking attempts. However, they can only help you if your foundational security is done correctly.

1

u/iamjulianacosta Dec 19 '22

I will add there are various app and device integrity state control solutions

Do you have some examples?

2

u/davidb_ Nov 30 '22

A direct question that I think would make for a good follow up post - how would you go about securing an app’s notification messages? Meaning end to end encryption (not readable by google FCM, other notification services, or anyone but the intended recipient).

Asked another way - how would you hack an app that claims encrypted notifications?

PSK seems a reasonable approach to answer my first question, but your first article here would expose the PSK. Per-user PSK obtained via an authenticated API would be the next approach (ie: oauth token authd api)

Is that the best we could do? Or, is there a more secure alternative solution?

3

u/SirionRazzer Nov 30 '22

You are right about the PSK approach. You may also be interested in Capillary: https://github.com/google/capillary (not available for Flutter).
If you additionally need to guarantee the protection for individual PSK keys, you can use the mobile app and device integrity state control .

I don't have much experience with FCM, I will look into it.

1

u/davidb_ Nov 30 '22

Capillary looks very interesting, thanks for sharing!

2

u/davidb_ Nov 30 '22

A final comment - great approach, the article is very engaging. Can you do more to cite sources in future posts? I think your links and explanations are great, but I feel I read an article about flutter/dart aot that covered some of this material using the same tools. If that or additional sources were used, please do cite them - takes nothing away from what you’ve added and provides additional reading.

3

u/SirionRazzer Nov 30 '22

I remember reading that flutter/dart article. Unfortunately, I didn't save it. Speaking of resources, I plan to compile recent articles and other security resources relevant to Flutter security. It should be aligned with OWASP MAS or as a contribution to https://github.com/vaib25vicky/awesome-mobile-security . I aim to popularize security knowledge amongst the Flutter community because it is way behind other platforms. Thank you for your feedback!

1

u/davidb_ Nov 30 '22

Excellent - thanks for the work and keep it up!

4

u/krayony Nov 29 '22

Amazing article. Thank you for this.

4

u/bizz84 Nov 29 '22

Great article! Thank you for sharing!

2

u/daH00L Nov 29 '22

This is great.

2

u/Z000000M Nov 29 '22

Very good stuff

-2

u/Spiritual_Abalone322 Nov 29 '22

Interesting. Do Flutter appa get hacked?

1

u/SirionRazzer Nov 30 '22

So I heard.

5

u/MrRandomBruh Nov 29 '22

There's no safe system which has zero vulnerabilities, it's all about making the system hard to get it hacked.

4

u/[deleted] Nov 30 '22

[removed] — view removed comment

6

u/SirionRazzer Nov 30 '22

I have already made a seminar/webinar project for the Flutter conference. It's not publicized since I like to lecture it personally. If there are enough people interested, I will be happy to organize a group lesson in the future.