Don Box: Huge Security Holes in Solaris, JVM 226
DaHat writes "Don Box, one of the authors of the original SOAP specification in 1998, now an architect on Microsoft's next generation Indigo platform recently responded to James Gosling's remarks regarding huge security holes within the .NET Common Language Runtime (CLR). Don argues that the same 'flaws' that Gosling noted in the .NET CLR exist both within the Solaris operating system as well as the JVM, both of which support execution of C and C++ code, as well as explaining why this is not necessarily a bad thing."
On Defense (Score:2, Funny)
Next up, Notepad will be the target since it allows any malicious code to be written on it.
Re:On Defense (Score:2)
I believe this is a new word, as if English doesn't have enough words already.
JNI is an API, not a platform... (Score:4, Informative)
JVM - no, that's safe. JNI is an API, not a platform. For that matter you can say that any language which uses sockets for network programming or can write a file is unsafe. Not to mention that normal programmers never use JNI... It's a very low level integration API.
Don's comments did not really add anything that wasn't covered in the Slashdot discussion.
Pat Niemeyer
Author of Learning Java, O'Reilly & Associates
Re:JNI is an API, not a platform... (Score:4, Informative)
Re:JNI is an API, not a platform... (Score:3, Informative)
So, you do have to port it, but it's there if you really, really need to do something in C that you can't do in Java.
As for normal programmers not using it, that's not true. I use the JNI for integrating java with a large software package that's written in C, and runs on AIX or Li
Re:JNI is an API, not a platform... (Score:4, Informative)
But in answer to your question - yes, you can use JNI to talk to unsupported hardware by invoking native routines and, internally, the Java libraries use it to invoke native code on the platform for basic services like talking to the filesystem, sockets, or anything that's not written in pure Java.
Many people might be surprised though to know just how much of Java is written *in Java*... The vast majority of the APIs are pure Java code. Only the lowest level stuff is delegated to platform specific code. For example, Java does DNS and most crypto in pure Java.
And finally, most X10 hardware uses a serial API... I have one controlled by Java... also a network of Dallas Seminconductor sensor devices controlled by Java.
Pat Niemeyer
Author of Learning Java, O'Reilly & Associates
Re:JNI is an API, not a platform... (Score:3, Informative)
RTFA:
Why in the world would one consider the *possibility* of unsafe code in the CLR a security hole? Sure, you can call the use of unsafe a hole. But if (like virtually all .Net developers I know) you never use that, then there's no issue at all.
Is Gosling complaining that the CLR is so flexible that someone with extraordinary
Re:JNI is an API, not a platform... (Score:2, Troll)
I'm sorry, but that just sounds like a joke...
I'm not sure though, are you being serious?
Re:JNI is an API, not a platform... (Score:2)
Re:We're heading in that direction (Score:2)
Re:We're heading in that direction (Score:2)
1998 called, they want their joke back.
-Zipwow
Re:We're heading in that direction (Score:2)
I manage a bunch of servers that run java applications and they regularly get their memory resources swamped.
Re:We're heading in that direction (Score:2)
I write Java applications that are moderate in terms of memory consumption, and are high-speed components at the core of our business.
My friends manage a bunch of servers that run C++ applications, and they regularly get their memory resources swamped.
-Zipwow
Re:JNI is an API, not a platform... (Score:2)
You are confusing "purity", "safety", and "security"; if you did what you suggest, you would indeed be writing drivers in "pure Java", but if those APIs were accessible, they would undermine safety.
Re:JNI is an API, not a platform... (Score:3, Interesting)
Actually, yes that is a true statement which is why the
Re:JNI is an API, not a platform... (Score:2)
Wait... I don't know the answer to this, but - won't all C/C++ code running on
Normal programmers do use C/C++ daily... and it is unsafe. I think the point vs. JNI is valid.
Pat Niemeyer
Re:JNI is an API, not a platform... (Score:3, Informative)
Normal programmers writing in C#/Managed C++ use C/C++ less frequently than "normal" Java programmers do, actually, because they have access to the intermediate "unsafe" calls, through which
Re:JNI is an API, not a platform... (Score:3, Interesting)
http://blogs.msdn.com/adioltean/archive/2005/02 / 07
I am reading now an article in which James Gosling claims that
[...], Gosling is concerned about "unsafe" code, which is produced by traditional languages like C and C++. Unsafe code is old code that does not strictly follow the rules of type safety that
Re:JNI is an API, not a platform... (Score:4, Insightful)
Of course... and Java executes RISC instructions that could reveal flaws in the processor design too... but those levels were not written in the course of daily programming. The native drivers in Java are very small (e.g. all of Swing is built on a few AWT calls for opening windows and doing primitive drawing). And those routines presumably get a lot of scrutiny for all kinds of reasons - security being one and performance being another. I have never heard of a common security problem like a buffer overflow in the native libs shipped with Java... It's going to happen someday of course and that's why people created Java and managed code. To minimize the exposure of those regions.
The futher up the food chain your code goes the more protected it is and the harder it becomes to exploit low level security holes. It's analogous to the way in which you (used to?) gain confidence in the GNU C compiler by having it compile itself and then using the 2nd gen to compile a third... At each step the possibility of simple problems become much more abstract and harder to exploit.
Pat Niemeyer
Author of Learning Java, O'Reilly & Associates
Re:JNI is an API, not a platform... (Score:3, Interesting)
3059052 Jun 4 2004
That's 3MB (w/o debug info) of potentially exploitable wrapper code, lots of which depends on complex and (and potentially exploitable) Win32/X/Motif/whatever code. The rest of the shared libs total to about 6MB. Java's native layer is not thin like say, Smallt
Re:JNI is an API, not a platform... (Score:2)
Just curious...which high level languages were these, and is the greater safety not in large part due to the relative simplicity of older systems? I mean, how hard is it to wring all the bugs out of an application or OS written for a machine with 16K of RAM, and did they really bother to weed out all pos
Re:JNI is an API, not a platform... (Score:4, Insightful)
Many of the classics, among them Lisp, Algol, APL, Simula, and Smalltalk. Modula-3 even had C#-like safe/unsafe sublanguages (as did a few other languages). And while they didn't have GC, languages like Pascal and Modula were safe languages in most other respects.
and is the greater safety not in large part due to the relative simplicity of older systems? I mean, how hard is it to wring all the bugs out of an application or OS written for a machine with 16K of RAM
The world did not begin with 16k Apple II's or the teenage dabblings of some industry luminaries in software. People had large computers running multiuser operating systems and safe, high-level languages in the 1960's.
and did they really bother to weed out all possible "exploits" when weren't 10,000 russian teenagers writing viruses to "zombie box" that machine?
We are talking about runtime safety here. You are confusing runtime safety and security; runtime safety helps with security, but it is neither necessary nor sufficient to guarantee it.
Re:JNI is an API, not a platform... (Score:4, Insightful)
You can look at C# as two languages: an "unsafe" and a "safe" language. The safe language is the equivalent of Java. The "unsafe" language is the equivalent of C or C++ linked in through JNI. Linking "unsafe" to "safe" code in C# has the same restrictions on it as does linking native code to pure Java code in Java. So, Gosling's rantings have no technical merit.
However, the C# solution is better than the Java solution: unsafe code in C# still contains substantially more error checking than equivalent C code linked through JNI, you generally need much less unsafe code in C# than in Java to accomplish the same task, and C# unsafe code doesn't need to be recompiled for different platforms and can just be distributed like other C# code.
Don's comments did not really add anything that wasn't covered in the Slashdot discussion.
What do you want? He is responding to an enormously stupid, self-serving comment from Gosling. You have to be clear and keep things simple in order to reach the kind of people who would swallow Gosling's nonsense in the first place.
Re:JNI is an API, not a platform... (Score:2, Informative)
You got this wrong too. As Don explained in his blog, if you weren't too busy to have read it, you'd realize that "unsafe" C# is still managed cod
Re:JNI is an API, not a platform... (Score:2)
Of course, it doesn't get "linked": it's a language construct. That is one of its advantages over JNI: because the compiler and runtime know about unsafe constructs, they can get inlined. Something that may require a complete API and pages of C code with JNI can be done with just a single line of unsafe code in the CLR.
It's still managed code. There isn't any unmanaged code here to speak of.
Of course, it's "managed code". Why
Re:JNI is an API, not a platform... (Score:3, Informative)
If the JVM and (say) C code are in separate address spaces, then the C code does not ever need to see the physical addresses of Java objects, or anything else in the JVM address space. Thus, the JNI API can in theory be implemented so as to make it impossible for the C code to break the Java type system.
However, I've never come across a JNI API implementation that works that way. It is just too expensive.
Re:JNI is an API, not a platform... (Score:2)
First of all, people use JNI for buffer and array manipulation; that JNI code wouldn't work if it weren't in the same address space. So, your claim that JNI code can run in a separate address space is jus
Re:JNI is an API, not a platform... (Score:2)
Integerwise, sure. But what if you want to use SIMD instructions (Altivec, SSE, etc..)?
Re:JNI is an API, not a platform... (Score:2, Interesting)
And that's why a whole class of software is not written in Java. Get out of your web services, connect to database world.
At my previous position, we had a volume renderer that was written in C++, an SDK on top of the volume renderer that was written in managed C++, and applications were written in C#, VB.NET and Python.NET.
The right tool for the right job.
Using JNI would have been a pain in the eff-ing ass
Re:JNI is an API, not a platform... (Score:2)
Now if they would only intergrate BSH into Eclipse so you can have completion etc. etc. as well.
Comment removed (Score:4, Interesting)
Re:JNI is an API, not a platform... (Score:2)
So, the problems continue with IIS, and are not simply
Re:JNI is an API, not a platform... (Score:2)
Re:JNI is an API, not a platform... (Score:2)
I'm not the parent poster but there is no reason to think that a fresh server on a closed network would get a virus right of the bat. the problem was that the network had an outside port forwarded to it before he knew about it. I guess thats never an issue when you network consists of moms computer and
Re:JNI is an API, not a platform... (Score:2)
I usually slipstream service packs. In this case I had not done so. A previous machine had failed and needed a replacement ASAP. So, I installed Win2k AS from the original CD and started configuring things. IIS was on by default. I knew this; I didn't care--I was behind a NATed network, and every minute wasted was money lost. It turned out a port was fo
Flaws aren't a bad thing? (Score:2, Funny)
Re:Flaws aren't a bad thing? (Score:5, Funny)
Well, ask the original bug [faqs.org] at NSWC if it enjoys being taped to a cardboard note since 1947...
Re:Flaws aren't a bad thing? (Score:2)
Re:Flaws aren't a bad thing? (Score:2)
I don't think anyone really read what Gosling said (Score:5, Interesting)
Anyway, JNI doesn't need to be a security hole of the sort Mr. Box mentions; one can concieve of a Java VM which disallows unsafe JNI code from touching the memory of the bytecode-verified safe code, by partitioning JNI execution into a separate process. In fact at least one such JVM implementation exists already. [sun.com]
Re:I don't think anyone really read what Gosling s (Score:2)
Re:I don't think anyone really read what Gosling s (Score:2)
But the starting point for the flamewar was Gosling doing precisely that.
I get really tired of security being thrown around to score idiotic debating points. That is what Gosling was doing, if he had bothered to do any research on the .NET security framework he would know that the security mechanisms prevent the type of mixing he was complaining about.
Don's description o
Standards (Score:3, Funny)
here we go again.... (Score:5, Funny)
Re:here we go again.... (Score:2)
Re:here we go again.... (Score:2)
FUD (Score:5, Informative)
Re:FUD (Score:2, Informative)
So to get outside that sandbox, you need to jump through configuration hoops.
the FUD comes from Gosling (Score:2, Insightful)
And the equivalent is true for C# "unsafe" code: there are restrictions on where it can be run from and what can run it.
So, the topic of "Huge Security Hole in Solaris and JVM" is alarmist and FUD, considering that to get outside of the sandbox, you need to jump through serious configuration hoops.
The FUD is the nonsense Gosling was spewing about C#. Box is responding with hyperbole (he says so expli
Re:the FUD comes from Gosling (Score:3, Interesting)
No, Gosling wasn't complaining about lack of safety, he was complaining about lack of security. He keeps confusing the two issues, and you apparently do too.
There is nothing wrong with producing something either unsafe or unsecure from legacy code: unlike Java,
Re:the FUD comes from Gosling (Score:2)
Seeing as there are non-MS implementations of almost all of the
Re:the FUD comes from Gosling (Score:2)
Depends on what you mean by ".NET platform.". Strictly speaking, "the
However, what I do consider a good choice is Mono+Gnome: that combination gives you all the advantages of the C# language, t
This just in! (Score:5, Funny)
Microsoft will be releasing a patch which fixes this problem soon. Stay tuned.
Re:This just in! (Score:2)
I thought they already this ages ago - it was called Internet Explorer 4.
Yawn! (Score:2, Insightful)
Programs will have bugs, regardless of what programming language that is used, since it always comes down to machine-code or even microcode in the end, and it's not easy to test a large software package for all possible permutations.
The only way around this problem is a layered security approach, which means that breaking one layer will not cause any critical effects. Unfortunate
Inaccurate comparison (Score:2, Informative)
Microsoft, however, is actively looking to extend the CLR with a JNI-like interface. Why? To make it e
Inaccurate Inaccurate comparison (Score:5, Informative)
Most
Where MS do care is about COM integration, about platform integration. True, there is only one platform they care about, Windows.
But consider this: Integration between Java and Linux, especially the GUI, sucks. Want decent Java/Gnome bindings? You need the third party Java-Gnome libs, which use, wait for it, JNI. Want Java KDE bindings, go to KDEJava and get the java libraries plus native code. If you want to integrate with the OS, you need native code, which means JNI.
The fact that JNI is pretty rare can be seen by the fact that Gnome, KDE and drag-drop integration with the rest of the Linux GUI is pretty much nonexistent.
I think the FUD Sun are saying about "unsafe" is so bogus. If they want to slag it off, just pick on the
Re:Inaccurate Inaccurate comparison (Score:2)
Hey, it beats having GUIs that look like ass and are sluggish (Swing).
Re:Inaccurate Inaccurate comparison (Score:2)
Yeah, which is why they're implementing all those proprietary technologies like XML, XSLT, SOAP, Web Services and other industry-standard protocols to lock everyone else out.
Yes, that's sarcasm.
If they want to slag it off, just pick on the
Too true, but they've got to start somewhere and their "progress" with Longhorn, and their real progress with ASP.NET 2.0 shows they are eliminat
Re:Inaccurate Inaccurate comparison (Score:2)
Re:Inaccurate comparison (Score:2)
Why "managed" == "denial" (Score:5, Insightful)
There is great value in a "managed" system like the Java VM. It gives us an extraordinary amount of safety that we are frankly unaccustomed to. People are still gradually learning how to think about it, but you see more and more security-critical projects going "Java only" as they figure it out.
There is also obviously no way we can do everything that way. For hot code, we work at lower levels, put in more work, and (for now) accept the additional risks. Note that the constant stream of ugly worldwide security problems is gradually but now noticeably decreasing our apetite for doing everything that way.
As far as I can tell, by allowing unmanaged code in the runtime,
You get all the overhead of the VM, but you don't really get safety.
I know perfectly well you can tell the
Either it is avoided by everyone (everyone recognizes that it's a mistake), or we all begin to use it (it's in XYZ library), and then we all end up allowing unmanaged code, and we are no longer safe.
Why "managed" != "denial" (Score:2, Interesting)
But sometimes I do. I would start far fewer projects with C# if I couldn't be sure I could get out of that particular straightjacket.
That being said, I am starting to have my doubts about writing huge programs without giving a thought to memory management. It is fun, and it is fast, but there is no way back...
Why no tainted data in either runtime? (Score:3, Insightful)
One thing though, neither Java or
But neither language has the idea of marking strings or other data that came from an untrusted source, the way Perl does. Which is odd, as both Java and
Re:Why no tainted data in either runtime? (Score:3, Interesting)
Why bother with tainting when you can just do rigorous validation with things like struts? It's been quite a while since I've seen a bug related to inappropriate input handling, and that was in a perl script.
Compared to Perl, Java is insecure as you can too easily fall to a SQL string attack, either in your web pa
Re:Why no tainted data in either runtime? (Score:2)
Why bother with that when you can do rigorous validation of data without a managed VM?
Here's a little thing people seem to be forgetting: buffer overruns and smashable stacks aren't being written by applications developers. These vulnerabilities are found (increasingly rarely) in core libraries. Check bugtraq and vulndev: most exploits being found now are not overrunnable buffers and such; they're SQL insertion and
Re:Why no tainted data in either runtime? (Score:2)
However, per your example, and my experiences, doing the same rigorous validation and manipulations in C is painful, quite.
Re:Why no tainted data in either runtime? (Score:2)
Re:Why "managed" == "denial" (Score:3, Interesting)
Which I'm guessing your misinformation leads you to believe that
There is also obviously no way we can do everything that way. For hot code, we work at lower levels, put in more work, and (for now) accept the additional risks. Note that the constant stream of ugly worldwide security problems is gradually but now noticeably decreasing our apet
Re:Why "managed" == "denial" (Score:3, Insightful)
Relax.
Try running an assembly off a remote store or even run a method through a remote channel.
I'm aware that the default security configuration in
I don't want to confuse "attack" with "mistake." What about problems in local unmanaged code that we wrote ourselves?
Unmanaged isn't any different than writing a program and using JNI to talk to it.
I don't know how good a comparison this is.
Any VM must use "managed" code to interfac
Re:Why "managed" == "denial" (Score:2)
I fail to see the problem.
Already answered in another thread. (Score:2)
I went into some detail about this here. [slashdot.org]
Hmm.. (Score:5, Funny)
Whiny (Score:5, Funny)
What Mac bus in 1985? (Score:2)
I'm not including the XL because it was a Lisa not a Mac, and the Lisa expansion slots were more useless then than ISA is today.
I'll agree with your main point, though.
Re:What Mac bus in 1985? (Score:2)
Even at the tender age of 11-12, REAL geeks are alr
Re:Whiny (Score:2)
Microchannel Architecture was a 32-bit bus far ahead of its time, it was very fast, but IBM kept the specs so tightly controlled that MCA devices were expensive as hell, and as a result, not widely produced.
Re:Whiny (Score:2)
I guess I got "Steve'd" REAL early on
*slight exaggeration
Neither is really a security hole.... (Score:5, Interesting)
Java: Since JNI won't work by default under the same circumstances, the newest virus won't be injected into your system by an evil web page.
Anything else is simply an architectural choice. MS likes to preserve compatibility while allowing you to move forward as quickly as posible. Sun wants you to rewite stuff in Java (for the most part), so the new stuff is more secure, but there will be more old stuff floating around that is still unsecure because we won't yet have found time to port it.
BTW, Code Access Security in
In summary, both technologies allow you to blow your own foot off if you aim the gun properly and squeeze the trigger. So what -- we were allowed to do that before these technologies came along and preventing you from being able to blow your own foot off will only slow adoption and cause more feet to be blown off.
I don't see the big fuss (Score:2, Insightful)
The little bit of C# I've looked at has shown that
They could have also prevented C++ from coexisting with the
Re:I don't see the big fuss (Score:2)
Ah, yes... SOAP... (Score:2, Interesting)
And Microsoft bought into it because they needed something to interoperate with the rest of the world, and they couldn't do a 180 and use CORBA without "looking bad".
And now we get that XOP turd (discussed here [slashdot.org] [slashdot.org]), because somebody wisened up and realized that XML was just bad at byte framing, and, yes, we need binary data.
From the 'Yeah, well, duh!" department (Score:3, Interesting)
Re:From the 'Yeah, well, duh!" department (Score:2)
OH SHIT!!!
C++ support in Java vs .NET (Score:5, Interesting)
The consequence of this is that no-one uses JNI unless they absolutely positively have to. It's a pain and life is much easier if everything is in Java. Thus with the exception of a few esoteric things such as SWT, most libraries are pure and portable.
Now contrast this with .NET. Writing native C++ and wrapping it in a garbage collection safe class involves no stub generation and can be done in a single file - the assembly info, interface and gc wrapper can all be specified in situ. Consequently it's a lot easier to pull C++ into a .NET application. MS DevStudio 2003 even has wizards to do it. It is also a lot easier to call DLLs and ActiveX from .NET since MS provide PInvoke and COM Interop to do just that.
Now on the face of it, this is all well and good, especially if you have a lot of legacy crap to port. But by the same token it means many more .NET apps are tainted than on Java. The problems this causes for portability should be obvious.
And this is called "Microsoft having their cake and eating it". They can expound portability and present the facade that .NET is cross-platform, when in reality they provide tools and wizards to ensure it remains anything but. Apps that are infested with native instructions and OS-specific calls are by definition unportable.
Mono demonstrates the problems faced in porting .NET to other platforms. Mono must literally pull in the whole winelib in order to cope with the number of tainted .NET apps that attempt to call out to Win32. And too bad if you're running Mono on a non-x86, non-Linux system since winelib is x86 only (for now).
And I don't see the situation getting any better. Perhaps if Mono gains momentum it might put the brakes on tainted code, but there is a long way for that to happen. I believe the only way Mono is going to make an impact is if ships with a cross-platform IDE with tools that default to its open source stack. This is almost a reality since ICSharpDevelop & MonoDevelop are both fairly complete IDEs but there is nothing yet which defaults to the open source stack and runs on all major platforms.
Re:C++ support in Java vs .NET (Score:3, Informative)
From the Darwine FAQ [opendarwin.org]:
It means that WineLib is now working on Mac OS X, and that developers should be able to recompile their Win32 Apps using WineLib and make them work in Mac OS X.
Re:C++ support in Java vs .NET (Score:3, Interesting)
But even if / when that occurs it's not ideal. In fact it's terrible. To run .NET apps on the PPC, not only do you need Mono but also winelib and an x86 emulator!
As a corporate entity M
Re:C++ support in Java vs .NET (Score:2)
And there is lots of tainted code and therefore lots of exceptions. In fact I'd hazard to guess that the majority of non-trivial .NET applications in existence are tainted, even if its in minor ways such
Re:C++ support in Java vs .NET (Score:2)
sounds like security by obscurity to me...
that's a good thing, right?
Re:C++ support in Java vs .NET (Score:2)
You seem to be confusing JNI with the old unstandardised Java 1.0 mechanism. There is no need for stub compilers and type marshalling any more. You just write your code to access the Java data direct
Re:C++ support in Java vs .NET (Score:2)
I'm not really an expert on
Re:C++ support in Java vs .NET (Score:2)
Comment removed (Score:4, Funny)
Right on.. (Score:2)
Essentially, Don's comments are:
a)
b)
which is completely correct, IMO.
Secure Programming Class (Score:2, Interesting)
http://www.liveammo.com/LiveAmmo_Secure_Programmi
and
http://www.cerias.purdue.edu/secprog [purdue.edu]
Re:It's that darn C and C++ code again.. (Score:2, Funny)
(It's very hard to write anything else in it either)
Re:It's that darn C and C++ code again.. (Score:2)
Re:What do these both have incommon? (Score:5, Informative)
Re:All bloatware is buggy and risky. (Score:2)
Oh, putting the UI in the kernel, are we? I think people just don't learn from mistakes of Windows...
Buggy X is one thing, buggy kernel is another.
Re: Indigo platform? (Score:2)
Gotta love how MS is the only one to reuse defunct names like this...