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

Add codesign/ldid to the test Determining Whether the App is Debuggable (MSTG-CODE-2) #2296

Merged

Conversation

sohsatoh
Copy link
Contributor

Thank you for submitting a Pull Request to the OWASP MASTG. Please make sure that:

  • Your contribution is written in the 2nd person (e.g. you)
  • Your contribution is written in an active present form for as much as possible.
  • You have made sure that the reference section is up to date (e.g. please add sources you have used, make sure that the references to MITRE/MASVS/etc. are up to date)
  • Your contribution has proper formatted markdown and/or code
  • Any references to website have been formatted as [TEXT](URL “NAME”)
  • You verified/tested the effectiveness of your contribution (e.g.: is the code really an effective remediation? Please verify it works!)

If your PR is related to an issue. Please end your PR test with the following line:
This PR closes #2295

@sohsatoh
Copy link
Contributor Author

sohsatoh commented Oct 21, 2022

As I am not a native English speaker, it would be great if you could tell me if I have made any mistakes in English grammar or something.

@cpholguera
Copy link
Collaborator

Thank you very much for taking the time to open this PR @sohsatoh!

Copy link
Collaborator

@cpholguera cpholguera left a comment

Choose a reason for hiding this comment

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

Hi @sohsatoh, thanks for including this. This is exactly what this test case needed!

Could you please also apply the following changes? This way we keep the mitigation part in the overview and the static analysis will only contain what you've added (using codesign and using ldid).

## Determining Whether the App is Debuggable (MSTG-CODE-2)

### Overview

To test if the app is [debuggable](0x06c-Reverse-Engineering-and-Tampering.md#debugging) you need to inspect the app entitlements and check if the value of [`get-task-allow`](https://developer.apple.com/documentation/security/notarizing_macos_software_before_distribution/resolving_common_notarization_issues, "Resolving common notarization issues") key is set to `true`.

While debugging is a useful feature when developing an app, it has to be turned off before releasing apps to the App Store or within an enterprise program. To do that you need to determine the mode in which your app is to be generated to check the flags in the environment:

- Select the build settings of the project
- Under 'Apple LVM - Preprocessing' and 'Preprocessor Macros', make sure 'DEBUG' or 'DEBUG_MODE' is not selected (Objective-C)
- Make sure that the "Debug executable" option is not selected.
- Or in the 'Swift Compiler - Custom Flags' section / 'Other Swift Flags', make sure the '-D DEBUG' entry does not exist.

### Static Analysis


Document/0x06i-Testing-Code-Quality-and-Build-Settings.md Outdated Show resolved Hide resolved
Document/0x06i-Testing-Code-Quality-and-Build-Settings.md Outdated Show resolved Hide resolved
Document/0x06i-Testing-Code-Quality-and-Build-Settings.md Outdated Show resolved Hide resolved
Copy link
Collaborator

@cpholguera cpholguera left a comment

Choose a reason for hiding this comment

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

Thanks a lot @sohsatoh!

@cpholguera cpholguera merged commit 91afaf0 into OWASP:master Jan 31, 2023
@cpholguera cpholguera changed the title #2295 [MSTG-CODE-2] Add a static analysis method (codesign/ldid) Add codesign/ldid to the test Determining Whether the App is Debuggable (MSTG-CODE-2) May 8, 2023
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.

[MSTG-CODE-2] Add a static analysis method for get-task-allow
3 participants