Skip to content

fix(controller): scope log broadcast (M4) + ADB key sign/verify-only (S3)#10

Merged
luisguzman-adfa merged 1 commit into
mainfrom
fix/phase1-security-m4-s3
Jun 18, 2026
Merged

fix(controller): scope log broadcast (M4) + ADB key sign/verify-only (S3)#10
luisguzman-adfa merged 1 commit into
mainfrom
fix/phase1-security-m4-s3

Conversation

@luisguzman-adfa

Copy link
Copy Markdown
Collaborator

Summary

Two small Phase 1 (security hardening) fixes, no behaviour change for users. Surgical line-fixes — no refactor needed.

Changes

  • M4IIABWatchdog.broadcastLog: the ACTION_LOG_MESSAGE broadcast carried log text as an implicit broadcast (no setPackage), leaking it to any installed app and crashing on API 34+ for dynamic receivers. Now scoped to our own package — matching every other broadcast in the app (WatchdogService, IIABAdbManager), which already do this.
  • S3IIABAdbManager key spec: the ADB identity key was generated with ENCRYPT | DECRYPT and non-randomized encryption padding on top of SIGN | VERIFY. Verified that no Cipher uses this alias (the key only signs/verifies the ADB handshake), so the spec is now SIGN | VERIFY only (encryption paddings and setRandomizedEncryptionRequired(false) removed). Alias kept at v3 so existing devices are not forced to re-pair ADB — the change hardens newly generated keys.

Why no tests / no refactor

Both are framework-bound legacy line-fixes (Android KeyGenParameterSpec / Context broadcast) with no extractable pure logic, so there is nothing JVM-unit-testable to add. Verified by inspection + compile + the CI lint/test gate. A refactor would add risk for no benefit; the surrounding code is already small and clean.

Notes

Independent of PR #9 (S1) — touches different files. Docs: controller/docs/TECH_DEBT_PLAN.md progress log updated (M4, S3 done).

…(S3)

Two small Phase 1 security hardening fixes (no behaviour change for users).

- M4 (IIABWatchdog.broadcastLog): the ACTION_LOG_MESSAGE broadcast carried
  log text as an implicit broadcast (no setPackage), leaking it to any app and
  crashing on API 34+ for dynamic receivers. Scope it to our own package, like
  every other broadcast in the app already does.
- S3 (IIABAdbManager key spec): the ADB identity key was generated with
  ENCRYPT | DECRYPT and non-randomized encryption padding on top of SIGN |
  VERIFY. The key is only used to sign/verify the ADB handshake (no Cipher uses
  this alias), so restrict the spec to SIGN | VERIFY and drop the encryption
  paddings / setRandomizedEncryptionRequired(false). Alias kept at v3 so existing
  devices are not forced to re-pair (the change hardens newly generated keys).

No new tests: both are framework-bound legacy line-fixes with no extractable
pure logic; verified by inspection + compile + the CI lint/test gate.
@luisguzman-adfa luisguzman-adfa force-pushed the fix/phase1-security-m4-s3 branch from 3c079f4 to 969c78c Compare June 18, 2026 07:42
@luisguzman-adfa luisguzman-adfa merged commit ec1660f into main Jun 18, 2026
2 checks passed
@luisguzman-adfa luisguzman-adfa deleted the fix/phase1-security-m4-s3 branch June 18, 2026 08:47
luisguzman-adfa added a commit to luisguzman-adfa/iiab-android that referenced this pull request Jun 23, 2026
S3 (PR appdevforall#10) re-scoped the ADB identity key to SIGN|VERIFY only, on the
assumption that ENCRYPT|DECRYPT + the NONE/PKCS1 encryption paddings +
setRandomizedEncryptionRequired(false) were unused attack surface. That
assumption was wrong.

The ADB connection runs over TLS; the libadb (MuntashirAkon:libadb-android)
/ conscrypt handshake signs with this key via a raw RSA operation
(Cipher "RSA/ECB/NoPadding"), which REQUIRES PURPOSE_ENCRYPT plus
ENCRYPTION_PADDING_NONE (and PKCS1) and setRandomizedEncryptionRequired(false).
With the S3 key spec, a freshly generated key made the keystore reject the
handshake op with KeyStoreException "INCOMPATIBLE_PADDING_MODE", so every ADB
connection failed with an SSLHandshakeException (confirmed via logcat).

- Restore PURPOSE_SIGN|VERIFY|ENCRYPT|DECRYPT + setEncryptionPaddings(NONE, PKCS1)
  + setRandomizedEncryptionRequired(false) on the key spec.
- Bump KEY_ALIAS iiab_adb_key_v3 -> v4 so devices that already generated the
  broken SIGN|VERIFY-only v3 key regenerate a working one (one-time ADB re-pair).
- Add a comment marking these capabilities as required so they are not stripped
  again, and withdraw S3 from the tech-debt register (it was a misdiagnosis).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant