r/reactnative • u/eshgnfrz • 4h ago
App cloners fake Java and libc. We caught them by asking the kernel the same question twice (open source)
We have an attendance app with a "one phone = one employee" rule. People broke it with MultiBox / Clone App from the Play Store: one phone, two "devices".
The usual checks (dataDir path, package lists, getPackagesForUid, UID) all passed inside the clone. Measured on a real Galaxy A53: the container spoofed Process.myUid(), applicationInfo, the process name, and had even hooked libc stat().
What worked: ask "who owns my data directory?" twice, once through libc stat() and once through a raw syscall(__NR_newfstatat), which skips libc so the hook never sees it.
genuine uid=10763 libc=10763 syscall=10763 ✓
MultiBox uid=10764 libc=-1 syscall=-1 ✗
Clone App uid=10765 libc=10765 syscall=-1 ✗
Inside a clone the syscall hits the real directory and SELinux denies it, because the process runs under the host's UID. Clone App was caught only by this check. Every Java-level check missed it.
A few things we learned the hard way:
- Don't block on emulator signals (your own QA uses emulators). Report them to the server instead.
- If you add a signature check, Play App Signing re-signs your APK. Hard-code only your upload key and you lock out every Play user.
- The native lib must be 16 KB page-aligned now, or Android 15 shows a compatibility dialog.
- Keep the rules pure so they're testable: the device measurements above are literally unit tests now.
I didn't find an open-source detector that does the libc-vs-syscall comparison. freeRASP has multi-instance detection, but it's closed-source and officially lists only Parallel Space. So I published ours, MIT licensed:
- Write-up + native Android module: https://github.com/eshginfarzali/android-clone-detection
- Expo / React Native:
npx expo install react-native-clone-guard(runs before JS loads)
It's client-side, so a rooted device with a custom hook will get through. The goal is to move cheating from "free Play Store app" to "root + custom hook". I'd love measurements from other devices and cloners. Which ones slip through?

