Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSTG-NETWORK-1-4 Fix Network Security Testing on Android and iOS (by @NowSecure) #2042

Merged
merged 47 commits into from
Jul 12, 2022

Conversation

cpholguera
Copy link
Collaborator

  • Both Android and iOS cover now MSTG-NETWORK-1, MSTG-NETWORK-2, MSTG-NETWORK-3, MSTG-NETWORK-4
    • Some Tests were split to cover only one MASVS requirement.
    • NEW: MSTG-NETWORK-1 on both Android and iOS!
  • Fix Network Testing chapters structure and cohesion.
  • Fix all network cross-chapter references and corrected some content location.

grafik

Copy link
Collaborator

@TheDauntless TheDauntless left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many of them are simple accepts, a few of them are a bit more work :)

Document/0x04f-Testing-Network-Communication.md Outdated Show resolved Hide resolved
Document/0x04g-Testing-Cryptography.md Outdated Show resolved Hide resolved
Document/0x05c-Reverse-Engineering-and-Tampering.md Outdated Show resolved Hide resolved
Document/0x05g-Testing-Network-Communication.md Outdated Show resolved Hide resolved

When running on Android 7.0 (API level 24) or higher, apps targeting those API levels will use a default Network Security Configuration that doesn't trust any user supplied CAs, reducing the possibility of MITM attacks by luring users to install malicious CAs. However, this protection can be bypassed by using a custom Network Security Configuration with a custom trust anchor indicating that the app will trust user supplied CAs.

Use a decompiler (e.g. jadx or apktool) to confirm the target SDK version. After decoding the app you can look for the presence of `targetSDK` present in the file apktool.yml that was created in the output folder.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Use a decompiler (e.g. jadx or apktool) to confirm the target SDK version. After decoding the app you can look for the presence of `targetSDK` present in the file apktool.yml that was created in the output folder.
Use a decompiler (e.g. jadx or apktool) to confirm the target SDK version. After decoding the app you can look for the presence of `targetSDK` in the file apktool.yml that was created in the output folder.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apktool technically is a disassembler though, not a decompiler.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was one block I simply moved around I didn't see that so thanks for telling! We have to change it. I assume it just want to say: unpack and check that value in the android manifest.

This is one of many cases where having a "Techniques" chapter we can refer back to will come handy. This way we don't have to explain that you need to unzip the APK, decode the Android Manifest..but you can achieve the same by ...blah blah We'd simply have "Checking a value from the Android Manifest" including all alternatives. And here we'd just say: ["Check that the value minsdk is ... in the Android Manifest"](linktotechniques#checking-a-value...).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely agree! In general, there are multiple locations where a link would be better than saying the same thing over and over again (e.g. Burp / ZAP)

Document/0x06g-Testing-Network-Communication.md Outdated Show resolved Hide resolved
Document/0x06g-Testing-Network-Communication.md Outdated Show resolved Hide resolved
Document/0x06g-Testing-Network-Communication.md Outdated Show resolved Hide resolved
Document/0x06g-Testing-Network-Communication.md Outdated Show resolved Hide resolved
@TheDauntless
Copy link
Collaborator

I obviously meant to click 'Request changes' rather than 'Approve' :/

cpholguera and others added 20 commits January 26, 2022 23:42
Co-authored-by: Jeroen Beckers <info@dauntless.be>
Co-authored-by: Jeroen Beckers <info@dauntless.be>
Co-authored-by: Jeroen Beckers <info@dauntless.be>
Co-authored-by: Jeroen Beckers <info@dauntless.be>
Co-authored-by: Jeroen Beckers <info@dauntless.be>
Co-authored-by: Jeroen Beckers <info@dauntless.be>
Co-authored-by: Jeroen Beckers <info@dauntless.be>
Co-authored-by: Jeroen Beckers <info@dauntless.be>
Co-authored-by: Jeroen Beckers <info@dauntless.be>
Co-authored-by: Jeroen Beckers <info@dauntless.be>
Co-authored-by: Jeroen Beckers <info@dauntless.be>
Co-authored-by: Jeroen Beckers <info@dauntless.be>
Co-authored-by: Jeroen Beckers <info@dauntless.be>
Co-authored-by: Jeroen Beckers <info@dauntless.be>
Co-authored-by: Jeroen Beckers <info@dauntless.be>
…int Identify Verification; fix Certificate Pinning in the Network Security Configuration
@cpholguera cpholguera changed the title Fix Network Security Testing on Android and iOS Fix Network Security Testing on Android and iOS (by @NowSecure) May 7, 2022
@TheDauntless TheDauntless requested review from TheDauntless and removed request for TheDauntless June 28, 2022 08:02
Copy link
Collaborator

@TheDauntless TheDauntless left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😅


When running on Android 7.0 (API level 24) or higher, apps targeting those API levels will use a default Network Security Configuration that doesn't trust any user supplied CAs, reducing the possibility of MITM attacks by luring users to install malicious CAs. However, this protection can be bypassed by using a custom Network Security Configuration with a custom trust anchor indicating that the app will trust user supplied CAs.

Use a decompiler (e.g. jadx or apktool) to confirm the target SDK version. After decoding the app you can look for the presence of `targetSDK` present in the file apktool.yml that was created in the output folder.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely agree! In general, there are multiple locations where a link would be better than saying the same thing over and over again (e.g. Burp / ZAP)


For more information on this topic please consult the [blog post by NowSecure on ATS](https://www.nowsecure.com/blog/2017/08/31/security-analysts-guide-nsapptransportsecurity-nsallowsarbitraryloads-app-transport-security-ats-exceptions/ "A guide to ATS").
> **Apple Recommendation: Configure Exceptions Only When Needed; Prefer Server Fixes**: It’s always better to fix the server when faced with an ATS failure. Exceptions reduce the security of your app. Some also require justification when submitting an app to the App Store, as described in the next section.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woops! :D

Document/0x02b-MASVS-MSTG-Adoption.md Outdated Show resolved Hide resolved
Document/0x04f-Testing-Network-Communication.md Outdated Show resolved Hide resolved
Document/0x04f-Testing-Network-Communication.md Outdated Show resolved Hide resolved
Document/0x05g-Testing-Network-Communication.md Outdated Show resolved Hide resolved
Document/0x05g-Testing-Network-Communication.md Outdated Show resolved Hide resolved
Document/0x05g-Testing-Network-Communication.md Outdated Show resolved Hide resolved
Document/0x05g-Testing-Network-Communication.md Outdated Show resolved Hide resolved
Document/0x05g-Testing-Network-Communication.md Outdated Show resolved Hide resolved
Co-authored-by: Jeroen Beckers <info@dauntless.be>
cpholguera and others added 5 commits July 8, 2022 18:16
Co-authored-by: Jeroen Beckers <info@dauntless.be>
Co-authored-by: Jeroen Beckers <info@dauntless.be>
Co-authored-by: Jeroen Beckers <info@dauntless.be>
@cpholguera cpholguera merged commit 96b4dec into master Jul 12, 2022
@cpholguera cpholguera deleted the fix-network-refs branch July 12, 2022 14:27
@cpholguera cpholguera changed the title Fix Network Security Testing on Android and iOS (by @NowSecure) MSTG-NETWORK-1-4 Fix Network Security Testing on Android and iOS (by @NowSecure) Sep 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants