• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Verifying Methods

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there any way of obtaining a checksum of a method? I've serialized a class and written it to a string (using the checksum of that string as an indication of purity), but it seems that it only includes method signatures, not any indication of whether the content of the methods is clean. Any way of getting hold of any property that would change if the code inside a method changed, or of serializing a Method object, would do nicely.

Thanks in advance,
Chris (Who's the other "Chris Robinson" around here?)
 
Ranch Hand
Posts: 1923
Scala Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You want to make something like an md5sum of a compiled method?
You could read the class-File and check that, or decompile it first, and then check.

What if the method is calling another method - do you need to check that recursively?
 
Ranch Hand
Posts: 961
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What about this way?



Regards,
Edwin Dalorzo
 
Christopher Robinson
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

You want to make something like an md5sum of a compiled method?

Loosely, yes. The object in memory is what needs to be checked, though, not the object as it's stored on the hard disk.

You could read the class-File and check that, or decompile it first, and then check.

Unfortunately, the aim is to ensure that a certain server-side script is being accessed by a clean, untampered applet. Thus, if I don't have a check on the object in memory, all other checks could be rendered useless.

What if the method is calling another method - do you need to check that recursively?

No, just the once.

Edwin: I need to check the methods themselves, not just their signatures. I have that already, by checking the Class object.

I may be barking up completely the wrong tree here; there may be a very easy way to do this. I don't know.
 
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


I may be barking up completely the wrong tree here; there may be a very easy way to do this. I don't know.


If a MITM were to modify your method, and subsequently provide a hash that verifies the method, what then? If you are trying to prevent a MITM attack, you need to use PKI with public key verification (e.g. a verified CA public key agreed at both ends). One such implementation is SSL.
 
Christopher Robinson
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
MITM attacks were something I hadn't even considered, and I don't think I will; I doubt anyone would go to that much trouble to tamper the data. No, I'm more concerned about someone simply sending data to the server-side script; I want to ensure that the data comes from this applet, and that the applet itself hasn't been tampered with in any way.
 
Stefan Wagner
Ranch Hand
Posts: 1923
Scala Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Unfortunately, the aim is to ensure that a certain server-side script is being accessed by a clean, untampered applet. Thus, if I don't have a check on the object in memory, all other checks could be rendered useless.


The bytecode of an method of an applet, which is running on the client, shall be verified by the server?
 
Christopher Robinson
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Close enough, yes.
 
Tony Morris
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Christopher Robinson:
MITM attacks were something I hadn't even considered, and I don't think I will; I doubt anyone would go to that much trouble to tamper the data. No, I'm more concerned about someone simply sending data to the server-side script; I want to ensure that the data comes from this applet, and that the applet itself hasn't been tampered with in any way.



This seems to be a contradction. You don't care about a MITM attack, but you care if a MITM tampers with your applet? You will require an agreed public key of a CA at either end with asymmetric encryption i.e. SSL, or it's completely circumventable.
[ April 17, 2006: Message edited by: Tony Morris ]
 
Christopher Robinson
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a CGI script on the server which will save some data to a database. However, I want to ensure that this data originates with the applet, and not just someone telnetting in and submitting a POST request. I also want to ensure that the applet itself (not the data; I do recognize the need for protecting this too, but that's a topic for another question) has not been tampered with (I.E. decompiled and edited).
 
Tony Morris
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Christopher Robinson:
I have a CGI script on the server which will save some data to a database. However, I want to ensure that this data originates with the applet, and not just someone telnetting in and submitting a POST request. I also want to ensure that the applet itself (not the data; I do recognize the need for protecting this too, but that's a topic for another question) has not been tampered with (I.E. decompiled and edited).



To be honest, I think you might be severely under-estimating the complexity of the problem that you have at hand. I won't even begin to start enumerating the summary of issues that you will run into here - even if you did use a proper PKI setup.

There are lots of "people" (read: corporations, power mongers, etc.) trying to solve this problem. You might start by learning what "trusted computing" is and how it attempts to solve the problem - or more importantly, that everything else known is (at least theoretically) circumventable. I have seen applications that "obfuscate" a private key throughout the machine code so that it is only discernable to the application itself, or with unreasonable effort on the behalf of the malicious attacker.
 
Christopher Robinson
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ah. No reasonable way, then.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic