OWASP / owasp-mastg

The Mobile Application Security Testing Guide (MASTG) is a comprehensive manual for mobile app security testing and reverse engineering. It describes the technical processes for verifying the controls listed in the OWASP Mobile Application Security Verification Standard (MASVS).
https://mas.owasp.org/
Creative Commons Attribution Share Alike 4.0 International
11.77k stars 2.33k forks source link

Add a test case to check for sensitive information hardcoded #1752

Open crazykid95 opened 4 years ago

crazykid95 commented 4 years ago

Platform: Android, iOS Description: This test case includes detecting the following issues from the source code of the app:

sushi2k commented 4 years ago

Hi @crazykid95. Thanks for raising the issue! You are right there is way more than keys and some of the items you mentioned are covered in the static analysis part of iOS https://github.com/OWASP/owasp-mstg/blob/master/Document/0x06d-Testing-Data-Storage.md#static-analysis and Android https://github.com/OWASP/owasp-mstg/blob/master/Document/0x05d-Testing-Data-Storage.md#static-analysis. The static analysis part of these sections could use some more (regex) patterns and tools to detect such information. If you have any ideas on how to detect such sensitive information please share here, then we can discuss and you could add a PR :-) For example MobSF is already getting URLs out of the APK and IPAs, maybe that's a way to start. Or also TruffleHog (if source code is provided).

crazykid95 commented 4 years ago

Hi @crazykid95. Thanks for raising the issue! You are right there is way more than keys and some of the items you mentioned are covered in the static analysis part of iOS https://github.com/OWASP/owasp-mstg/blob/master/Document/0x06d-Testing-Data-Storage.md#static-analysis and Android https://github.com/OWASP/owasp-mstg/blob/master/Document/0x05d-Testing-Data-Storage.md#static-analysis. The static analysis part of these sections could use some more (regex) patterns and tools to detect such information. If you have any ideas on how to detect such sensitive information please share here, then we can discuss and you could add a PR :-) For example MobSF is already getting URLs out of the APK and IPAs, maybe that's a way to start. Or also TruffleHog (if source code is provided).

Hi @sushi2k Yes, what do you think if I create a PR to add an subsection named "App Package" under section https://github.com/OWASP/owasp-mstg/blob/master/Document/0x05d-Testing-Data-Storage.md#static-analysis for Android? (Like the "Local Storage", "KeyStore", "KeyChain", "Third Party libraries" subsections we have). "App Package" subsection will make sure developers use regex to recursive search for sensitive information, endpoints, URL patterns, etc. After they unzip the APK package. And I will also add the use of MobSF to search for sensitive information into dynamic analysis section as well.

cpholguera commented 3 years ago

Hi @crazykid95, sorry about the late response, we were and are very busy with the new refactoring of both MASVS and MSTG.

Right now, as you mentioned, there's only one MASVS requirement mentioning something "hardcoded" (MSTG-CRYPTO-1). We're thinking about introducing a new V7 (MSTG-CODE) requirement for hardcoded sensitive information.

For now, it would be great if you could open the PR as you described. If needed we can move the content once the new MASVS requirement is available.

Thanks for noticing this!