Skip to content

Update DEMO-0128/ 0129 / 0130 and TEST-0364 / 0365 / 0366 and Add new DEMO for Broadcast Receivers#3884

Draft
cpholguera wants to merge 6 commits into
masterfrom
update-demos-128-129-130
Draft

Update DEMO-0128/ 0129 / 0130 and TEST-0364 / 0365 / 0366 and Add new DEMO for Broadcast Receivers#3884
cpholguera wants to merge 6 commits into
masterfrom
update-demos-128-129-130

Conversation

@cpholguera

Copy link
Copy Markdown
Collaborator

Description

Refines the v2 demos and tests for sensitive functionality exposure through IPC (the MASTG-TEST-0029 port), targeting exported/unprotected app components that let third-party apps reach sensitive functionality without going through the intended flow (MASWE-0119, MASWE-0062, MASWE-0063). Reworks the existing demos into a staged, reproducible pipeline, factors the detection logic into reusable Semgrep rules, and adds a new demo covering context-registered receivers.

Reworked Demos (MASVS-PLATFORM)

Each demo now follows a staged pipeline (capture all → reduce → manual review) that mirrors the test steps, replacing the previous single output.txt with discrete, inspectable artifacts (manifest_scan, code_scan, evaluate.sh, evaluation.txt) and a reversed MastgTest_reversed.java:

  • MASTG-DEMO-0128 — Sensitive Data Exposed Through an Unprotected Activity (for MASTG-TEST-0364)
  • MASTG-DEMO-0129 — Sensitive Action Exposed Through an Unprotected Service (for MASTG-TEST-0365)
  • MASTG-DEMO-0130 — Sensitive Action Exposed Through an Unprotected Manifest-Declared Broadcast Receiver (for MASTG-TEST-0366)

New Demo (MASVS-PLATFORM)

  • MASTG-DEMO-0x01 — Sensitive Action Exposed Through an Unprotected Context-Registered Broadcast Receiver (for MASTG-TEST-0366) (draft ID; needs updating when a real ID is assigned)
    • Kotlin sample registering two context-registered receivers at runtime, demonstrating exposure that manifest-only scanning misses
    • Includes a dedicated onreceive_scan stage to surface dynamically registered receivers

New Reusable Semgrep Rules (rules/)

Factored the component-discovery and protection-level logic out of individual demos into shared rules:

  • mastg-android-activity-entrypoints.yml, mastg-android-service-entrypoints.yml, mastg-android-receiver-entrypoints.yml
  • mastg-android-exported-activity.yml, mastg-android-exported-service.yml, mastg-android-exported-receiver.yml
  • mastg-android-context-registered-receiver.yml
  • mastg-android-declared-permission-protection-level.yml

Test Updates (tests-beta)

  • MASTG-TEST-0364 / 0365 / 0366 — expanded Observation and Evaluation sections with more detailed, step-by-step guidance aligned to the new staged demo artifacts

AI Tool Disclosure

Check exactly one option.

  • This contribution does not include AI-generated content.
  • This contribution includes AI-generated content.

- Manifest (XML): exported-activity, exported-service, exported-receiver — each flags exported + no android:permission, and lists permission-protected components separately.
- Code (Java): activity-entrypoints, service-entrypoints (+ caller-permission checks), receiver-entrypoints (+ intent-extra sources), context-registered-receiver.
…our "capture all → reduce → manual" model), mirroring the test steps:

- run.sh runs @MASTG-TOOL-0110 to capture the manifest inventory + inspect the decompiled code → separate output files.
- evaluate.sh (standalone, like MASTG-DEMO-0059) reduces the exported/unprotected set with jq, dropping framework/library namespaces (androidx.*, android.*, …) → evaluation.txt.
- The .md Evaluation explains the remaining manual discards in prose.

The discards are now explicit and visible in the tooling:

- MASTG-DEMO-0128: evaluate.sh drops the androidx.* Compose tooling activities; the writeup discards MainActivity as the (legitimately exported) launcher, leaving SecretActivity.
- MASTG-DEMO-0130: the manifest scan lists ProfileInstallReceiver under permission-protected (it's the AndroidX-merged receiver not in the original manifest), and evaluate.sh also drops it by namespace — both reasons stated.
@github-actions github-actions Bot removed the tests label Jun 16, 2026
@cpholguera cpholguera changed the title Update demos 128 129 130 Update DEMO-0128/ 0129 / 0130 and TEST-0364 / 0365 / 0366 and Add new DEMO for Broadcast Receivers Jun 16, 2026
@cpholguera cpholguera marked this pull request as draft June 16, 2026 06:35
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.

1 participant