Skip to content

feat(mobile): add Client-Side Injection lesson and challenges to the Android app - #1069

Open
SeanDuggan wants to merge 40 commits into
OWASP:devfrom
SeanDuggan:mobile-split/07-client-side-injection
Open

SeanDuggan wants to merge 40 commits into
OWASP:devfrom
SeanDuggan:mobile-split/07-client-side-injection

Conversation

@SeanDuggan

Copy link
Copy Markdown
Member

Adds the first mobile category on top of the Android app shell.

Android: Client-Side Injection lesson plus challenges 1 and 2, with SQLCipher-backed databases as the SQL injection targets. Layouts, navigation destinations and drawer entries are included, and the three modules are registered in KeyValidator, ModuleInfoHelper and MainActivity.

Server content: the updated lesson and challenge JSPs and i18n properties, plus the mobileBlurb.appLink string those pages use. No platform or servlet changes.

Tests: KeyValidatorTest checks that these modules have no offline hash, so flags are only accepted by the server. Wrong, empty and null keys are rejected.

Depends on: the module IDs/cheatsheets PR, the server API PR and the app shell PR. I'll rebase onto dev once they merge.

… categories

Prefix the Client Side Injection, Insecure Data Storage and Poor
Authentication module names with "Mobile" so they are distinguishable
from the web modules, and replace their cheatsheet solutions with text
matching the current Android challenges.

Remove the legacy Insecure Data Storage 2/3 and Poor Authentication 2
module rows (and the da3de2e5 cheatsheet registration), which have no
counterpart in the reworked mobile app. Update the module count in
GetterIT accordingly.
Adds the Gradle project, manifest, resources, launch/login/main activities,
navigation, preferences, authentication, key validation and progress
tracking utilities, and the home, progress, scoreboard and ADB reference
screens. Lesson and challenge screens referenced by the navigation graph are
added in the following PRs, so those destinations are not usable until then.

Part of the split of OWASP#894 (mobile app).
Disable cleartext traffic app-wide via a network security config and reject non-https server URLs at login, registration and key validation. Debug builds additionally trust user-installed CAs for local development.
The shell now builds with an empty KeyValidator.Module enum and empty
nav, menu and module-info registries. Each lesson/challenge category PR
registers its own entries. Removes the myapp://open deep link and the
KeyValidator unit test, which return with the first category.
Removes lesson/challenge strings and the Insufficient Cryptography ADB
reference card. These return with their own category PRs.

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.

🟡 Changes recommended

One or more issues must be addressed before approval.

4 open issues
What changed in this PR

Adds Client-Side Injection training to the Android application and updates the corresponding server pages to describe the new exercises.

Changes:

  • Adds SQLCipher database helpers, challenge logic, module registration, navigation, and Android UI resources.
  • Updates lesson/challenge descriptions and replaces legacy APK references with the unified mobile app.
  • Adds offline-validation rejection tests and Android build configuration.

Documentation: AGENTS.md needs updating to describe the new mobile/app Gradle project alongside the legacy independent apps.

Validation: Static review only; builds and tests were not run. Five actionable findings were recorded.

File Description
src/​main/​webapp/​lessons/​f758a97011ec4452cc0707e546a7c0f68abc6ef2ab747ea87e0892767152eae1.jsp Updated as part of this pull request.
src/​main/​webapp/​challenges/​cfe68711def42bb0b201467b859322dd2750f633246842280dc68c858d208425.jsp Updated as part of this pull request.
src/​main/​webapp/​challenges/​8855c8bb9df4446a546414562eda550520e29f7a82400a317c579eb3a5a0a8ef.jsp Updated as part of this pull request.
src/​main/​resources/​i18n/​moduleGenerics/​mobileGenericStrings.properties Updated as part of this pull request.
src/​main/​resources/​i18n/​lessons/​m_client_side_injection/​f758a97011ec4452cc0707e546a7c0f68abc6ef2ab747ea87e0892767152eae1.properties Updated as part of this pull request.
src/​main/​resources/​i18n/​challenges/​mobile/​clientSideInjection/​clientSideInjection.properties Updated as part of this pull request.
mobile/​settings.gradle Updated as part of this pull request.
mobile/​scripts/​calculate_key_hashes.py Updated as part of this pull request.
mobile/​gradlew.bat Updated as part of this pull request.
mobile/​gradle/​wrapper/​gradle-wrapper.properties Updated as part of this pull request.
mobile/​gradle.properties Updated as part of this pull request.
mobile/​build.gradle Updated as part of this pull request.
mobile/​app/​src/​test/​java/​org/​owasp/​mobileshepherd/​KeyValidatorTest.java Updated as part of this pull request.
mobile/​app/​src/​main/​res/​xml/​preferences.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​xml/​network_security_config.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​xml/​file_paths.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​xml/​data_extraction_rules.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​xml/​backup_rules.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​values/​themes.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​values/​dimens.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​values/​colors.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​values-w600dp/​dimens.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​values-w1240dp/​dimens.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​values-night/​themes.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​values-night/​colors.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​values-land/​dimens.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​navigation/​mobile_navigation.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​mipmap-anydpi-v26/​ic_launcher.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​mipmap-anydpi-v26/​ic_launcher_round.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​menu/​main.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​menu/​activity_main_drawer.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​layout/​nav_item_layout.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​layout/​nav_header_main.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​layout/​nav_drawer_layout.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​layout/​item_user_result.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​layout/​item_scoreboard_entry.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​layout/​item_module_progress.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​layout/​fragment_scoreboard.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​layout/​fragment_progress.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​layout/​fragment_preferences.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​layout/​fragment_home.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​layout/​fragment_client_side_injection_lesson.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​layout/​fragment_client_side_injection_challenge2.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​layout/​fragment_client_side_injection_challenge1.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​layout/​dialog_lesson_info.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​layout/​dialog_auth.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​layout/​content_main.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​layout/​app_bar_main.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​layout/​activity_main.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​layout/​activity_login.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​layout/​activity_landing.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​drawable/​side_nav_bar.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​drawable/​shepherd_background.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​drawable/​shape.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​drawable/​nav_header_background.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​drawable/​ic_status_incomplete.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​drawable/​ic_status_complete.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​drawable/​ic_menu_web.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​drawable/​ic_menu_warning.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​drawable/​ic_menu_slideshow.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​drawable/​ic_menu_shield.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​drawable/​ic_menu_settings.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​drawable/​ic_menu_network.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​drawable/​ic_menu_lock.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​drawable/​ic_menu_link.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​drawable/​ic_menu_key.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​drawable/​ic_menu_home.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​drawable/​ic_menu_gallery.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​drawable/​ic_menu_database.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​drawable/​ic_menu_code.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​drawable/​ic_menu_camera.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​drawable/​ic_menu_alert.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​drawable/​ic_launcher_background.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​drawable/​ic_expand_more.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​drawable/​grassbackground.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​drawable/​card_ripple.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​drawable/​button_scale_animation.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​drawable/​bg_scoreboard_row.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​drawable/​bg_medal_silver.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​drawable/​bg_medal_gold.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​drawable/​bg_medal_bronze.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​drawable/​animation.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​drawable-v24/​ic_menu.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​drawable-v24/​ic_launcher_foreground.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​drawable-v24/​ic_launcher_background.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​drawable-v24/​animation.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​anim/​slide_out_right.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​anim/​slide_out_left.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​anim/​slide_in_right.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​anim/​slide_in_left.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​anim/​scale_up.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​anim/​scale_down.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​anim/​fade_out.xml Updated as part of this pull request.
mobile/​app/​src/​main/​res/​anim/​fade_in.xml Updated as part of this pull request.
mobile/​app/​src/​main/​java/​org/​owasp/​mobileshepherd/​utils/​ModuleInfoHelper.java Updated as part of this pull request.
mobile/​app/​src/​main/​java/​org/​owasp/​mobileshepherd/​utils/​KeyValidator.java Updated as part of this pull request.
mobile/​app/​src/​main/​java/​org/​owasp/​mobileshepherd/​utils/​KeyProvider.java Updated as part of this pull request.
mobile/​app/​src/​main/​java/​org/​owasp/​mobileshepherd/​utils/​CompletionVisualFeedback.java Updated as part of this pull request.
mobile/​app/​src/​main/​java/​org/​owasp/​mobileshepherd/​utils/​CompletionBadge.java Updated as part of this pull request.
mobile/​app/​src/​main/​java/​org/​owasp/​mobileshepherd/​ui/​progress/​ProgressFragment.java Updated as part of this pull request.
mobile/​app/​src/​main/​java/​org/​owasp/​mobileshepherd/​ui/​lessons/​clientsideinjection/​helpers/​DatabaseHelper.java Updated as part of this pull request.
mobile/​app/​src/​main/​java/​org/​owasp/​mobileshepherd/​ui/​home/​HomeFragment.java Updated as part of this pull request.
mobile/​app/​src/​main/​java/​org/​owasp/​mobileshepherd/​ui/​challenges/​clientsideinjection/​helpers/​Challenge2DatabaseHelper.java Updated as part of this pull request.
mobile/​app/​src/​main/​java/​org/​owasp/​mobileshepherd/​ui/​challenges/​clientsideinjection/​helpers/​Challenge1DatabaseHelper.java Updated as part of this pull request.
mobile/​app/​src/​main/​java/​org/​owasp/​mobileshepherd/​ui/​challenges/​clientsideinjection/​ClientSideInjectionChallenge2Model.java Updated as part of this pull request.
mobile/​app/​src/​main/​java/​org/​owasp/​mobileshepherd/​ui/​challenges/​clientsideinjection/​ClientSideInjectionChallenge1Model.java Updated as part of this pull request.
mobile/​app/​src/​main/​java/​org/​owasp/​mobileshepherd/​ui/​challenges/​clientsideinjection/​ClientSideInjectionChallenge1Fragment.java Updated as part of this pull request.
mobile/​app/​src/​main/​java/​org/​owasp/​mobileshepherd/​ui/​adb/​AdbReferenceFragment.java Updated as part of this pull request.
mobile/​app/​src/​main/​java/​org/​owasp/​mobileshepherd/​Preferences.java Updated as part of this pull request.
mobile/​app/​src/​main/​java/​org/​owasp/​mobileshepherd/​NavigationItem.java Updated as part of this pull request.
mobile/​app/​src/​main/​java/​org/​owasp/​mobileshepherd/​NavigationAdapter.java Updated as part of this pull request.
mobile/​app/​src/​main/​java/​org/​owasp/​mobileshepherd/​LoginActivity.java Updated as part of this pull request.
mobile/​app/​src/​main/​java/​org/​owasp/​mobileshepherd/​LandingActivity.java Updated as part of this pull request.
mobile/​app/​src/​main/​AndroidManifest.xml Updated as part of this pull request.
mobile/​app/​src/​androidTest/​java/​com/​owasp/​reverser/​ExampleInstrumentedTest.java Updated as part of this pull request.
mobile/​app/​proguard-rules.pro Updated as part of this pull request.
mobile/​app/​build.gradle Updated as part of this pull request.
mobile/​app/​.gitignore Updated as part of this pull request.
mobile/​.gitignore Updated as part of this pull request.

Review effort: Balanced

Comment thread mobile/gradle.properties Resolved
…ule consolidation

coreSchema.sql only applies on a fresh setup, so existing databases kept the
Mobile Insecure Data Storage 2/3 and Poor Authentication 2 modules, whose
moduleNames keys are gone. Getter.getChallenges then threw MissingResourceException.

- add updatev3_1_mobilemodules.sql: deletes those modules' medals, results and
  cheatsheet rows, then the modules, and renames the 7 remaining mobile modules.
  Every statement is keyed on a fixed module ID, so it is safe to re-run.
- add an "upgrade-mobile" Setup option, separate from the 3.0 -> 3.1 upgrade,
  which is not re-runnable on a 3.1 database.
- executeUpdateScript takes the script name and switches the pooled connection
  back to autocommit, since coreSchema.sql leaves it at AUTOCOMMIT=0.
- add SetupMobileUpgradeIT covering removal, renames, re-running and the
  challenge list loading afterwards.
The app asks /mobileModuleStatus which modules the signed-in student can
open and greys out the rest in the navigation drawer and progress list,
with the server's reason shown when tapped. This mirrors the platform's
open floor / CTF rules: module closed, event not running, module blocked.

Advisory only: the server re-checks every module start and key request.
It fails open, so signed-out or offline use and failed requests grey out
nothing. Status refreshes on resume, drawer open, sign in and sign out.
…JDK path

Changing server_preference while signed in kept the old server's session
cookie, so it would be sent to the new server. Log out when the server
actually changes.

Remove org.gradle.java.home, which pinned a Windows Android Studio path and
overrode JAVA_HOME on other machines.
@ismisepaul ismisepaul added this to the 4.0.0 milestone Oct 27, 2026
…Android app

Adds the first mobile category on top of the app shell:

- Android: lesson plus challenges 1 and 2 (SQLCipher-backed databases, SQL
  injection targets), layouts, navigation destinations, drawer entries and
  module registration in KeyValidator, ModuleInfoHelper and MainActivity.
- Server: updated lesson and challenge JSPs and i18n properties, plus the
  mobileBlurb.appLink generic string those pages use.
- Tests: KeyValidatorTest confirms these modules have no offline hash, so
  flags are only accepted by the server.
The Login/Search buttons were live while KeyProvider.getKey and the DB
seeding were still in flight. With an empty key, getReadableDatabase("")
threw outside the try block and crashed the app.

Disable the button until seeding succeeds, show an error if seeding fails,
and open the database inside the try block so failures are reported
instead of crashing. Applied to the lesson and both challenges, which
shared the pattern.
@SeanDuggan
SeanDuggan force-pushed the mobile-split/07-client-side-injection branch from b9a7fd2 to 9bc6c75 Compare October 27, 2026 20:55
SeanDuggan and others added 4 commits October 27, 2026 22:47
Replace the individually listed local planning docs with a single *.md rule.
Remove CHALLENGE_SOLUTIONS.txt and missing_challenges.txt, which refer to
no files in the repository.
SeanDuggan and others added 6 commits November 2, 2026 21:09
The logcat grep example rendered a literal "search_term" on the ADB Commands screen.
…app flags

The Client Side Injection lesson and challenges 1 and 2 kept the old static
results with hardcodedKey=1, so the web SolutionSubmit compared against the
old values while the app now shows an HMAC of the MobileModuleFlags base flag.
Set hardcodedKey=0 and use the base flags as moduleResult so a key copied from
the app is accepted on the web.
…ction' into mobile-split/07-client-side-injection
The Android app lives in mobile/, not mobile/MobileShepherd/.
SeanDuggan and others added 18 commits November 9, 2026 11:02
Insecure Communication is deferred to 4.0.1. Remove its key hash
entries, ProGuard rules and the cleartext-traffic comment.
Drop the About dialog button that opened owasp.org and the unused hidden Top 10 FAB with its string. Lessons now name the relevant risk as plain text.
The pre-app mobile modules (the mobile API and mobile server lessons and the
legacy mobile challenges) are replaced by the MobileShepherd app modules. Drop
their module and cheatsheet rows from coreSchema.sql, their solutions entries,
and their lesson/challenge JSPs. GetterIT now uses the Insecure Direct Object
References lesson instead of a legacy mobile lesson.
…le-ids-cheatsheets

# Conflicts:
#	src/main/java/servlets/Setup.java
… guard

The saved theme preference was only applied in MainActivity, so the launcher
LandingActivity and LoginActivity followed the system setting on a cold start.
Apply it from a new Application subclass via ThemeHelper instead.

Also dim the shared background artwork in dark mode with a scrim layer, add
values-night overrides for colours used directly by layouts and Java, remove
unused template drawables and dead night colours, and add ThemeColorParityTest
so a new colour without a night counterpart, or a hard-coded hex literal in a
layout or drawable, fails the unit tests.
- Exclude the auth preferences file from cloud backup and device transfer
  (backup_rules.xml, data_extraction_rules.xml)
- Use ContextCompat.getColor so Login and Progress work on API 21-22
- Use the real package name in the "find package" adb command
- Refresh drawer header and navigation after signing out from Home
- Refresh the scoreboard after signing in from its offline view
The network security config (cleartext off, debug-only user CA trust) is only
enforced on API 24+, so API 21-23 would ignore it. Server URLs are already
HTTPS-only, and raising minSdk makes the release CA restrictions apply on
every supported device.
- compileSdk and targetSdk 35 (minSdk stays 24)
- Android Gradle Plugin 8.2.2 -> 8.6.1 and Gradle 8.2 -> 8.7, the minimum
  that supports compileSdk 35
- Android 15 enforces edge-to-edge, which made the status bar transparent
  and exposed the drawer's fitsSystemWindows padding as a white strip
  behind the status bar. Drop fitsSystemWindows from the drawer root and
  inset the drawer header and list from the system bar insets instead.
statusBarColor is ignored when targeting API 35, so the Settings screen's status bar is transparent over a light action bar and the white clock/icons were unreadable. Use dark status bar icons in light mode.
android-database-sqlcipher 4.5.4 ships 4 KB-aligned native libraries that fail to load on 16 KB-page devices and block Play submissions at targetSdk 35. sqlcipher-android 4.17.0 ships 16 KB-aligned libs for the 64-bit ABIs (verified: LOAD segments 0x4000 on arm64-v8a and x86_64, zipalign -P 16 passes).

androidx.sqlite is raised to 2.6.2, which this release requires. Code using SQLCipher lands with the Client-Side Injection module.
Move the CSI lesson and both challenge databases from net.sqlcipher (4.5.4,
4 KB aligned native libs) to net.zetetic:sqlcipher-android, whose 64-bit libs
are 16 KB aligned. The password now goes to the SQLiteOpenHelper constructor, so
the helpers are created once the key provider returns. Also drop the removed
fab_owasp_link lookups and use the themed error_text colour for the challenge 1
login error.
The Setup upgrade-mobile option now deletes the modules, cheatsheet, medals and results rows for the 12 legacy mobile modules (Broken Crypto, Reverse Engineering 2 and 3, Unintended Data Leakage, Content Provider Leakage, Untrusted Input and their numbered variants), in addition to the 3 consolidated ones. Without this, an existing database still lists modules whose i18n keys are gone and Getter.getChallenges throws MissingResourceException.

SetupMobileUpgradeIT seeds all 15 removed modules with their dependent rows and checks the upgrade removes them, renames the rest, loads the challenge list and is safe to run again.
…/07-client-side-injection

Resolve the module-row overlap with the module id and legacy-module removal PR.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

3 participants