Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How should I code to resist "one-click piracy"?

The app I am working on is automatically cracked by antiLVL (although I am not using the LVL in my app).

In order of protecting my app from "one-click piracy", I am implementing tampering detection techniques explained at Google IO.

I have tried checking the signature both with getPackageInfo() and reflection (invoke()), but AntiLVL was able to crack the app automatically in both cases.

How can I write code that will not be automatically cracked by the current version of antiLVL (1.4.0)? I mean, apart from using JNI.

PS: I am not talking about preventing piracy in general. I just want the pirate to dig into the code by hand rather than using an automatic cracker.

like image 373
tos Avatar asked Feb 29 '12 11:02

tos


1 Answers

The problem is, any API that only serves to check the validity of your application can be subverted and replaced with a version that always returns the result you expect. I haven't looked at Anti-LVL in detail, but I would imagine it is doing this, which is why your attempts to verify your code using Dalvik's built-in APIs for this purpose are failing.

In order to make it work, you'll have to do the work yourself, using only APIs that have multiple purposes and cannot be so easily subverted.

One way of doing it is to calculate a checksum of either your .apk file or just the classes.dex file inside it, and verify it against some external resource (online server with list of known correct versions, file downloaded to SD card on first execution, etc, resource in the .apk file that isn't included in classes.dex). This prevents code modification, which I believe is how anti-LVL works. I haven't tried this myself, but suspect it should work.

like image 85
Jules Avatar answered Oct 05 '22 20:10

Jules