Commit Graph
40 Commits
Author SHA1 Message Date
Dakkshesh ff980f59fc interceptors: keystore2: Handle missing keys error properly
Signed-off-by: Dakkshesh <beakthoven@gmail.com>
2025-09-04 12:35:17 +05:30
Dakkshesh 7d371dd766 Revert "java: Implement keystore clearing for target packages during initialization"
This reverts commit c285992226.

Signed-off-by: Dakkshesh <beakthoven@gmail.com>
2025-09-03 10:39:05 +05:30
Dakkshesh 77323fad91 Revert "java: config: Limit clear keystore workaround for few affected apps"
This reverts commit 2185237267.

Signed-off-by: Dakkshesh <beakthoven@gmail.com>
2025-09-03 10:37:53 +05:30
Dakkshesh 2185237267 java: config: Limit clear keystore workaround for few affected apps
- To avoid side affects caused to unwanted apps that are added to target.txt

Signed-off-by: Dakkshesh <beakthoven@gmail.com>
2025-09-03 10:03:32 +05:30
Dakkshesh 9701bd3978 java: config: Refactor waitAndGetSystemService()
- Make use of waitForService() for >= Android 11.
- Reserve manual polling for Android 10 due to lack of waitForService().
- Rework on logs to be less cluttering.

Signed-off-by: Dakkshesh <beakthoven@gmail.com>
2025-09-01 15:02:48 +05:30
Furkan KarcıoğluandGitHub 2fad7ff251 java: make getPM() wait for package manager service initialisation (#30) 2025-09-01 00:25:45 +05:30
Dakkshesh c285992226 java: Implement keystore clearing for target packages during initialization
- Currently using keystore2 API.
- TODO: Add support for keystore1.

Signed-off-by: Dakkshesh <beakthoven@gmail.com>
2025-08-31 20:48:52 +05:30
Dakkshesh 1e53ffeea0 java: config: guard linkToDeath() in getPm() against null binder to prevent NPE
fixes: https://github.com/beakthoven/TrickyStoreOSS/commit/23774e64a94c5cab08daa3ba2cec7a98db850cbd

logs:
08-30 15:46:05.226  1811  1811 E TrickyStoreOSS: fatal: failed to get packages
08-30 15:46:05.226  1811  1811 E TrickyStoreOSS: java.lang.NullPointerException: Attempt to invoke interface method 'void android.os.IBinder.linkToDeath(android.os.IBinder$DeathRecipient, int)' on a null object reference
08-30 15:46:05.226  1811  1811 E TrickyStoreOSS:        at qe.a(Unknown Source:13)
08-30 15:46:05.226  1811  1811 E TrickyStoreOSS:        at qe.c(Unknown Source:1)
08-30 15:46:05.226  1811  1811 E TrickyStoreOSS:        at io.github.beakthoven.TrickyStoreOSS.interceptors.SecurityLevelInterceptor.onPreTransact(Unknown Source:107)
08-30 15:46:05.226  1811  1811 E TrickyStoreOSS:        at io.github.beakthoven.TrickyStoreOSS.interceptors.BinderInterceptor.handlePreTransact(Unknown Source:50)
08-30 15:46:05.226  1811  1811 E TrickyStoreOSS:        at io.github.beakthoven.TrickyStoreOSS.interceptors.BinderInterceptor.onTransact(Unknown Source:21)
08-30 15:46:05.226  1811  1811 E TrickyStoreOSS:        at android.os.Binder.execTransactInternal(Binder.java:1392)
08-30 15:46:05.226  1811  1811 E TrickyStoreOSS:        at android.os.Binder.execTransact(Binder.java:1299)
08-30 15:46:05.226  1811  1811 E TrickyStoreOSS:        at android.os.BinderProxy.transactNative(Native Method)
08-30 15:46:05.226  1811  1811 E TrickyStoreOSS:        at android.os.BinderProxy.transact(BinderProxy.java:685)
08-30 15:46:05.226  1811  1811 E TrickyStoreOSS:        at android.system.keystore2.IKeystoreSecurityLevel$Stub$Proxy.generateKey(IKeystoreSecurityLevel.java:307)
08-30 15:46:05.226  1811  1811 E TrickyStoreOSS:        at android.security.KeyStoreSecurityLevel.lambda$generateKey$0(KeyStoreSecurityLevel.java:145)
08-30 15:46:05.226  1811  1811 E TrickyStoreOSS:        at android.security.KeyStoreSecurityLevel.$r8$lambda$XUH2FEW76sslYQDkYWi9Fg4yVEI(Unknown Source:0)
08-30 15:46:05.226  1811  1811 E TrickyStoreOSS:        at android.security.KeyStoreSecurityLevel$$ExternalSyntheticLambda1.execute(Unknown Source:12)
08-30 15:46:05.226  1811  1811 E TrickyStoreOSS:        at android.security.KeyStoreSecurityLevel.handleExceptions(KeyStoreSecurityLevel.java:55)
08-30 15:46:05.226  1811  1811 E TrickyStoreOSS:        at android.security.KeyStoreSecurityLevel.generateKey(KeyStoreSecurityLevel.java:145)
08-30 15:46:05.226  1811  1811 E TrickyStoreOSS:        at android.security.keystore2.AndroidKeyStoreKeyPairGeneratorSpi.generateKeyPair(AndroidKeyStoreKeyPairGeneratorSpi.java:651)
08-30 15:46:05.226  1811  1811 E TrickyStoreOSS:        at java.security.KeyPairGenerator$Delegate.generateKeyPair(KeyPairGenerator.java:750)
08-30 15:46:05.226  1811  1811 E TrickyStoreOSS:        at W.a(Unknown Source:497)
08-30 15:46:05.226  1811  1811 E TrickyStoreOSS:        at vi.a(Unknown Source:20)
08-30 15:46:05.226  1811  1811 E TrickyStoreOSS:        at io.github.beakthoven.TrickyStoreOSS.MainKt.a(Unknown Source:175)
08-30 15:46:05.226  1811  1811 E TrickyStoreOSS:        at io.github.beakthoven.TrickyStoreOSS.MainKt.main(Unknown Source:15)
08-30 15:46:05.226  1811  1811 E TrickyStoreOSS:        at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
08-30 15:46:05.226  1811  1811 E TrickyStoreOSS:        at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:379)

Signed-off-by: Dakkshesh <beakthoven@gmail.com>
2025-08-30 19:12:14 +05:30
Dakkshesh 808c3a5ff9 app: java: Restructure and tidy up the code
Signed-off-by: Dakkshesh <beakthoven@gmail.com>
2025-08-30 16:02:34 +05:30
JingMatrixandGitHub 23774e64a9 app: config: Use linkToDeath for PackageManager resilience (#29)
The previous implementation used `pingBinder()` to check the liveness of the PackageManager service on every call to `getPm()`. This polling approach introduces an unnecessary IPC round-trip overhead for every access.

This commit refactors the logic to use the canonical, event-driven pattern for handling remote service death by implementing `linkToDeath`.

A `DeathRecipient` is now registered with the binder upon the first connection. If the service process (`system_server`) dies for any reason, the `binderDied()` callback is automatically invoked by the system. This callback proactively clears the cached service instance, ensuring that the next call to `getPm()` will transparently re-establish a valid connection.
2025-08-29 21:56:33 +05:30
rhunkandGitHub bcb4531904 app: Fix DeadObjectException in IPackageManager access (#27) 2025-08-28 19:30:08 +05:30
Dakkshesh d762663192 java: Overhaul detection of attestation properties
- Reuse and extend the attestation we perform for detection of functional TEE.
- Extract properties like boot hash, os version, attest version, keymaster version from the generated certificate.
- Use previous methods as fallback for devices without functional TEE.
- Set ro.boot.vbmeta.digest during initialization with the boot hash value.

Signed-off-by: Dakkshesh <beakthoven@gmail.com>
2025-08-19 19:33:27 +05:30
Dakkshesh 088e9ff1b0 java: Stop using dev.rikka.hidden.stub
- We dont need the whole dev.rikka.hidden.stub library so just remove it and simplify dependencies.
- We already have our own stub package so we can just include the missing stubs that we want directly in it.

Signed-off-by: Dakkshesh <beakthoven@gmail.com>
2025-08-17 23:15:44 +05:30
Nicholas BissellandGitHub 095b32554b java: CertHack: Honour StrongBox security level when requested in generate mode (#20) 2025-08-17 12:29:09 +05:30
Dakkshesh 6517fd2569 java: CertHacker: Pass imei2 field correctly
- It was being passed with the wrong tag ID
- Only pass it if attestVersion is >= 300

ref: https://source.android.com/docs/security/features/keystore/attestation#authorizationlist-fields

Signed-off-by: Dakkshesh <beakthoven@gmail.com>
2025-08-13 12:26:25 +05:30
Dakkshesh 10c1a41981 java: CertHacker: Handle attest and keymaster version gracefully
Signed-off-by: Dakkshesh <beakthoven@gmail.com>
2025-08-13 12:06:24 +05:30
Dakkshesh a33069b481 java: CertHack: Dont append moduleHash for < Android 12
- To avoid "Unknown tag 724" error on older platfoms like Android 10/11
- Conditionally downgrade keymaster versions to 3.0 on these platforms

Signed-off-by: Dakkshesh <beakthoven@gmail.com>
2025-08-11 20:33:37 +05:30
Dakkshesh eaa017be86 cpp: RefBase: Dont use incWeakRequireWeak()
- Fixes the following on older android 10/11 platforms:
08-11 14:53:05.143  1388  1388 I TrickyStoreOSS: TrickyStore injector starting...
08-11 14:53:05.144  1388  1388 I TrickyStoreOSS: Starting injection of /data/adb/modules/tricky_store/libTrickyStoreOSS.so (entry: entry) into process 1024
08-11 14:53:05.151   587   587 I Zygote  : Preloading shared libraries...
08-11 14:53:05.155  1026  1053 I ServiceManager: Waiting for service 'package_native' on '/dev/binder'...
08-11 14:53:05.155  1388  1388 W TrickyStoreOSS: Primary dlopen failed for library: /data/adb/modules/tricky_store/libTrickyStoreOSS.so, dlerror: dlopen failed: cannot locate symbol "_ZN7android7RefBase12weakref_type18incWeakRequireWeakEPKv" referenced by "/data/adb/modules/tricky_store/libTrickyStoreOSS.so"..., trying fallback
08-11 14:53:05.155  1388  1388 I TrickyStoreOSS: Using fallback dlopen method for compatibility
08-11 14:53:05.158  1388  1388 E TrickyStoreOSS: Fallback dlopen failed for library: /data/adb/modules/tricky_store/libTrickyStoreOSS.so, dlerror: dlopen failed: cannot locate symbol "_ZN7android7RefBase12weakref_type18incWeakRequireWeakEPKv" referenced by "/data/adb/modules/tricky_store/libTrickyStoreOSS.so"...
08-11 14:53:05.158  1388  1388 E TrickyStoreOSS: Failed to load library in remote process
08-11 14:53:05.158  1388  1388 E TrickyStoreOSS: Injection failed

- Also improve error handling in injection process

Signed-off-by: Dakkshesh <beakthoven@gmail.com>
2025-08-11 20:33:37 +05:30
Dakkshesh 60bf475d48 app: Bump version to 2.1.0
Signed-off-by: Dakkshesh <dakkshesh5@gmail.com>
2025-08-11 16:21:59 +05:30
Dakkshesh f723e53e2b java: CertHacker: Sanitize the XML data before passing to XML parser
- Remove whitespaces
- Remove Byte Order Mark (BOM)

Fixes #12

Signed-off-by: Dakkshesh <beakthoven@gmail.com>
2025-08-10 09:39:32 +05:30
Dakkshesh ef87d5dddf java: CertificateHacker: Handle getPackageInfo() correctly
Fixes #11

Signed-off-by: Dakkshesh <beakthoven@gmail.com>
2025-08-10 00:13:10 +05:30
Dakkshesh 67f7fa061f java: CertificiateHacker: Refactor and tidy up a bit
- Removed unused boilerplate from initial bring up
- Inlined some functions which were fragmented due to some initial plans that were dropped
- Moved appropriate functions to CertificateUtils
- Tidy up some function and variable names

Signed-off-by: Dakkshesh <beakthoven@gmail.com>
2025-08-07 22:47:12 +05:30
Dakkshesh 64a998000a cpp: Switch to C++23 standard
- Our codebase is written well to support this.
- LSPlt will continue to use c++20 via its cmake logic.

Signed-off-by: Dakkshesh <beakthoven@gmail.com>
2025-08-07 16:49:42 +05:30
Dakkshesh 52e8056b90 cpp: Move LSPlt configuration to gradle script
Otherwise for some reason it fails to set the vars in CI builds.

Signed-off-by: Dakkshesh <beakthoven@gmail.com>
2025-08-07 16:24:42 +05:30
Dakkshesh f2c0ed7beb cpp: LSPlt: Disable building shared lib
We dont need it. This also fixes some build errors when `DEBUG_SYMBOLS_PATH` is undefined.

Signed-off-by: Dakkshesh <beakthoven@gmail.com>
2025-08-07 16:03:09 +05:30
Dakkshesh 9ed495df6d cpp: use LSPlt's own CMake build logic
Signed-off-by: Dakkshesh <beakthoven@gmail.com>
2025-08-07 15:41:38 +05:30
Dakkshesh 289f10cb47 cpp: Update LSPlt submodule
Signed-off-by: Dakkshesh <beakthoven@gmail.com>
2025-08-07 15:41:07 +05:30
Dakkshesh 54c798b380 cpp: stub: Format using clang-format
Somehow this was missed out during initial formatting.

Signed-off-by: Dakkshesh <beakthoven@gmail.com>
2025-08-07 11:41:27 +05:30
Dakkshesh bba2281241 config: remove hardcoded generatePackages entries
- This is a leftover from initial bring up when target.txt parsing wasn't implemented.
- Not needed now because we have auto mode.

Signed-off-by: Dakkshesh <beakthoven@gmail.com>
2025-08-07 11:33:37 +05:30
Dakkshesh 435a79ed64 src: Correct log tag
Signed-off-by: Dakkshesh <beakthoven@gmail.com>
2025-08-06 21:06:03 +05:30
Dakkshesh c5b82ef67d src: dos2unix
Signed-off-by: Dakkshesh <beakthoven@gmail.com>
2025-08-06 21:01:18 +05:30
Dakkshesh e46820275f src: Add module files
Signed-off-by: Dakkshesh <beakthoven@gmail.com>
2025-08-06 19:46:42 +05:30
Dakkshesh 87bb7b2df1 cpp: external: Clean AOSP headers and resolve missing dependencies
- To solve some dependency issues by removing redundant code.
- Added missing headers

Signed-off-by: Dakkshesh <beakthoven@gmail.com>
2025-08-06 17:50:34 +05:30
Dakkshesh 4898f0efc2 src: cpp: Import binder uapi header from linux kernel
tag: v6.16

Signed-off-by: Dakkshesh <beakthoven@gmail.com>
2025-08-06 17:49:37 +05:30
Dakkshesh 2a0f54e336 src: cpp: Pull required headers from AOSP
tag: android-16.0.0_r1

Signed-off-by: Dakkshesh <beakthoven@gmail.com>
2025-08-06 17:48:38 +05:30
Dakkshesh 8ed149154f src: cpp: Add LSPlt submodule
Signed-off-by: Dakkshesh <beakthoven@gmail.com>
2025-08-04 14:11:24 +05:30
Dakkshesh 205f939deb build: Update relavant tools
Signed-off-by: Dakkshesh <beakthoven@gmail.com>
2025-08-04 14:07:41 +05:30
Dakkshesh 9549296d69 src: Initialize gplv3 license
Signed-off-by: Dakkshesh <beakthoven@gmail.com>
2025-08-04 14:01:31 +05:30
Dakkshesh 30e25f461a src: Clean up
Signed-off-by: Dakkshesh <beakthoven@gmail.com>
2025-08-04 13:37:26 +05:30
Dakkshesh 9eb151eb07 Initialize a native project
Signed-off-by: Dakkshesh <beakthoven@gmail.com>
2025-08-04 09:38:02 +05:30