Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Are there security concerns with using J/Link? If so, is there any way to encrypt the data passed between Mathematica and Java? If Mathematica and the JVM are running on the same machine, is there any reason to worry about this?

share|improve this question
3  
With respect to your third question: No, I think there is no reason to worry about this. I agree with @Oleksandr R.'s comments below and this comment really only emphasizes what I think is his most important point. The measure to encrypt this data would at best disable one method that a hacker could use to abuse your system. But a hacker a position to do such a thing (intercept communication between these two processes on the same machine) would have endless possibilities to, for example, see what is being communicated. You should try to combat this kind of threat in an earlier stage. –  Jacob Akkerboom Jul 28 '13 at 13:44

1 Answer 1

up vote 6 down vote accepted

Bottom line is (and I've discussed this with the developer of JLink): you can NEVER make it TOTALLY impossible within the Mathematica system, because it's impossible to prevent man-in-the-middle attacks. You can enrypt/decrypt on both sides (the kernel and the JVM), but for decryption you always need to tell the other side a public or private key. You can make this really powerful and inordinately difficult, but in the end, you can never exclude the possibility of a MITM attack where someone reads packages with the LinkSnooper and then simply pretends to be the "other side".

It's one of those questions where "secure" and "impossible" have different meanings for different people. "Entirely secure" is impossible, simply because all kernel interactions with anything outside of the kernel is done with MathLink, and that can be snooped, and you can pretend to be (mimick) the corresponding other side. But for some people "secure" already means when something is difficult enough to spend an inordinate amount of effort (=time and other resources) on it. A skilled cryptographer can make it difficult enough that it's practically infeasible to hack into it. But the extremely powerful theory of MITM attacks (which are, at least in my opinion, the most powerful crypto attacks of all that don't require a government lab for a brute-force approach), together with the snoopability of all MathLink traffic rule out a total security.

But, for all practical purposes, you can make the encryption strong enough, even for commercial applications.

share|improve this answer
1  
I think that MITM attacks do not make sense in the context of two processes running on the same machine. Any man who can insert himself into the middle of this exchange already has direct access to both processes, so that there is no need to intercept their communications in the first place. Also, in public key cryptography, one never communicates one's private key. Message integrity and proof of authorship depend on this fact. Key exchange involves the use of public key cryptography to establish a key for a symmetric key cipher, which is used for performance reasons. –  Oleksandr R. Jul 26 '13 at 14:26
    
@Oleksandr: Hmmm ... I think I have to disagree with practically everything you wrote. Just because two processes run on the same machine doesn't make MITM attacks "senseless". Just because you have access to the processes doesn't mean you wouldn't need to intercept the communication (you may need it to be able to "insert (your)self into the middle of this exchange", as you call it. And it's simply not true that in public cryptography one never communicates one's private key, and I also didn't limit this to public key crypto, and "tell the other side a private key" includes the case that ... –  Andreas Lauschke Jul 26 '13 at 14:37
    
... as the programmer insert private keys in both parts (the M code and the Java code). And public key cryptography is not only used for performance reasons. I also didn't say that MITM attacks are the ONLY ways to crack this. I only mentioned MITM attacks as ONE attack vector (a very powerful one, in my opinion). –  Andreas Lauschke Jul 26 '13 at 14:38
    
Well, even if a MITM attack is the easiest approach, it isn't necessary here since other possibilities also exist that typically would not when one considers MITM attacks (e.g. directly reading the memory of, injecting code into, either or both processes). I don't think we actually disagree on the subject of key distribution--presumably you'd agree that what you describe is an improper application of public key cryptography that undermines its theoretical basis, even if it might sometimes have practical value. But, IMO, OP is not clear enough about his needs to talk about practicalities yet. –  Oleksandr R. Jul 26 '13 at 15:03
2  
I'm not going to jump into the debate about encryption or the value of MITM attacks. I just want to point out that the original question about the security of J/Link could have many meanings. If asking about sandbox-type of security, meaning what sorts of Java operations are allowed by J/Link, the answer is all of them. I don't see this as a security issue, since M itself is already capable of virtually any dangerous operation you can name. If asking about the security of data passed between M and Java, then Andreas` remarks are relevant, and I know he has thought a great deal about it. –  Todd Gayley Aug 3 '13 at 5:49

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.