Skip to content

Commit ef69f47

Browse files
errorcodeQQerrorcodeQQ
authored andcommitted
feat: Aggressive watchdog tamper detection crashes app immediately
1 parent 59cad33 commit ef69f47

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

CSGuard/src/main/kotlin/com/csguard/ProviderSanitizer.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,13 @@ object ProviderSanitizer {
2727
sanitizeAllProviders()
2828

2929
if (policy.watchdogEnabled && !InstrumentationHook.isHookIntact()) {
30-
Log.w(TAG, "Watchdog detected unhooked Instrumentation! Re-installing...")
31-
InstrumentationHook.install { policy }
30+
Log.e(TAG, "FATAL: Watchdog detected unhooked Instrumentation! A malicious plugin is actively trying to disable CSGuard.")
31+
throw RuntimeException("CSGuard SECURITY BREACH: Unauthorized tampering with Instrumentation hook detected. Terminating application immediately to protect user data.")
3232
}
3333
} catch (t: Throwable) {
34+
if (t.message?.contains("SECURITY BREACH") == true) {
35+
throw t // Force fatal crash
36+
}
3437
Log.e(TAG, "Sanitizer poll failed", t)
3538
}
3639
if (running) {

0 commit comments

Comments
 (0)