Take the 2-minute tour ×
Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. It's 100% free, no registration required.

I want a script that is running on the client to compute a collision resistant hash and send it to a server. I need to ensure that the script which performs this hash is not altered in any malicious way. Is there any protocol that exists which can ensure that the client script that calculates the hash has not been altered.

I have an idea whereby the script sends back an HMAC signature of itself, but on second thoughts, this would not stop an attacker from fooling the server if the code is altered.

share|improve this question
7  
Impossible. It's just another variant of the DRM problem, where you don't trust the computer you're running on. Best you can do is throwing lots of obfuscation at it, and then pray that nobody bothers to break it. –  CodesInChaos Dec 2 '12 at 8:42
    
Do you assume attacker is on channel or a client can be attacker too? In first case you can use something like SSL to protect the channel. –  Pavel Ognev Dec 3 '12 at 6:38
add comment

1 Answer

up vote 2 down vote accepted

In short any proposed solution to this problem would be a violation of CWE-602: Client Side Enforcement of Server Side Security.

Even if what you are suggesting where possible in some bizzaro universe it would be insecure. A client (or an attacker) doesn't just execute scripts, they are able to view and modify everything in memory, as well as intercept, modify and create any request transmitted over the network. Thus checking the integrity of the script doesn't even close to solving the root of the problem. In short this proposal is a fundamental violation of modern security and there never will be a solution to this problem. (And no one should need to do this)

share|improve this answer
    
Thanks for the answer. I knew this to be so, but I thought it could have been otherwise. Actually, an interesting project would be to make a environment whereby trusted sources could upload code that would run and guarantee that no client tampering would take place. But this would be a big project... –  Barry Steyn Dec 5 '12 at 19:09
    
@Barry Steyn Well people try, look at the xbox... and look at all of the pirated games for the xbox. –  Rook Dec 5 '12 at 19:10
    
Yeah, and look what happened to Sony Play Station as well :) Still, I think it would be an interesting academic project... –  Barry Steyn Dec 5 '12 at 19:13
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.