views:

333

answers:

12

I would like to add licensing system to application. For example: user buys license for 1 month and after that program expires (Kinda Anti-Virus style?).

Problem is that application is supposed to run in systems which may or may not be connected to internet, so how to protect from date-time changes?

Storing app startup and close times in encrypted file won't work as date can be changed (with program uptime of 8 hours per day, would be possible to extend license to almost 300% in ideal case - change time to app close time + 1 second before launching program).

Another question - is there any way to protect from software like http://en.wikipedia.org/wiki/Deep_Freeze_(software)? (maybe scan drivers?)

EDIT:
I'm currently using smart card to store licensing information and will use code virtualizer on critical functions (I know about making breakpoints on API calls and inspecting passed data - don't need to hide that data, just to ensure things go as planned)

+15  A: 

Yes, it would be possible to extend the license by up to 300% but at great effort to the user. Frankly if someone is going to spend every day of a month resetting their time to one second after they quit your program before starting it again to use it longer, there is nothing you are going to do about it, and the time you take to stop them will cost you more than they ever will.

Woody
Sure the program is expensive. Thus, buyers are one who know how to count money. Time is money. Specifically, their time is money, rather more and a lot more expensive than the license. Why do they spend their expensive time in such a vain?
sanmai
+2  A: 

I assume the software phones home at least once to let you know the license key has been bought / installed / extended?

After the time has ran out since they bought the license key and they haven't purchased another you could contact them and ask them how they are getting on and to let them know they need to renew. If they do choose to abuse your system a simple call to chat about it may be enough to get them to stop.

Toby
This might be an option
Im0rtality
Glad I could be of some help. I am not sure my solution would scale well due to the manual aspects of it but of course you could streamline the reporting.
Toby
+1  A: 

Maybe you could combine the use of the date/time with the tick count? Then if you see a date/time with an incompatible tick count, you could flag that as a violation. This would change your worst case scenario to require them to restart the machine whenever they want to manipulate the clock to abuse your license.

Mike
+2  A: 

Create a windows service that gets installed with your app, but is auto-start. Keep track of elapsed time and offsets there. Provide an API for your app to talk to the service to query usage/elapsed time.

Andrew Lewis
+1 for idea we didn't thought
Im0rtality
This might work, but if I found out that your app was installing autostart services on my machine just for licensing I would be mad and either have even more incentive to pirate it or switch to a competing solution.
Nathan
Can you give an example how would a service keep track of elapsed time? Modern CPUs change frequency/ticks with load and battery status, systems go into hibernation, and you cannot trust the system clock. How will your service tell time and not go adrift?
Remus Rusanu
+1  A: 

Step 1: Create trial_tracker entry in an encrypted format in a windows registry and in file.

Step 2: Assign app install timestamp ( yyyy-mm-dd-hh-mm-ss ) to trial_tracker

Whenever app starts, check if current system timestamp is greater than trial_tracker and less then expected expiry date

  • If yes, update trial_tracker to current system timestamp and continue.

  • If no, trial_tracker has been tampered or trial time expired. Ask user to purchase full version or exit.

Note: User can get away with this by deleting windows registry entry and encrypted file.( if he is able to find them ). In such case, further checks can be added. For example create secondary windows registry entry which checks for existence of primary registry and encrypted file.

Along with these, additional remote checks can be applied which depends on internet connection ( optional )

Harsha Hulageri
It's trivial to find registry entries added by a program with a hook on RegOpenKeyEx.
Clark Gaebel
Well, it might be possible to create that encrypted file during installation and checking file contents on each program start. If file is deleted tell user that he's not licensed to use it and exit. What would be weak points of this?
Im0rtality
The weak point would be the encryption: unless you make a requirement for Internet access during install (and you keep up an online service to encrypt licensing files), you'll have no key to encrypt the file with (more exactly you'll have no key the user cannot get to).
Remus Rusanu
What about generating key on the fly and hiding algorithm under Code Virtualizer?
Im0rtality
+1  A: 

You shall decrease the time elapsed between checks. Instead of checking only at application startup and application shutdown, you shall check every 5, 10 or 15 minutes using a timer or a background thread. In this way the user cannot change time (because the software will stops in few minutes).

However, I'd prefer to pay a software that I need instead of not having the correct date/time on my machine.

Luca
A: 

Create a Windows driver that starts on boot, grabs the system date-time, and runs until shutdown, tracking the time independently from Windows [ sleep(1000); ++time; ].

When your application starts up, check that the service is running, and check the date-time! Compare it to the date-time you were installed on, and you can figure out if you've expired or not.

Note: If any application did this, I wouldn't install it in the first place. If I WAS tasked with cracking it, it would be trivial. There is no way to prevent reverse engineering. NONE. It WILL get cracked no matter what. And when it does, you're going to regret putting any time into this.

Clark Gaebel
As a user, I don't really like any software which installs additional low level stuff - I can't really know what it does.So, in general, I shouldn't even pay attention to protecting my application, because every protection can be disabled?
Im0rtality
Rather than use a driver/service, the app could do that kind of manual time keeping in a worker thread instead, and see if the time gets out of sync with the system clock. Also, the OS issues WM_TIMECHANGE notifications whenever the clock is changed, so the app can look for those as well.
Remy Lebeau - TeamB
Same question that goes for Andrew Lewis goes here: how would a driver/service/thread know *how much time* has passed? `sleep(1000);++time;` would drift out of sync with a real clock in just a few minutes. In a day, you'd be off by hours.
Remus Rusanu
You could sync (if difference isn't too big) internal counter with system time value each... 10 secs?
Im0rtality
A: 

Enable Privilege Use logging (in the installation process) and then check for a time changed event in Windows' event log, as explained here:

http://www.stevebunting.org/udpd4n6/forensics/timechange.htm

You can then deduct the time difference from the license (rather than void the license, since some system clock changes are legitimate).

NOTE: This will not protect from changes of the system clock when changed from the BIOS.

Allon Guralnek
+4  A: 

Reputable game development manager stated once in a conference that it's impossible to protect software for longer than a month even with internet connection - if your software is popular :-) So you can just write software that no one wants and it will be as safe as you want :-)))

If on the other side you write reasonably popular software then you couldn't care less if a small percentage of paying customers snitch some extra time - they'll renew a week latter anyway. If you really want to do short time licensing you have to put internet as a pre-requisite. It's still going to be cracked in a month if it's good for something :-) but paying customers will by and large remain paying customers with reasonably light enforcement.

If however you piss people off by doing intrusive and scary things then you'll loose paying customers and create much bigger motivation for ppl to crack it.

ZXX
A: 

You are putting too much effort in the protection itself.

Instead your trial software should contains annoying limitations that will not prevent your users to evaluate it but will certainly prevent them from using it for business.

Pierre 303
A: 

Maybe you could offer this software as a service if you are so worried about enforcing the licence?

silvo
What exactly you mean?
Im0rtality
A: 

One way to do is to store the current time and date of software download in an encrypted file that should be used along with the package.

Another way is to store file in the user computer and keep checking with your hard coded date in the software with that file.

jason