Port MASTG-TEST-0028: Testing for Testing Deep Links (android) - #3897
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR closes #2980
Description
Ports MASTG-TEST-0028 (Testing Deep Links) from v1 to v2 for Android, targeting deep link weaknesses that allow link hijacking and unvalidated external input (MASWE-0058). The single v1 test is split into two focused v2 tests: one for
http/httpsApp Links declared without OS verification, and one for custom URL scheme handlers that act on URI parameters without validation. General theory, OS-version behavior, and the website-association verification workflow are moved out of the test into Knowledge and Techniques.New v2 Tests (tests-beta)
MASTG-TEST-0393 — Use of Unverified App Links (static, config)
http/httpsdeep link<intent-filter>elements declared withoutandroid:autoVerify="true"autoVerifyalone is necessary but not sufficient, pointing to the website-association verification techniqueMASTG-TEST-0394 — Missing Input Validation in Custom URL Scheme Handlers (static, code, manual)
getData,getQueryParameter)sourceApplicationequivalent, so every custom URL scheme handler is reachable by any app on the deviceNew Demos (MASVS-PLATFORM)
MASTG-DEMO-0151 — Deep Link Intent Filter Missing android:autoVerify with semgrep (for MASTG-TEST-0393)
http/httpsApp Link performs a sensitive action with correctly validated input, isolating the weakness to the missing verification rather than input handlingMASTG-DEMO-0152 — Custom URL Scheme Handler Without Input Validation with semgrep (for MASTG-TEST-0394)
mastestapp://transferand passing the rawamountparameter to a sensitive action without type conversion or bounds checkingDeepLinkActivity_reversed.java, wheregetIntent().getData()is called) and the parameter extraction (MastgTest_reversed.java)New SAST Rules
mastg-android-deeplink-autoverify-missing.yml — flags
http/httpsdeep links withoutandroid:autoVerify="true"mastg-android-custom-deeplink-scheme.yml — flags custom (non
http/https) URL scheme deep linksmastg-android-deeplink-unvalidated-parameter.yml — locates the deep link handler entry point (
getData) and the URI parameters it reads (getQueryParameter)All three rules use order-independent matching so they work across arbitrary real-world manifests regardless of manifest child-element order.
New Techniques
adb shell pm get-app-linksand the App Link Verification Tester, with common Digital Asset Links failure causesNew Best Practices
Deprecation
status: deprecated,covered_by: [MASTG-TEST-0393, MASTG-TEST-0394]Supporting File Updates
autoVerify+ Digital Asset Links, redirects, subdomains, wildcards), Android version-dependent verification behavior (API < 31 vs ≥ 31), incoming intent handling (getIntent,getData,onNewIntent), URI parameter parsing (getQueryParameter,getPathSegments,getLastPathSegment), and the absence of an Android equivalent to iOS'ssourceApplication; added a reference to the "Measuring the Insecurity of Mobile Deep Links of Android" research paperAI Tool Disclosure
Check exactly one option.