views:

34

answers:

2

I have an application that connect to my website to verify user data (hardware id), but if somebody puts a line in the windows hosts file, it could be relayed to another site. Then it gets bad data and my app gets cheated (cracked).

So, how to detect if my website is relayed through the hosts file or another application?

+2  A: 

Could you cryptograhpically sign the data (perhaps salted per client)? The client can have the public key, and you can use that (safely) to prove that the data came from your server.

Marc Gravell
No, if it can't connect the site, it shows a error. If the data isn't exactly the string: "11" it runs the application in full mode. So a guy just relayed my webpage to google.com and my app thinks it's bad homepage (thinks my homepage is hacked)
blez
+1  A: 

Use SSL and refuse to operate with an invalid client certificate. That way a request faked through hosts (or any other way to redirect where you connect to) won't pass, a proxy can't see it, and a proxy playing man-in-the-middle with the certificate won't be accepted (think of how when you use Fiddler to debug HTTPS traffic you get the "do you trust" message on your browser; your application will be doing the equivalent of saying "no, I don't").

Jon Hanna
Isn't that hard to do in C#? Can you point some article for that
blez
Actually, it's harder to get `HttpWebRequest` to ignore SSL errors with HTTPS requests, as the default is to choke on them. http://www.west-wind.com/weblog/posts/48909.aspx deals with how to do use `ServicePointManager.CertificatePolicy` to do that (note that `ServicePointManager.CertificatePolicy` is now obsolete, see http://codebetter.com/blogs/rodpaddock/archive/2006/05/06/144181.aspx (near the end) on the new `ServicePointManager.ServerCertificateValidationCallback` but in VB), which by extension will give pointers on how to be sure you are as locked down as you want.
Jon Hanna