Skip to content

Add more test cases covering the v1 MASTG-TEST-0048: RE Tools Detection (android) (by @appknox)#3848

Open
ScreaMy7 wants to merge 19 commits into
OWASP:masterfrom
ScreaMy7:TEST-0048
Open

Add more test cases covering the v1 MASTG-TEST-0048: RE Tools Detection (android) (by @appknox)#3848
ScreaMy7 wants to merge 19 commits into
OWASP:masterfrom
ScreaMy7:TEST-0048

Conversation

@ScreaMy7

@ScreaMy7 ScreaMy7 commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator

This PR closes #3837

Description

Adds new MASVS-RESILIENCE content (TEST-0048) covering runtime detection of dynamic instrumentation frameworks (Frida and Xposed/LSPosed), with supporting demos, best practices, and static-analysis rules. For bypass demo I have used similar structure as #3692.

  • Ported Frida detection test to MASTG v2 (MASTG-TEST-0x48) with dynamic API-hooking steps and
    best-practice references (MASTG-BEST-0x48).
  • Ported Xposed/LSPosed detection test to MASTG v2 (MASTG-TEST-0x49) with dynamic API-hooking steps
    and best-practice references (MASTG-BEST-0x49).
  • Added Android pass/fail demos for Frida detection: MASTG-DEMO-0x48 (Semgrep static detection) and
    MASTG-DEMO-0x49 (runtime bypass via Frida hooks + frida-server reconfiguration).
  • Added Android pass/fail demos for Xposed/LSPosed detection: MASTG-DEMO-0x4A (Semgrep static
    detection) and MASTG-DEMO-0x4B (runtime bypass via Frida hooks).
  • Added Semgrep rules for static detection of Frida and Xposed signatures
    (mastg-android-frida-detection, mastg-android-xposed-detection).

Testing

Tested on Android 12 with LSPosed v1.9.2

Notes:

Modern alternatives such as Magisk/Zygisk module detection and native inline hook detection are planned as future TODO items.


AI Tool Disclosure

Check exactly one option.

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

If AI tools were used to generate or substantially modify code or text, complete the following.

  • AI tools used: Claude.
  • Models and versions: Claude Opus 4.8
  • Prompt summary: Edits in demo
  • Your mobile security expertise level: high.

For first-time contributors using AI tools.

  • Provide an export of the AI chat or session, for example a shared link or PDF attachment.
  • Ensure the commit history shows an initial commit with AI-generated content followed by commits that demonstrate review, correction, and improvement.

Undisclosed use of AI tools will result in the PR being closed. Large rewrites or bulk changes generated by AI require explicit prior approval from the maintainers. Learn more in "Use of AI tools in contributions".


Contributor Checklist

  • I have read and understood the contributing guidelines.
  • I followed the project style guide.
  • I validated the technical correctness of my changes and understand the topic.
  • This PR adds clear value and is not spam or low-effort content.

Relevant documentation.

Contributors are expected to understand basic git and GitHub workflows, including forks, branches, commits, and pull requests. The project does not provide training. Pull requests that do not meet these minimum requirements may be closed without review.

@ScreaMy7 ScreaMy7 marked this pull request as ready for review June 5, 2026 09:59
@cpholguera cpholguera changed the title Port MASTG-TEST-0048: Testing Reverse Engineering Tools Detection (android) (by @appknox) Add more test cases covering the v1 MASTG-TEST-0048: RE Tools Detection (android) (by @appknox) Jun 5, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR ports v1 MASTG-TEST-0048 (RE Tools Detection / dynamic instrumentation detection on Android) into MASTG v2 by adding two new resilience tests (Frida + Xposed/LSPosed), along with supporting Semgrep rules, pass/fail demos, and best-practice pages.

Changes:

  • Added two new v2 Android resilience tests for runtime detection (and bypassability) of Frida and Xposed/LSPosed.
  • Added Semgrep rules to statically detect common Frida/Xposed signature checks in code.
  • Added correlated demos (pass/fail) illustrating static detection and runtime bypass via Frida scripts.

Reviewed changes

Copilot reviewed 24 out of 24 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
tests-beta/android/MASVS-RESILIENCE/MASTG-TEST-0x48.md New v2 test describing runtime Frida detection/bypass evaluation (dynamic hooks).
tests-beta/android/MASVS-RESILIENCE/MASTG-TEST-0x49.md New v2 test describing runtime Xposed/LSPosed detection/bypass evaluation (dynamic hooks).
rules/mastg-android-frida-detection.yml New Semgrep rules for common Frida detection signatures (/proc, maps, default port, etc.).
rules/mastg-android-xposed-detection.yml New Semgrep rules for common Xposed/LSPosed detection signatures (/proc/self/maps + stack inspection).
demos/android/MASVS-RESILIENCE/MASTG-DEMO-0x48/MASTG-DEMO-0x48.md Pass demo doc for static Frida-detection identification via Semgrep.
demos/android/MASVS-RESILIENCE/MASTG-DEMO-0x48/MastgTest.kt Kotlin sample implementing Frida detection routines.
demos/android/MASVS-RESILIENCE/MASTG-DEMO-0x48/MastgTest_reversed.java Reverse-engineered Java artifact used for static analysis demos.
demos/android/MASVS-RESILIENCE/MASTG-DEMO-0x48/run.sh Automation script to run Semgrep for the Frida-detection pass demo.
demos/android/MASVS-RESILIENCE/MASTG-DEMO-0x48/output.txt Captured Semgrep output for the Frida-detection pass demo.
demos/android/MASVS-RESILIENCE/MASTG-DEMO-0x49/MASTG-DEMO-0x49.md Fail demo doc for bypassing Frida detection.
demos/android/MASVS-RESILIENCE/MASTG-DEMO-0x49/script.js Frida script intended to bypass the Frida detection routines.
demos/android/MASVS-RESILIENCE/MASTG-DEMO-0x49/run.sh Automation script to run the Frida bypass demo.
demos/android/MASVS-RESILIENCE/MASTG-DEMO-0x49/output.txt Captured runtime output for the Frida bypass demo.
demos/android/MASVS-RESILIENCE/MASTG-DEMO-0x4A/MASTG-DEMO-0x4A.md Pass demo doc for static Xposed/LSPosed-detection identification via Semgrep.
demos/android/MASVS-RESILIENCE/MASTG-DEMO-0x4A/MastgTest.kt Kotlin sample implementing Xposed/LSPosed detection routines.
demos/android/MASVS-RESILIENCE/MASTG-DEMO-0x4A/MastgTest_reversed.java Reverse-engineered Java artifact used for static analysis demos.
demos/android/MASVS-RESILIENCE/MASTG-DEMO-0x4A/run.sh Automation script to run Semgrep for the Xposed/LSPosed pass demo.
demos/android/MASVS-RESILIENCE/MASTG-DEMO-0x4A/output.txt Captured Semgrep output for the Xposed/LSPosed pass demo.
demos/android/MASVS-RESILIENCE/MASTG-DEMO-0x4B/MASTG-DEMO-0x4B.md Fail demo doc for bypassing Xposed/LSPosed detection via API hooking.
demos/android/MASVS-RESILIENCE/MASTG-DEMO-0x4B/script.js Frida script implementing the bypass hooks for Xposed/LSPosed detection.
demos/android/MASVS-RESILIENCE/MASTG-DEMO-0x4B/run.sh Automation script to run the Xposed/LSPosed bypass demo.
demos/android/MASVS-RESILIENCE/MASTG-DEMO-0x4B/output.txt Captured runtime output for the Xposed/LSPosed bypass demo.
best-practices/MASTG-BEST-0x48.md New best practice page for Frida instrumentation detection.
best-practices/MASTG-BEST-0x49.md New best practice page for Xposed/LSPosed instrumentation detection.

Comment thread tests-beta/android/MASVS-RESILIENCE/MASTG-TEST-0x48.md Outdated
Comment thread tests-beta/android/MASVS-RESILIENCE/MASTG-TEST-0x49.md Outdated
Comment thread demos/android/MASVS-RESILIENCE/MASTG-DEMO-0x4A/run.sh Outdated
Comment thread demos/android/MASVS-RESILIENCE/MASTG-DEMO-0x48/run.sh
Comment thread demos/android/MASVS-RESILIENCE/MASTG-DEMO-0x48/output.txt
Comment thread demos/android/MASVS-RESILIENCE/MASTG-DEMO-0x48/MASTG-DEMO-0x48.md
Comment thread demos/android/MASVS-RESILIENCE/MASTG-DEMO-0x49/MASTG-DEMO-0x49.md Outdated
Comment thread demos/android/MASVS-RESILIENCE/MASTG-DEMO-0x48/MastgTest.kt Outdated
Comment thread demos/android/MASVS-RESILIENCE/MASTG-DEMO-0x4B/script.js
Comment thread demos/android/MASVS-RESILIENCE/MASTG-DEMO-0x4B/script.js Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add more test cases covering the v1 MASTG-TEST-0048: RE Tools Detection (android)

3 participants