Slashdot Mirror


Don Box: Huge Security Holes in Solaris, JVM

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."

47 of 226 comments (clear)

  1. On Defense by fembots · · Score: 2, Funny

    First instance of Microsoft mehing FUD?

    Next up, Notepad will be the target since it allows any malicious code to be written on it.

  2. JNI is an API, not a platform... by patniemeyer · · Score: 4, Informative

    Solaris - yes, it's unsafe. That's why my Solaris machine gets attacked if I don't have a firewall in front of it for ten seconds.

    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

    1. Re:JNI is an API, not a platform... by Rinikusu · · Score: 3, Informative

      Isn't JNI basically what you use when you want to write a "java native" driver for your custom hardware (I'm thinking x10 and what not)? (But then you'd have to port the JNI to every platform you wanted to support, right?)

      --
      If you were me, you'd be good lookin'. - six string samurai
    2. Re:JNI is an API, not a platform... by essiescreet · · Score: 3, Informative

      Yes, this is corrrect. The jni allows you to declare "native" methods for Java. This allows you to do stuff like connect to shared memory, process UNIX signals, and do other low-level operations that are platform specific.

      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 Linux. I'm a regular programmer. It's really not that difficult, just a little different.

      In my case, it's allowed me to write Java add on's to a system that's written in C. This makes the delopment faster, the GUI's prettier, and the interface is the only C code to manage.

    3. Re:JNI is an API, not a platform... by Anonymous Coward · · Score: 3, Interesting

      For that matter you can say that any language which uses sockets for network programming or can write a file is unsafe.

      Actually, yes that is a true statement which is why the .NET CLR allows you to tweak that out and explicitly deny those rights. (By default these rights are denied for applications running on a remote store.) And, as Don Box said, the unsafe keyword is not meant for daily consumption. To paraphrase, "normal programmers never use the unsafe keyword. It's a very low level integration API."

    4. Re:JNI is an API, not a platform... by patniemeyer · · Score: 4, Informative

      First, technically there's no reason you couldn't build an API allowing pure Java hardware drivers. Sun did it for JavaOS (which apparently went nowhere, but for other reasons). I wish someone would take this idea and port it to Linux, giving us pure Java device drivers.

      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

    5. Re:JNI is an API, not a platform... by Scorillo47 · · Score: 2, Interesting

      And a similar blog entry here:

      http://blogs.msdn.com/adioltean/archive/2005/02/ 07 /368226.aspx

      I am reading now an article in which James Gosling claims that .NET has a huge security hole. The problem seems to be that .NET allows execution of both safe and unsafe managed code in the same process:

      [...], 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 .NET defines, and this sort of code requires additional permissions to execute. According to Sterling, "you as a developer take it upon yourself" to utilise unsafe code in your .NET applications.

      But what James Gosling fails to mention is that the Java runtime also allows the same type of unsafe code execution in every process running safe Java code. No, I'm not smoking crack. The technology is well established in the Java world and it is called JNI. Here is a quote:

      The JNI allows Java code that runs within a Java Virtual Machine (VM) to operate with applications and libraries written in other languages, such as C, C++, and assembly. In addition, the Invocation API allows you to embed the Java Virtual Machine into your native applications.

      Programmers use the JNI to write native methods to handle those situations when an application cannot be written entirely in the Java programming language. For example, you may need to use native methods and the JNI in the following situations:

      The standard Java class library may not support the platform-dependent features needed by your application.
      You may already have a library or application written in another programming language and you wish to make it accessible to Java applications.
      You may want to implement a small portion of time-critical code in a lower-level programming language, such as assembly, and then have your Java application call these functions.
      Think of it a second - in fact, how does a small Java program interoperate with the underlying operating system? How does a "Hello world" Java program succeed to write anything to the console? After all, the Win32 API is not directly callable from Java, correct?

      Therefore, by its own measure, Gosling only suceeded to demonstrate that Java also contains a huge security hole... :-)

      P.S. And, please, don't tell me that JNI is not a security hole because writing JNI code is eventually harder and not done as often than using "unsafe" in C#... Face it - in Java, whenever you are writing to a file, communicating through a network interface or just handling GUI controls, there is always some unmanaged C++ code being executed in your process...

      --
      Don't try to use the force. Do or do not, there is no try.
    6. Re:JNI is an API, not a platform... by squiggleslash · · Score: 4, Interesting
      IIS has orders of magnitude more worms and viruses than Apache, not security holes. (If you know different, please report all these security holes to the respective developers.)

      In any case, that's not why IIS is a target. IIS is a target for a number of reasons:

      1. The default web server (once you installed the Option pack) on NT4 was a version of IIS that had a couple of security holes.

      2. IIS is almost certainly more popular than Apache on Windows-type servers. Yes, Apache runs on it too, but there's a mentality that goes with Microsoft products. With Windows being the most "popular" (well, most installed) operating system in existance, you'd expect it to be the home for most virus writers, and virus writers aren't going to want to write for platforms they consider obscure.

      3. IIS always runs on Windows which almost always has the same CPU architecture (ie ix86) and APIs. Apache can run on a variety of platforms. Exploiting, for example, buffer overflows, is relatively difficult if you don't know the architecture, or even something as simple as how you can make system calls.

      4. People hate Microsoft. Most people's views of Apache and similar systems are neutral at worst. I've never met or talked to anyone who hates Apache.

      5. One serious hole is enough. Both Apache and IIS have suffered these in the past and probably will do in future (well, until Gosling rewrites Apache in Java ;-)

      IIS is usually used as the proof to counter the argument that marketshare matters when viruses are written. I think this is always a bogus argument: IIS's marketshare is enough (it's not like writing a virus for GNU/Linux), and IIS is tied to an operating system that is the most installed in the world. It's fair to say it's the exception that, quite literally, proves the rule.

      --
      You are not alone. This is not normal. None of this is normal.
    7. Re:JNI is an API, not a platform... by YU+Nicks+NE+Way · · Score: 2, Informative

      Managed C++ is type and bounds safe. Unsafe C# and/or C++ allow type inference, but not bounds checking, and therefore allow a major class of exploits that aren't possible within the standard portions of the dialects. A call into C/C++ from within CLR requires PInvoke, just as a call into C/C++ from Java requires JNI.

      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 most perf sensitive enumerations can be run without moving "down to the metal".

      Basically, Gosling said it, and you fell for it. In /.-speak, they say "YHBT, YHL, HAND."

    8. Re:JNI is an API, not a platform... by patniemeyer · · Score: 3, Insightful

      Face it - in Java, whenever you are writing to a file, communicating through a network interface or just handling GUI controls, there is always some unmanaged C++ code being executed in your process...

      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

    9. Re:JNI is an API, not a platform... by jeif1k · · Score: 4, Insightful

      JVM - no, that's safe. JNI is an API, not a platform.

      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.

    10. Re:JNI is an API, not a platform... by MoebiusStreet · · Score: 2, Informative
      The vast majority of the APIs are pure Java code.

      RTFA:

      In looking at the Indigo code base (which was 1123 C# files as of early last week), only 19 of them use the unsafe keyword.

      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 needs *can* use unsafe when necessary?

    11. Re:JNI is an API, not a platform... by jeif1k · · Score: 3, Insightful

      which high level languages were these, and is the greater safety not in large part due to the relative simplicity of older systems

      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.

    12. Re:JNI is an API, not a platform... by hugg · · Score: 2, Interesting

      I understand your point, but I believe that there is potential for many more exploits in Java than you let on. For instance, here's the .so file for the AWT shared libraries on my 1.4.2 JDK:

      3059052 Jun 4 2004 /usr/local/java/jre/lib/i386/libawt.so

      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, Smalltalk -- part of the reason for this is performance, part is feature set.

      Also, a quick search for "buffer overflow" on the Java bug database brings up 1860 results. I'm sure one or two of those involve native code and were/are potentially exploitable, just no one got around to it.

      Yes, I'm sure much of the Java codebase is heavily audited, and the common things like socket/file I/O are pretty secure. But I wouldn't say "all is well" if I had to bet my business on that being true.

    13. Re:JNI is an API, not a platform... by JesseT · · Score: 2, Informative

      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.

      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 code. It doesn't get "linked" through the CLR's equivalent of a JNI interface. It's still managed code. There isn't any unmanaged code here to speak of. C# code can still interoperate with unmanaged code using the .NET BCL's P/Invoke and COM interop layers, but it has nothing to do with the "unsafe" subset of the C# language. It's a part of the .NET Framework itself, and all managed languages targetting the .NET Framework can utilize those features.

    14. Re:JNI is an API, not a platform... by bigsteve@dstc · · Score: 2, Informative
      Either way, it's unsafe.

      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.

  3. Flaws aren't a bad thing? by MattyDK23 · · Score: 2, Funny

    I can see it now..."Bugs deserve rights too!"

    1. Re:Flaws aren't a bad thing? by Rosco+P.+Coltrane · · Score: 5, Funny

      I can see it now..."Bugs deserve rights too!"

      Well, ask the original bug at NSWC if it enjoys being taped to a cardboard note since 1947...

      --
      "A door is what a dog is perpetually on the wrong side of" - Ogden Nash
  4. I don't think anyone really read what Gosling said by Anonymous Coward · · Score: 5, Interesting

    Are we just going to have this continuing debate in which every side is inaccurately reduced to one slashdot-blurb-sized sound bite?

    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.

  5. Standards by davidstrauss · · Score: 2, Funny

    Is this the new Microsoft Box model?

  6. here we go again.... by kevinx · · Score: 5, Funny

    is this one of those, "your hole is bigger than mine" arguments?

  7. FUD by micromuncher · · Score: 5, Informative

    To use JNI inside of an applet, it needs to be signed with the DLL/shared library pre-installed in lib. 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.

    --
    /\/\icro/\/\uncher
    1. Re:FUD by Anonymous Coward · · Score: 2, Informative

      You can't use Unsafe/PInvoke inside a .Net hosted control (applet) unless permissions have been explicitly granted beforehand.

      So to get outside that sandbox, you need to jump through configuration hoops.

  8. This just in! by kiwidefunkt · · Score: 5, Funny

    This just in: Programming languages are insecure. They allow third parties to run arbitrary code on your processor.

    Microsoft will be releasing a patch which fixes this problem soon. Stay tuned.

    --
    www.kiwilyrics.com - a wiki for lyrics
  9. Yawn! by Z00L00K · · Score: 2, Insightful
    This seems to be a shit-throwing contest more than actually trying to figure out means to manage security issues in platforms.

    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. Unfortunately Microsoft has only recently recognized this and are applying patches on and off. Solaris and most *NIX:es are a little better off, but there are a lot of work to do for all operating systems here!

    --
    If builders built buildings the way programmers wrote programs, then the first woodpecker would destroy civilization.
  10. Re:It's that darn C and C++ code again.. by SnarfQuest · · Score: 2, Funny

    Intercal! It's very hard to write viruses using it.

    (It's very hard to write anything else in it either)

    --
    Who would win this election: Andrew Weiner vs Andrew Weiner's weiner.
  11. Why "managed" == "denial" by Concern · · Score: 5, Insightful

    When .NET was first announced and the details began to be known, there were a number of lively discussions here about it. The "feature" of running unmanaged code was hotly debated, but the debate seemed to me to be entirely one-sided. It seemed clear unmanaged code is another classic Microsoft mistake - trading sugary convenience today for billions in headaches for their customers tomorrow. I went looking for someone to convince me otherwise and didn't succeed. Maybe now?

    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, .NET gives you only the worst of both worlds.

    You get all the overhead of the VM, but you don't really get safety.

    I know perfectly well you can tell the .NET runtime not to allow unmanaged code. That doesn't matter, because the choice is there, "unmanaged" is still a huge problem.

    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.

    --
    Tired of Political Trolls? Opt Out!
    1. Re:Why "managed" == "denial" by graznar · · Score: 3, Interesting

      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.

      Which I'm guessing your misinformation leads you to believe that .NET doesn't afford?


      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.


      Right...for "hot code" .NET developers use Interop to access lower level APIs and interfaces.


      As far as I can tell, by allowing unmanaged code in the runtime, .NET gives you only the worst of both worlds.

      I'm not really sure why you're wailing on .NET; security is a holistic effort. Your sysadmin needs to disable access to dangerous operations; the developer needs to put in place security measures (regardless of what language); the user needs to know how to operate software.

      JNI does essentially the same thing as Interop. People who have been using JNI in its originally intended context don't see this, but some people use JNI to access lower level interfaces and APIs (such as shared memory, native APIs, etc.).

      Now, of course, I'm sure you'll gloat about the proverbial "sandbox" that Java offers, but you fail to realize that .NET has this also. Try running an assembly off a remote store or even run a method through a remote channel. .NET's standard security is pretty high. It respects system permissions and principals, so I'm not sure why people keep saying it's some sort of apocolyptic risk.

      Unmanaged isn't any different than writing a program and using JNI to talk to it.

      --
      [ check out my ruby book @ http://ww
    2. Re:Why "managed" == "denial" by Concern · · Score: 2, Insightful

      I'm sure you'll gloat about...

      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 .NET is not Pants Down for remote code.

      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 interface with lower-level "unmanaged" code. This is what you see in any core library: wrapper objects that invoke unmanaged native code. No PC is "managed" down to the silicon - although some Java embedded devices literally are.

      The difference is in how that boundary works. In Java, JNI is deliberately very rudimentary and extremely low level. It is designed exclusively to allow access to native routines - not bit twiddling within the VM itself. It's use is vehemently discouraged by policy (100% pure etc etc) and JNI use in the field is rare as a result.

      Everyone can hammer on the fixed Java API, and at some point we trust that lower-level foundation. We then declare that our own Java code, built on top of it, is "safe" and "managed."

      In .NET, if I understand correctly, the attitude is very different.

      http://msdn.microsoft.com/library/default.asp?ur l= /library/en-us/dnreal/html/realworld06012004.asp

      They encourage the use of unmanaged code, and the framework makes it much, much easier to use. It's billed as a feature.

      We slip in unmanaged C# to fiddle with buffers to do parsing or whatever. This is not going to C like in JNI, but just quick-and-dirty cheating within the VM. There is no such thing as "unmanaged Java."

      So you can cheat the VM and make C# a little faster. But now no one is looking over your shoulder. Your new unmanaged code may have problems. You are not safe in your VM anymore (nor are you portable). Meanwhile you still have the overhead of running that way.

      It often comes up in the Java community that people wish JNI did more work for you, so that it would be easier to use. But we always come back to the same answer: if you make JNI easy, and start encouraging its use (going the Microsoft route), soon everyone is using it. There is no more portability and you lose security and stability. Great for MS, of course. But if we really don't care about that, why not just back away from the VM in a more orderly fashion altogether?

      --
      Tired of Political Trolls? Opt Out!
  12. Why "managed" != "denial" by mark99 · · Score: 2, Interesting

    I write a lot of C#, and I almost never use unmanaged code.

    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...

  13. Hmm.. by vurg · · Score: 5, Funny

    So when will this become a serial exchange of yo momma jokes?

  14. Re:What do these both have incommon? by javatips · · Score: 4, Informative

    Java source code is available with little effort. So if you want to check it out and do some security analysis, you can do it.

  15. Inaccurate Inaccurate comparison by steve_l · · Score: 5, Informative

    JNI is the second edition at a Java to C++ API. It is the underpinnings of every binding from Java to platform there is, not an afterthought for applets (though Netscape were involved). If you don't use it much in your code, it's because other people (i.e Sun) do it for you. They also go out their way to make it hard to do so, whereas MS, with P/Invoke and COM support, make it really easy to invoke native code *from trusted apps*.

    Most .NET code that I know doesn't use unsafe either: MS go out their way to discourage you. You have to compile as unsafe, grab pointers only briefly, and then only ever get to run if your code came from a trusted place. All remote code is blocked, even that on a network share.

    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 .NET APIs, too much of which are thin wrappers around Win32. OR the fact that the .NET runtime needs IE6 installed, and IE6 is the web browser component for .NET apps. OR the fact that ASP.net is built on IIS. Those are security holes. Windows is a security hole. ActiveX is a gaping security hole. IIS is server side disaster. .NET is actually pretty secure, but its just damage limitation on an otherwise dangerous piece of junk. Its like having ABS brakes on a Ford Explorer; not enough on its own to stop you crashing and burning horribly.

  16. Why no tainted data in either runtime? by steve_l · · Score: 2, Insightful

    You make some good points. Nobody does use unmanaged BTW, its just too painful. There is one thing wore than it: managed C++.

    One thing though, neither Java or .NET have any notion of tainted data. all this security stuff does is let you run untrusted code in a sandbox, or trusted code in a secured zone to slightly limit the damage it can do.

    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 .NET have so far succeeded server side.

    Compared to Perl, Java is insecure as you can too easily fall to a SQL string attack, either in your web page, or, heaven forbid, Web Service.

    1. Re:Why no tainted data in either runtime? by pHDNgell · · Score: 2, Interesting

      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 .NET have so far succeeded server side.

      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 page, or, heaven forbid, Web Service.

      It's actually rather hard to fall victim to a SQL injection attack unless you are just using the APIs the wrong way (which is more difficult). In our application...I can only think of a couple of places where SQL is generated in the code, and in those places, we generate prepared statements to deal with any input.

      --
      -- The world is watching America, and America is watching TV.
  17. Whiny by 5n3ak3rp1mp · · Score: 4, Funny

    I can't help feeling that some small percentage of this type of back-and-forth is something like a junior-high whiny geek arguing about how the Micro Channel bus architecture is better than ISA and that , incidentally, Apples are utterly irrelevant. ...Oh, wait. That geek was at one time a friend of mine, and this was circa 1985, and this was an actual discussion. ;) (hi, don ulrich! i still use a Mac, and Apple still exists! where's your precious PS/2 micro-channel NOW?!?! nyaaah, nyaaah!!)

  18. the FUD comes from Gosling by jeif1k · · Score: 2, Insightful

    To use JNI inside of an applet, it needs to be signed with the DLL/shared library pre-installed in lib.

    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 explicitly) to demonstrate how absurd Gosling's argument is.

    Unfortunately, creating FUD seems to be a major occupation at Sun these days, and the targets are Sun's biggest competitors: Microsoft and Linux.

    1. Re:the FUD comes from Gosling by jeif1k · · Score: 2, Interesting

      The original argument Gosling had was how easy it was to produce something "unsafe" from legacy code.

      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, .NET is a serious desktop platform. Desktop applications are trusted, and hence there is no problem with them running legacy code in a trusted mode. Lack of a good migration path from legacy code to Java is one of the big problems with Java.

      On the other hand, .NET enforces the same sandboxing and trust model as Java when it comes to applets and remote code, so there are no security problems arising from the ease with which you can migrate code to it.

      because it's just fuel for the m$ minions to go Java bashing.

      Gosling started this, Box responded. Box's response was entirely accurate and appropriate.

      As for "m$ minions", I am not using .NET because I don't want to tie myself to Microsoft platforms. But Java, at this point, is technologically and legally such a disaster that it is not a reasonable choice for most applications. Java deserves every bashing it gets, from M$ as well as from long-time Java users like me.

  19. Neither is really a security hole.... by Jaime2 · · Score: 5, Interesting

    Let's take a look at how each technology can become a security hole: By remote execution of content presumed to be in a "sandbox".

    .NET: Since unmanaged code is turned off by default for remotely loaded code, it will not be run by an unexpected trip to a web page.
    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 .NET is sophisticated enough to allow some apps to use unmange code, but not others, or some users, or software from a certain publisher, and a bunch of other options as well. You don't have to simply "turn on unmanaged code". They even have a simply way to allow software publishers to communicate these settings to customers instead of letting Joe Blow admin decide to simply turn off security to make it work.

    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.

  20. I don't see the big fuss by Rocko+Bonaparte · · Score: 2, Insightful

    Some people just have to do low-level stuff in a high-level application. People can write malicious code for that, but that's the price you pay.

    The little bit of C# I've looked at has shown that .NET does a lot to reduce the amount of old-fashioned pointers you need. Most of that has been wrapped up into things like references and delegates, which can be tracked and managed.

    They could have also prevented C++ from coexisting with the .NET framework, but I think that would have reduced a huge selling point. .NET is more than just a VM, and it's trying to solve a lot of problems. C++ should be able to take advantage of it.

    I think people are just complaining is on the assumption that .NET will become the next overwhelming thing, and it's VM will be widely adopted--hence the biggest target for attacks. It's very possible to write a JNI exploit that the naive user may also run. Ultimately, accountability still resides with the end user, but these higher-level languages have reduced the amount of stuff the end user has to track.

    --
    No I'm not trolling.
  21. Ah, yes... SOAP... by Anonymous Coward · · Score: 2, Interesting

    "See, it's XML over HTTP, so no need to change your firewall configuration". Security? Ah!

    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]), because somebody wisened up and realized that XML was just bad at byte framing, and, yes, we need binary data.

  22. From the 'Yeah, well, duh!" department by scovetta · · Score: 2, Interesting

    JNI is an absolutely necessary part of Java. How do you think System.out.println() really works? Down through the (many) layers of calls within standard Java classes, you eventually get to a JNI call. In fact, without JNI, Java wouldn't be able to access the network, files, console, etc. It's like saying the keyboard is responsible when you type format c: (or when you click-click-click for the younger generation).

    --
    Wer mit Ungeheuern kämpft, mag zusehn, dass er nicht dabei zum Ungeheuer wird. --Nietzsche
  23. C++ support in Java vs .NET by DrXym · · Score: 4, Interesting
    Yes Java supports C++ native calls, but look at how bloody painful it is to do it. You have to define an interface, run it through a stub compiler, implement the stubs and use helpers to marshal types back and forth between C++ and their Java equivalents. It involves lots of files and lots of fiddling about.

    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.

    1. Re:C++ support in Java vs .NET by mibus · · Score: 2, Informative

      And too bad if you're running Mono on a non-x86, non-Linux system since winelib is x86 only (for now).

      From the Darwine FAQ:
      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.

    2. Re:C++ support in Java vs .NET by DrXym · · Score: 2, Interesting
      I know about Darwine (hence the for now in my original post), but this project is only a port of the Win32 API. That might help for PInvoke but it won't help you if you're invoking unsafe C++ DLLs or other x86 instructions. Phase two of Darwine supposedly integrates winelib with an x86 emulator but it hasn't happened yet.


      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 MS must be rubbing its hands with glee about this even if some of the CLR purists are probably aghast.

  24. Heh by finkployd · · Score: 3, Funny

    One of the creators of SOAP is lecturing on security, that is quite a laugh. SOAP still stands as the poster child for the "design something first, try to hack on security after the fact" crowd.

    Finkployd

  25. Secure Programming Class by PerryResearch · · Score: 2, Interesting

    A typesafe language is no replacement for secure programming knowledge, several vendors offer classes in that realm:

    http://www.liveammo.com/LiveAmmo_Secure_Programmin g_Training.htm

    and

    http://www.cerias.purdue.edu/secprog

    --
    ---------- http://www.LiveAmmo.com