flutter_anti_virtuals 0.4.0
flutter_anti_virtuals: ^0.4.0 copied to clipboard
Detects VPNs, proxies, mock location, virtual cameras, root, hooks and emulators on Android and iOS, with basic checks on desktop and the web.
0.4.0 #
AntiVirtualGuardandAntiVirtualMonitorhave ascanTimeout, 10 seconds by default. A scan that takes longer counts as a failed scan with aTimeoutException, so a check that hangs no longer keeps the app on the loading screen: it is let through, or blocked withfailClosed. Passnullfor the previous behavior.- Android: every check has 3 seconds and a scan 8 seconds in total. A check
that runs out of time is reported as failed instead of holding up the scan
and the
verify()andrebindDevice()calls behind it. - Fix:
AntiVirtualMonitor.rescan()andAntiVirtualGuard.rescan(context)returned at once when a scan was already running, before the result was in. The future now completes with the scan that runs after it, so the state afterawait monitor.rescan()is up to date. - Fix: an open port 27042 alone no longer reports
hooked(Android and iOS). Any app may listen there. The port is still reported next to other hooking evidence. doc/server-verification.md: only the leaf of a key attestation chain may carry the attestation, and a server has to decide which signals it insists on.anti_virtuals_verifier0.3.0 fixes a forged chain it accepted.- The repository has a security policy,
SECURITY.md.
0.3.0 #
- Four new signals.
activeCallfires while a phone or VoIP call is in progress (Android audio mode, iOS CallKit), and on Android 12+ a call starting or ending emits onenvironmentChanges.noScreenLockfires on a device without a PIN, pattern, password or passcode.appDataMigratedfires when the app's data was restored from a backup or moved from another device;FlutterAntiVirtuals.instance.rebindDevice()accepts it again.automation(Android and web) reports the monkey tester, test harness mode, a connected UiAutomation, installed automation tools, WebDriver and headless Chrome. None of them blocks by default. FlutterAntiVirtuals.instance.screenshotsemits after the user takes a screenshot (Android 14+, iOS). Android declares theDETECT_SCREEN_CAPTUREpermission for it, granted at install.showPlayIntegrityDialog()shows Google Play's remediation dialogs (PlayIntegrityDialog: get the app from Play, close risky apps, fix device integrity) for the last token of the session. The Play Integrity library is now 1.5.0.- iOS:
signatureMismatchchecks the team ID that signed the app against the newScanOptions.expectedTeamIds, and reports an App Store build whose binary is no longer encrypted. - iOS:
AttestationOptions(deviceCheck: true)adds a DeviceCheck token (PlatformAttestation.deviceCheckToken) for Apple's per-device two bits. - macOS, Windows and Linux now check
vpn,proxy,debugger,emulator(a virtual machine) andclockTamperingagainst atrustedTime, and the web checksautomationandclockTampering. A guard on these platforms can now block: one with the defaultblockOnblocks a desktop app behind a VPN or proxy, as it does on Android and iOS. On the web,forceExitkeeps the blocking screen up instead of throwing. - README: a platform support table for every platform, and sections on the fraud context checks, screenshot events and the desktop and web checks.
0.2.0 #
AntiVirtualMonitorruns the guard's scans and blocking decision without a widget. It is aValueListenable<GuardState>(GuardScanning,GuardAllowed,GuardBlocked) with areportsstream, for state management layers and for gating single actions.AntiVirtualGuardis now built on it and exposes it withAntiVirtualGuard.monitorOf(context).- The built-in blocked screen has a Try again button (
showRetry, translated in all four languages), and a custom screen can callAntiVirtualGuard.rescan(context). - Web, macOS, Windows and Linux are registered platforms. Every check reports
unsupported there instead of throwing
MissingPluginException, and the guard compiles for the web. - Play Integrity standard requests:
AttestationOptions(playIntegrity: PlayIntegrityRequest.standard)andFlutterAntiVirtuals.instance.preparePlayIntegrity(). The token binds the payload throughrequestHash, and the attestation JSON hasstandard: true. Classic requests stay the default. - Android:
mockLocationreports the app selected as mock location app in the developer options as an active detection. - The signed payload marks a detection that rests only on an installed tool
with
"installedOnly": true. - New
anti_virtuals_verifierpackage (inpackages/) that checks signed reports on a Dart server: nonce, age, signature, Android key attestation, Play Integrity verdicts and a signal policy. - CI runs the integration tests on an Android emulator and the iOS Simulator.
- The README is reorganized.
- Failed checks are no longer clean. A native check that throws, a signal
the native side leaves out and a
nullscan reply used to read as "not detected". Now a failed check isSignalResult.failed(witherror),report.failedlists them,report.isCleanis false while any check failed, anullreply throwsPlatformException(no_result), and the signed payload marks it with"failed": true.AntiVirtualGuard(failClosed: true)blocks when the check of a blocking signal fails. - Fix:
untrustedInstallercould be spoofed withadb install -i com.android.vending. On Android 11+ an install whose initiating package (which the caller cannot choose) is the shell is reported even when the claimed installer is trusted. - Fix: screen protection no longer clears window flags the app set itself
(Android only undoes what the plugin set), and requests from several guards
and
protectScreen()are combined instead of switching each other off. mockLocationandvirtualCamerareport installed tools separately (SignalResult.installedApps,onlyInstalledApps). The guard no longer blocks when an installed but unused tool is the only evidence; passblockOnInstalledApps: truefor the previous behavior.- iOS: the privacy manifest is now bundled (CocoaPods and SwiftPM) and
declares the
UserDefaultsAPI. The App Attest key id moved to the Keychain (this device only), a key App Attest no longer accepts is replaced by a new enrollment automatically, and attestation requests run one at a time. - iOS: capture state is read from the app's window scene instead of the
deprecated
UIScreen.main. The stale Swift unit test was replaced with real tests, which CI now runs on the Simulator. verify()throwsUnsupportedErroron platforms other than Android and iOS instead of labelling themandroid.SignalResultcompares by value and hastoJson().- Android: the Xposed class check also asks the system class loader, and the
getpropfallback no longer leaks its process.
0.1.0 #
- Docs: README sections for using
scan()directly and for the guard, a rewritten Limits section that reflects the checks that now exist (root, hooks, debugger, emulator, screen capture) and the limits that remain, and two new runnable examples (scan_example.dart,guard_example.dart). - Android file checks (root, hooking and emulator files) now look through two
layers:
java.io.Fileand a directOs.statsystem call. A path found by either counts, and a path only the kernel finds is reported byhookedasfile API hides <path>, which catches root-hiding modules and Frida scripts that patch the file API. Newdoc/hardening.mdcovers obfuscation and what the checks cannot stop. verify(attestation: AttestationOptions(...))also requests a Play Integrity token (Android, classic request, newcom.google.android.play:integritydependency) or an App Attest attestation / assertion (iOS) whose nonce or client data hash is the SHA-256 of the signed payload, returned inSignedReport.attestation. A failed request throws.FlutterAntiVirtuals.instance.verify(nonce: ...)returns aSignedReport: a scan bound to a backend-issued nonce and signed with a key created on the device for that request (Android Keystore EC key attested with the SHA-256 of the nonce as challenge, StrongBox then TEE, falling back to no attestation; iOS Secure Enclave key, software on the Simulator).toJson()is what to send to the backend;doc/server-verification.mdlists what it must check.- Screen protection.
FlutterAntiVirtuals.instance.protectScreen()/unprotectScreen()andAntiVirtualGuard(protectScreen: ...): Android setsFLAG_SECURE(no screenshots, recording or casting, blank recents thumbnail), ignores touches through overlay windows and hides overlay windows on Android 12+; iOS, which cannot block capture, covers the app with a blur while it is recorded, mirrored or in the app switcher. NewscreenCapturesignal (checkScreenCapture, on by default, not blocking by default): external and wireless displays, screen recording on Android 15+, iOSisCaptured. Display and capture changes also trigger the guard's live rescan. The Android manifest declaresHIDE_OVERLAY_WINDOWSandDETECT_SCREEN_RECORDING(normal permissions). - New
hookedanddebuggersignals (checkHooked,checkDebugger, on by default, not blocking by default).hooked: Frida and Xposed/LSPosed/ EdXposed/Substrate libraries in the process, Frida threads, hooking classes, managers and files, a hooked plugin method (framework frames in its own call stack) and the default Frida server port (Android); injected libraries, hooking classes,DYLD_INSERT_LIBRARIESand the Frida port (iOS).debugger: a Java debugger,TracerPid(Android),P_TRACED(iOS). - New
rootedsignal (ScanOptions.checkRooted, on by default) for Android root and iOS jailbreak. Android: one strong indicator (su/Magisk binaries inPATHand the usual directories, root manager and root-hiding apps, root tool files, a writable/system,/vendoror/product,adbdas root,ro.secure=0, permissive SELinux, Magisk/KernelSU/APatch mounts) or two weak ones (a debug build of the system plus an unlocked bootloader). iOS: Cydia, Sileo, Zebra and other jailbreak files (including rootless/var/jb), writing outside the sandbox, injected tweak libraries andDYLD_INSERT_LIBRARIES. Localized for the guard's default screen; not indefaultBlockingSignals. - New
emulatorsignal (ScanOptions.checkEmulator, on by default): Android emulators (Android Studio, Genymotion, BlueStacks, Nox, LDPlayer, MEmu, ...) from qemu properties, emulator hardware, files, apps and sensors, needing one strong or two weak indicators so real devices are not reported; the iOS Simulator from the build target,SIMULATOR_*variables and the hardware model. Localized for the guard's default screen; not indefaultBlockingSignals. ScanOptionsnow has onecheck*boolean per signal (all on by default) instead of asignalsset, and asserts that configured checks receive their configuration (expectedSignatureSha256,trustedInstallers).ScanOptionsis no longerconst;copyWithwas replaced byonlyChecking.- Added
AntiVirtualGuard: scans at startup and on resume, blocks the app with a localized default screen (en, ar, fr, es) or a custom builder, and can force-exit after a configurable delay (default 5 seconds, off by default). - Guard: the app is not built before the first clean scan, blocked apps lose focus and animations, the force-exit countdown pauses in the background, rescans only follow a real background trip, and a failed rescan fails open.
- Guard:
ScanOptionscompares by value (no rescan on every parent rebuild); a failed rescan keeps the last result; newfailClosed,rescanDebounce,rescanInterval,unmountWhileBlockedandhardExitoptions; the countdown restarts after a background trip even without a rescan;copyWithkeepstextDirection; the screen follows device locale changes. - Guard:
unmountWhileBlockedistrueby default, so a blocked app cannot be reached with the back button; passfalseto keep it mounted and keep state. - Live detection:
FlutterAntiVirtuals.environmentChangesemits when a VPN or proxy may have been switched on or off (AndroidConnectivityManagercallbacks, iOSNWPathMonitor), andAntiVirtualGuardrescans on it (liveMonitoring,liveDebounce). - Live detection review fixes:
environmentChangesis one shared stream (a second listener no longer breaks the first), a missing native side is quiet, a change in the background is scanned on resume even withoutrescanOnResume, bursts are capped atliveDebouncex 4, watcher failures are labelled as such and retried, Android keeps network state from the callback arguments instead of querying on every update, iOS emits on every path update, ignores updates from a cancelled monitor and tears down on engine detach. - Fix: Android now reports a proxy set globally (for example with
adb shell settings put global http_proxy) throughenvironmentChanges. The settings observer it relied on does not fire when the value is set, so the watcher also listens to the system's proxy-change broadcast. - Fix: Android
mockLocationignores mock fixes older than two minutes. The last fix of a provider is cached, so a mock location that had been switched off kept the device flagged (and the app blocked) for several minutes.
0.0.1 #
- Initial release: scan API with VPN, proxy, mock location, virtual camera, developer options, ADB, clock, installer, signature, accessibility, remote control, clone, user CA and sideload signals.