Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
Security

Secure Services on Virtual Machines? 61

Matt2000 asks: "With the growing number of package updates that cross my inbox for my redhat systems, and with the vast majority being buffer overflows, or overflows of some kind doesn't it strike anyone that there must be a better way? Instead of spending time auditing every piece of software for mechanically preventable bugs, why isn't there a common, audited virtual machine that people can build net facing services on? I would guess that sshd, httpd, and sendmail would be good candidates to start, as they are the most common and the most exploited. And please don't freak out performance junkies, if you run a website that serves 70,000 people a second and need to run native apache, then do so. Just accept that it will be less secure."
This discussion has been archived. No new comments can be posted.

Secure Services on Virtual Machines?

Comments Filter:


  • and OS version of auto-update? Just kidding...

  • by 0x0d0a ( 568518 ) on Monday April 07, 2003 @01:34PM (#5679933) Journal
    You've got chroot. Both sandbox the server from the rest of the system. Chroot is just a lot easier to make performance-efficient.
    • I think the original poster is talking about a whole different level of sandboxing. True, chroot environments keep you from playing with other files outside the jailed environment, but they do nothing to address (for example) your ability to install and run a network sniffer on the target.

      A good virtual machine, on the other hand, could let you have this level of security because the hardware is virtualized too. VMWare allows you to assign a number of different types of network interfaces to each VM,

      • True, chroot environments keep you from playing with other files outside the jailed environment, but they do nothing to address (for example) your ability to install and run a network sniffer on the target.

        Well...that's true, if you're running a chroot jail with, say apache running as root. But if you don't have any suid binaries in the jail (apache is running as "httpd" or whatever) and your kernel is secure, it should keep you from putting a sniffer on the thing.

        VMWare allows you to assign a number o
        • Right, but the point is with a VM, you don't need a secure kernel, and you CAN run Apache (or Sendmail, or Bind) as suid root.
          • With a VM, the VM has to be secure.

            And using suid root + a VM doesn't give you much functionality that not suid root + no VM doesn't.
            • Yes, something does need to be secure.

              But there is functionality to be gained from VM+SUID root. Sendmail needs root to use port 25. It would be useful to create a virtual machine that just ran Sendmail, POP and IMAP. Most email users would only have accounts on that VM. Or it would be useful to have a virtual machine that just ran BIND.

              I suppose you can use packet-filtering to remap port 53 and 25 to high ports (say, 8053 and 8025), so you don't have to run Sendmail and Bind as root.

              But the other a
    • Yeah, the only problem is go out to any hacker site, and look for details on how to break out of a chroot jail. Hell just put in "break out chroot" as search terms into google, and 5000+ pages come up. While chroot's nice, it's not the almighty security tool most people believe it is. (I'm not sure that having a VM that runs your software would be). UML might be better, or possibly another VM layer. The problem is, you need your VM to be completely audited for all interactions to make sure nobody can b

    • It's not so much isolating the services from the rest of the system, but making it possible to completely remove the chance of a buffer overflow type exploit. This means we don't have to waste our time auditing server applications for those types of holes (which seem to make up the majority), we can just audit the virtual machine once.

      By virtual machine, I'm talking about a Java or .NET runtime, one that controls access to the memory for all programs that run on it.
  • StackGuard (Score:5, Interesting)

    by drdink ( 77 ) <smkelly+slashdot@zombie.org> on Monday April 07, 2003 @01:40PM (#5679972) Homepage
    You might want to check out StackGuard [immunix.org]:
    StackGuard is a compiler that emits programs hardened against "stack smashing" attacks. Stack smashing attacks are the most common form of penetration attack. Programs that have been compiled with StackGuard are largely immune to stack smashing attack. Protection requires no source code changes at all.
    • Re:StackGuard (Score:3, Interesting)

      by Matt2000 ( 29624 )

      Could I compile existing software, like sendmail, with this and that would remove buffer overflow style explots? If so that's very interesting, how come the binary RPMs that Redhat and crew aren't already compiled with a tool like this?
      • Yes that's what distributions like Immunix [immunix.org] do, but notice that even with the extra protection they offer they still update their packages everytime a new hole is discovered.

        Stackguard isn't a magic bullet, and isn't gonna stop you from being 0wn3ed. Typically it just means that the released exploits won't work, and that's also the case for odd architechtures like Alpha - most of the released exploits are for intel, so avoiding that gives you as much protection as the stack guard compiler.

        The same with th

    • StackGuard is good, and it would be better if distros included stackguard-compiled binaries by default.
      Unfortunately, it only protects against a certain (common) kind of stack buffer-overflow. It does not protect against heap overflows, integer overflows of most sorts, double-frees, printf-style attacks, etc. Unfortunately, many of the recent exploitable bugs have been of this sort. StackGuard does help some, but it wouldn't help as much as a virtual machine, or simply a safe language.
  • red pill (Score:3, Funny)

    by David_Bloom ( 578245 ) <slashdot@3lesson.org> on Monday April 07, 2003 @01:42PM (#5679982) Homepage
    Just hope the client doesn't take the red pill. I'd think a virtual machine would be more vulnerable, as there is potential to trick it to run code "outside the box".
  • User-mode Linux (Score:5, Interesting)

    by quakeslut ( 107512 ) on Monday April 07, 2003 @01:44PM (#5679998)
    Is this [sourceforge.net] what you're looking for?

    quoted from page:
    User-Mode Linux is a safe, secure way of running Linux versions and Linux processes. Run buggy software, experiment with new Linux kernels or distributions, and poke around in the internals of Linux, all without risking your main Linux setup.

    User-Mode Linux gives you a virtual machine that may have more hardware and software virtual resources than your actual, physical computer. Disk storage for the virtual machine is entirely contained inside a single file on your physical machine. You can assign your virtual machine only the hardware access you want it to have. With properly limited access, nothing you do on the virtual machine can change or damage your real computer, or its software.

    • That's not quite what I was getting at. User mode linux is a more safe way to run services that might suffer from overflow style exploits, but it still doesn't stop those exploits from occuring.

      I'm looking for one place to prevent those exploits (in a VM), and then build secure services on top of that.
  • I think there is (Score:3, Informative)

    by (trb001) ( 224998 ) on Monday April 07, 2003 @01:44PM (#5679999) Homepage
    Isn't Trusted Solaris basically just this? At an OS level, you associate trust levels that permeate throughout your network. Two (or more) people can work on the same box at the same time and view completely different boxes because of their trust level. One trust level can't talk to or look at another's processes without the proper authorization. Like Unix file privs only much, much more controllable.

    Actually, trusted computing is a pain in the ass for standard development...we always wound up creating a super user program that can run stuff anything to get around priv issues during development. I can see using a system such as this post beta development or for production, but developing under it is a bitch.

    --trb
    • > Isn't Trusted Solaris basically just this? At an OS level, you associate trust levels that permeate throughout your network.

      I think this kind of approach is better than creating virtual machine sandboxes that still run the old weak UNIX security model. If someone 0wns your sandboxed apache, they can still likely cause
      a DoS with it, or propogate worms, or pretty much anything really.

      Good use of iptables and linux "capabilities" can help a lot with limiting what an application can do, but still don't g
    • Isn't Trusted Solaris basically just this? [...] Two (or more) people can work on the same box at the same time and view completely different boxes because of their trust level.

      Plan9 has the ability to isolate 2 processes completely from each other, since all they have in common is accessed via the FS and mounts are process-specific in Plan9. Hurd presumably has the same ability given that it's based on the same principles.

      The concept is a better one than Unix has - Unix has the FS in common between pr


  • How about a list of J2EE servers each in its own chroot jail and the apps executing in Java. How much security is too much???

    I personally think the BSDs are secure enough, and if Sendmail is replaced with qmail and apache constantly patched, there are no worries. No need to go to such extremes for production environments. After all. Performance is an issue as well.
  • Check out the -fbounds-check flag for gcc. The x86 architecture even includes a bound [uiuc.edu] instruction for this purpose.


    ISO Pascal requires all array accesses do boundary checking (although most compilers let you disable that for performance reasons).

    • From the gcc 3.2.2 man page:

      -fbounds-check
      For front-ends that support it, generate additional code to check
      that indices used to access arrays are within the declared range.
      This is currenly only supported by the Java and Fortran 77
      front-ends
      , where this option defaults to true and false respec-
      tively.

      Does rather decrease the utility of the thing.
  • A VM won't give you any security that you can't get from the OS, because it will still need to have access to things to do its job. That means that a hole in the VM or the program it's running can be just as bad as a hole in a C program.

    What you're really looking for is services written in a language that make buffer overflows and the normal security problems more difficult. That means that you're looking for mail servers, web servers, etc. written in languages with built in string types and garbage collec

    • You can effectively make a VM buffer overflow immune by auditing just the same as you can with any other program, but the difference is that then anything that gets writte on the VM is immune to that class of problem as well - a great gain in security.
  • by Deagol ( 323173 ) on Monday April 07, 2003 @02:27PM (#5680278) Homepage
    Unless I misunderstand your post, I don't think isolating an application inside a VM will do all that much good. I mean, I can run Apache on Red Hat under a VMWare virtual server. However, it can still be broken into the same as a real machine.

    Still, there's some merrit to the idea that having each service isolated in its own VM. At least there's some partitioning, and one "captured" service may not interfere with another. Though I'd argue that you should do this same partitioning by using real hardware.

    Here's what I do, and it doesn't require that much more overhead:

    At the IP level, I use iptables for a default-deny setup. Nothing gets in or out unless I explicity account for it, logging everything that violates policy and then silently dropping the packet.

    At the kernel level, I use the grsecurity patch to shore up generic, known weaknesses (stack smashing, buffer overruns), as well as the various randomizations of PIDs, socket numbers, etc. I tried using StackGuard and libsafe for this kind of stuff, but found them too troublesome (plus, grsecurity addresses most of this stuff).

    At the application level, I chroot what I can. I then use tcp_wrappers (for apps that use it) in a default-deny config, plus any ACLs that the application itself manages.

    Of course, I try to keep up with gaping security holes in services I run. However, I don't find myself scrambling out of fear that my boxes are in much danger when there is an advisory.

    These many layers add up to a pretty secure box, that's functional and no more of a hassle to admin that a stock installation.

    • That's a good list. The only thing I'd add is to suggest using something like LIDS [lids.org]. The basic notion is that you add something to the kernel so that root is no longer a trusted account. Instead, you give very specific permissions to each program that needs them.

      That way even if somebody does compromise, say, named, they won't be able to screw with much. And since LIDS logs attempts to violate security, as soon as they try to, say, view the password file or alter the logs, I'll know about it.

    • That's not quite what I was getting at. I was asking why things aren't run in a virtual machine that can provide one place to audit to protect against buffer overflows. Meaning that if you are 99% certain that your virtual machine is safe, then anything that runs on top of it will also be 99% safe from those types of attacks. This is in contrast to having to be 99% sure of each and every native mode application that you run on your machine.

      This is the fundamental difference between trying to protect you
      • I think I follow you now. What you're looking for is a binary sandbox, just like (as you state in another post) Java bytecode apps are run in virutal isolation, with the Java "VM" keeping strict tabs on the system calls the application makes.

        The idea sounds pretty neat. But is sounds like a pretty tough challenge. You may just as well ask for a complete overhaul of the way unix systems work (all-powerful root account is evil, etc.). As others have pointed out, the best bet seems to be the various ACL


        • Not quite. I'm not advocating user permission isolation or resitrction by the VM, just memory control. For example, in Java there are no pointers and all bounds checking is done by the VM, so buffer overflows are non-existant.

          If you managed to hack the password on an app running on the VM you'd still have that user's level of access, but we can be fairly certain that hack would not occur as a result of an overflow style attack.
          • What you are asking for cannot be done. Worse, it is a dangerous route to go down, because it gives an illusion of safety.

            From a VM level you cannot know what a program it up to unless that program obeys certain rules. When dealing with x86 architecture (specifically), those rules are not sufficiently verbose to allow for the sort of checking you are after.

            While a VM could intercept all stack access and prevent modification to the return address (presenting stack smashing attacks), it cannot tell if a

  • by Electrum ( 94638 ) <david@acz.org> on Monday April 07, 2003 @03:14PM (#5680544) Homepage
    Monolithic, buggy programs like sendmail will always be a security nightmare [cr.yp.to]. That doesn't mean that secure code can't be written in C. qmail, for example, is completely secure [cr.yp.to]. If more programmers followed good coding practices, we would see fewer security disasters. A good start would be to stop using C strings and to start using the stralloc [cr.yp.to] concept.

    • I don't doubt secure C programs can be written, but we must ensure that everyone that writes a C program does write them in a secure manner. However, if people write their programs to a virtual machine then all we need to ensure is that the VM is written in a secure manner. That will lead directly to a more secure now, and in case new applications show up that you want to run. You don't need the qmail security guarantee to prove that there aren't buffer overflows, you know that the virtual machine has th
  • chrooting can accomplish much of what you want. Even if the process in question has an exploit, it is used, and the process gets compromised, the damage is contained to the chroot jail. And it's easy to find chrooted versions of popular (vulnerable) services. ftp, httpd, probably even sendmail.

  • Just because you are running a VM doesn't mean too much - in fact, it may be a bad thing, as security becomes less of a concern (no need to upgrade, doesn't matter if I am hacked).

    Imagine a Java sendmail installation running on a JVM. I may be able to compromise jsendmail, and while this won't give me local root, I may be able to use the compromised sendmailer to implement social engineering hacks.

    Also, if the VM is designed to run "safe" languages that rely on static type checking for safety (such as jav

    • I totally agree that it's not a "solve-all" solution to the problem, I just was thinking it would be a way to greatly reduce or eliminate a whole (large) class of security problems in one step.

      And yes, the programs are only as secure as the VM, but at least then you can focus on the VM for audits.
    • Mistaken reasoning (Score:3, Insightful)

      by Tom7 ( 102298 )
      > Imagine a Java sendmail installation running on a JVM. I may be able to compromise jsendmail, and while this won't give me
      > local root, I may be able to use the compromised sendmailer to implement social engineering hacks.

      How do you expect to compromise jsendmail? If sendmail were written in java, then the 2 most recent bugs would not have been exploitable. Part of the point is that safe languages like Java are not vulnerable to buffer overflows, double-frees, etc.

      > Also, if the VM is designed
  • I hope somebody takes the time to audit the VM. No, I hope a lot of people take the time to audit the VM.

  • I wish people didn't (for whatever reason) equate Virtual Machines with language-level safety. It's true that Java was the first mainstream OO language with C-like syntax, but is this really the only experience that anyone has with safe languages?

    Let me try to set the record straight: The features of Java that make it good for writing secure code are independent from the VM. Those features are things like array bounds checking, lack of pointer arithmetic, checked casts, and garbage collection. All of these
    • This is complete bullshit. The Java VM is exactly what makes the language safe. Even if you use Java assembler you can't overflow an array boundary, because the VM knows what an array is, knows its limits, and executes the instruction to set an element of the array on your behalf. Most of the RuntimeExceptions and all of the Errors in Java are thrown directly from the VM, not from code libraries.

      This means that you can take an arbitrary, untrusted Java executable and run it, and it will not be subject


      • The VM is not what makes the *language* safe, unless by language you mean Java Bytecode. Java the language specifies array bounds checks and garbage collection, etc., and if you compile it natively, it is still safe. Why is this bullshit? (I happen to be resesarching programming languages for my PhD, so I do know what I'm talking about, here...)

        > It is certainly quite possible to take any sufficiently constrained language and compile it to native code such that it is
        > not susceptible to buffer overfl
        • The issues we are contending are based on the understandings of two concepts: what is Java, and what is a VM? These sound like easy questions to answer, but they are not.

          Java does not refer to the grammer, nor does it refer to the VM. Java refers to a platform. The grammar, execution machine and a basic set of libraries are all included in the specification, and cannot be meaningfully separated without altering the behaviour of the thing we call Java. This is perhaps most clear when you consider that

          • OK, I'm with you here. When I say Java I mean the source language (since it is so easy to separate from the rest, if you ignore things like class loaders and reflection), but I'm sure Sun would agree with you. But:

            It's true that the safety in a program is often manifest somewhere in the "runtime" or "VM". A good example is garbage collection -- surely, even in natively compiled code, there is a runtime system that implements GC. But stuff like array bounds checks are not necessarily part of this. For insta
  • There's a lot of confusion on this thread as to why you'd *want* a virtual machine when you can always just run your servers with isolated privileges. Good question. I'll take a stab at that:

    The two are both excellent ideas, and are essentially orthogonal. Privileges protect a server's interactions with other processes and the rest of the system. They limit its use of the file system, network ports, and sensitive APIs.

    However, permissions can't limit a program's interactions with itself -- and that's

    • You neatly summed up the debate for me there. Most of the posts on here have confused user permissions with what I was getting at with the virtual machine angle.

      Perhaps I wasn't clear enough by not providing an example, but as I'm a Java programmer too I didn't want this to immediately devolve into a language war. I don't need to have everything I run on my system be written in Java, but it'd be nice if they were on a common secured runtime.

      Wow, that's starting to sound like .NET
    • > That's one of the things I like about programming
      > in Java: private members are truly private, and
      > it's physically impossible for other code to
      > access them, except as I expose them.

      What you mean you can't do this?

      // Make it accessible
      privateField = String.class.getDeclaredField("value");
      privateField.setAccessible(true);

      String foo = new String("foo");

      // Read it

      Object oldValue = privateField.get(foo);

      // Change it

      privateField.setValue(foo, new char[] {'b', 'a', 'r'});
      (
      • Wow. I am flabberghasted. That's utter nonsense, and it works!
      • I was wondering how this was even remotely reasonable. Here's the answer:

        If there is a security manager, its checkPermission method is called with a ReflectPermission("suppressAccessChecks") permission.

        So you still have complete private field sealing, but only if you explicitly turn it on. It's more than a little disturbing that this permission is enabled by default. Still, I suppose if you're writing a security-sensitive server, you'll configure your security manager to be very secure.

        Does anybody kno

  • Uhm, so what happens when someone compromises apache and replaces your website with the goatse guy?

    Whole lot of good that jail/UML/whatever virtual system did you then.

    Either keep your software up to date, or turn in your sysadmin badge...
  • I see lots of post that various stuff is better or good enough. I think that's missing the big picture. A truly secure system doesn't rely on only one security methodology.

    I think VMs are a very useful and valuable for setting up secure servers. But like most other aspects of security they don't make a secure system on their own.

    They provide another method of isolation of individual applications that potentially have buffer overflows. There's no reason for example a user mode linux install couldn't be
  • When I read this I thought of Valgrind [kde.org]. It's a program designed to find memory management problems such as memory leaks and using unitialised memory. The program being tested runs under Valgrind so it is very much like a virtual machine. I've never thought of running a server under it, but if you can stand the (probably substantial) performance hit it would probably do what you're intending.

Say "twenty-three-skiddoo" to logout.

Working...