Slashdot Mirror


Can Reverse Engineering Help In Stopping Worms?

krozinov writes "The goal of this paper is to try to answer the following three questions: How do you reverse engineer a virus? Can reverse engineering a virus lead to better ways of detecting, preventing, and recovering from a virus and its future variants? Can reverse engineering be done more efficiently? The paper is organized into five sections and two appendixes. Section 1 is the introduction. Section 2 reviews basic x86 concepts, including registers, assembly, runtime data structures, and the stack. Section 3 gives a brief introduction to viruses, their history, and their types. Section 4 delves into the Beagle virus disassembly, including describing the techniques and resources used in this process as well as presenting a high level functional flow of the virus. Section 5 presents the conclusions of this research. Appendix A provides a detailed disassembly of the Beagle worm, while Appendix B presents the derived source code of the Beagle virus, as a result of this research."

42 of 187 comments (clear)

  1. Waste of time by zerguy · · Score: 3, Insightful

    If I understood the article, they are trying to reverse-engineer worms to find out how they work. Why not just ask the numerous people who were black hats but now work for security firms?

    --
    **This begins my ever-changing sig
    We need a -1 RTFA moderation option!
    **This concludes my ever-changing sig
    1. Re:Waste of time by mytec · · Score: 5, Insightful

      The virus, worm, trojan field advances, sometimes rapidly. If a new worm arrives that hasn't been seen before how much help can someone be that hasn't written or played the game in a year or longer? I think your question, and I'm not attacking you, is much like asking if forensic science is needed, just ask the murders....

      I think the third question, can reverse-engineering be done more efficiently, is the important one because it will help question #2 significantly.

    2. Re:Waste of time by ajs · · Score: 5, Interesting

      No. Reverse engineering is key in understanding what virus writers are doing TODAY, and how the state of the art is progressing. It is hoped that you will conclude, "these are just a bunch of script kiddies who don't write unique and interesting code," but in reality dissassembling this stuff reveals that the Virus/Worm writing market is getting quite sophisticated. Tracking the advances and giving that information to the white-hats is key.

    3. Re:Waste of time by bdash · · Score: 2, Interesting

      Give it up, if you have something mission critical. Don't use windows or internet explorer. Use linux and firefox.

      If it's mission critical why the hell are you running a web browser on it anyway?

  2. Reverse Reverse by teiresias · · Score: 4, Interesting

    what happens when they reverse engineer the reverse engineering you did on the virus they originally wrote? if we look into the biological field, fighting viruses only makes them stronger. Not that we shouldn't but the better the anti virus writer becomes, the better the virus writer already is.

    --
    -Teiresias
  3. better solution? by Jrod5000+at+RPI · · Score: 4, Insightful

    perhaps it would be more insightful to study WHY individuals expend so much time and energy writing viruses, worms, etc. in the first place.
    in the future, i suspect this sort of malware will only get worse in terms of technical complexity, but the reason for their creation will probably be roughly the same.

    my $0.02

    1. Re:better solution? by zerguy · · Score: 5, Insightful

      That's a good idea, but the problem is that there is no way to prevent people from writing malware. The general reasons people create malware are:
      1. For fame
      2. For fun
      3. For profit
      4. They have some sort of grudge
      5. To show off

      These are all basic human instincts, manifested in a bad way. There is really no way to prevent anyone from having any of these desires.

      --
      **This begins my ever-changing sig
      We need a -1 RTFA moderation option!
      **This concludes my ever-changing sig
    2. Re:better solution? by zx75 · · Score: 3, Insightful

      Some common answers:
      a. Because they can.
      b. To see if they can get away with it.
      c. They believe they can't be caught.
      d. To get attention/gain 'respect'.

      These tend to be recurrent reasons given for a lot of crimes that do not seemingly provide any benefit to the criminal. Grafitti is another, as is petty theft when the person in question is not thieving because of any real desire to have the stolen item or profit from it.

      --
      This is not a sig.
    3. Re:better solution? by Ingolfke · · Score: 2, Funny

      On second thought you really could be on to something here. The reason people expend so much time and energy writing viruses is because they have time and energy to expend. So if we forced everyone to work in the mines for 15 hours a day, they would have no energy, and no time. Problem solved.

      On a side note, I doubt anyone from EA writes viruses.

    4. Re:better solution? by micromoog · · Score: 2, Insightful

      There's no surer sign of someone being "in it for the wealth" than saying "I'm not in it for the wealth".

  4. Reverse Engineering a virus... by jmcmunn · · Score: 5, Insightful


    It only helps if the people who write future variants are lazy...so I guess yes, it will help with there not being versions A-ZZZ of the bagle virus, but the serious ones are still going to be out there.

    It already takes very little time for them to catch most variants these days. My software (AVG) is usually a day ahead of any of the major news organizations on having the fix for any new virus out there. The new, creative, and dangerous virus are the ones that worry me not the 200th version of netsky that shows up.

    Perhaps the best way to control the spread of virus is to reverse engineer the OS/program that it is targeting...create fixes proactively and don't allow the exploits to be found in the first place. But there's probably a law or two out there that prohibits this kind of stuff, eh?

    1. Re:Reverse Engineering a virus... by zerguy · · Score: 2, Insightful

      You are correct. But can you imagine the uproar and legal battles that would ensue should anyone try to reverse-engineer, disassemble, or otherwise try to extract source code from Windows? This is exactly why there are no (or hardly any) viruses on Linux.

      --
      **This begins my ever-changing sig
      We need a -1 RTFA moderation option!
      **This concludes my ever-changing sig
    2. Re:Reverse Engineering a virus... by Swedentom · · Score: 2, Funny

      create fixes proactively and don't allow the exploits to be found in the first place. But there's probably a law or two out there that prohibits this kind of stuff, eh?

      Laws against writing secure software? Well yeah, that'd explain quite a lot. ;-)

      --
      Sig Nature
  5. Re:Well by igny · · Score: 3, Funny
    Why didn't I think of that:? :P

    Because you didn't have time trying to post the first post?

    --
    In theory there is no difference between theory and practice. In practice there is. - Yogi Berra
  6. Pinky are you thinking what I'm thinking? by FerretFrottage · · Score: 4, Funny

    I think so Brain...is the virus protected by the DMCA and the other various software laws that prevent reverse engineering? If so, who is really in the wrong here?

    --
    "Look Lois, the two symbols of the Republican Party: an elephant, and a fat white guy who is threatened by change."
    1. Re:Pinky are you thinking what I'm thinking? by Anonymous Coward · · Score: 3, Funny

      It's OK, as long as they are reverse-engineering it to port it to another platform. ;-)

  7. Netcraft confirms it:SOVIET RUSSIA jokes are dying by Anonymous Coward · · Score: 3, Funny

    Yup. Suck it.

  8. This isn't reverse engineering at all! by Anonymous Coward · · Score: 3, Insightful

    Virus are not protected by copyright, patents etc.
    Reverse engineering is when you disassemble and recreate a the original source (which they did) -- the easy part. Then, the hard part is to create a set of specifications without referring to the original code or snippets, then handing that over the "wall" to someone who has not been exposed to any of the IP of the original and rewriting the code from scratch ... that is what Compaq, Phoenix, and the others had to do with BIOSs and people emulating Windows, Unix etc had to do, otherwise, they would just be copying from the original and rewriting (trivial in comparison). Let's start using the appropriate terminology.

    1. Re:This isn't reverse engineering at all! by Daengbo · · Score: 4, Informative

      No. What you described is clean-room reverse engineering. Regular old run-of-the-mill reverse engineering means taking the "black box" and figuring out exactly what it does.

    2. Re:This isn't reverse engineering at all! by radish · · Score: 2, Interesting

      Of course a virus is protected by copyright. It's something that someone created, thus, unless they explicitly gave up their rights, it's fully protected.

      --

      ---- Den ene knappen er powerknapp, den andre er Bender voice knapp "Bite My Shiny Metal Ass"

  9. What about worm EULAs? by G4from128k · · Score: 4, Funny

    Coming in a packet near you, from the EULA of the future:

    By connecting a computer to the internet, you hereby agree to the terms of this agreement (hereafter referred to as "deal with the devil") for this software (hereafter referred to as "CPU sucking nightmare") ......

    Won't surprise me if virus/trojan/worm/spyware writers use IP law against those that would hope to rid the world of their menace.

    --
    Two wrongs don't make a right, but three lefts do.
    1. Re:What about worm EULAs? by oberondarksoul · · Score: 2, Informative

      They'd never be able to; to come out and say "you reverse engineered my virus" would be a confession of having written the virus in the first place, and would probably result in their prosecution. If I were a virus author, I'd keep my head down whilst inwardly laughing, not pop out and say 'I did it'.

      --
      And tomorrow the stock exchange will be the human race
  10. Well... by bmo · · Score: 3, Interesting

    Wouldn't the first goal be writing applications and operating systems to be more secure than they are now with ordinary common sense designs? You know, like not tying userland software to the OS in incestuous ways?

    Simple stuff like that...

    Get rid of IE and get rid of Outlook Express and you get rid of 90 percent of the threat.

    This would be a plug for Linux, as I use it daily, but there are things that Windows users can do to keep from being screwed every day. If only Mickeysoft helped their users rather than write crap software.

    --
    BMO

  11. Too much indirection by shoppa · · Score: 4, Insightful
    Viruses/Worms themselves work usually be finding a buffer overflow in an OS or application. They are themselves the result of reverse engineering.

    It would seem a better defense to use whatever reverse engineering tools are available to fix the application. Things like Purify etc. are of some use for many common problems.

    Adding additional/patched code onto a virus/worm sounds like dangerous business to me. Suppose you didn't do everything exactly right, you are now responsible for releasing a new virus into the wild.

  12. Understanding The Pathology Is Important But... by EXTomar · · Score: 4, Insightful

    To borrow the medical anology, pathology of a virus is important but this alone will not create a "cure". You may understand completely how a virus works but this alone does nothing to hamper it.

    To even be more suscinct, if all it took to stop a virus was to reverse engineer it (ie. pathology), then we'd have things like AIDS, Herpes, etc. beat long ago. We clearly understand how these things spread yet infections still happen. Likewise, we already know a lot how virii spread on Windows and form best practices and yet comprimising still happens.

  13. It's easy and it wont' work. by sporty · · Score: 3, Insightful
    A virus exploits something about a system.


    Back in the DOS days, the fact that code on a floppy header or something would get executed on insertion was a problem. Solution, don't bring that into memory for execution.


    Word, at a point, by default, would execute macros on load of a document. Don't bring in code from a document and execute it.


    In outlook, looking at email can cause JS to execute which may have it's own problems due to the implementation of js. Don't execute the JS.


    Don't try and figure out how viruses work. Figure out what they exploit and close them up. Duh.

    --

    -
    ping -f 255.255.255.255 # if only

  14. Why RE? by RAMMS+EIN · · Score: 2, Insightful

    Why reverse-engineer? Most malware is put together by script-kiddies from parts they get from elsewhere, and a lot of information is publicly available. If script-kiddies can get their hands on it, so can you.

    --
    Please correct me if I got my facts wrong.
  15. An interesting read by Pinkoir · · Score: 3, Funny

    I would like to thank the author of that paper for making it abundantly clear to me that I am not smart enough to operate independently in today's technological environment. I would like to take this opportunity to bow down before my compsci-savvy overlords swear to just mindlessly accept whatever code they produce.

    -Pinkoir

  16. Little help, but help anyway... by gmuslera · · Score: 2, Informative

    3 points:
    - knowing how it technically works dont disable the social engineering component, very trivial worms were very sucessful just for that.
    - there are a lot of worms that have the source available in a way or another, from the first ILoveYou worm (well, most .vbs ones are that way) to latests Bagle or Netsky variants, that even have the source attached.
    - Some worms also are maybe simple exploits of software vulnerabilities or weakeness (mostly MS.*, but there are some for other developers and operating systems). What must be understood there is not the worm source, but what it exploit and why that software is used.

  17. This is about programs, not biology. by khasim · · Score: 3, Insightful
    what happens when they reverse engineer the reverse engineering you did on the virus they originally wrote? if we look into the biological field, fighting viruses only makes them stronger. Not that we shouldn't but the better the anti virus writer becomes, the better the virus writer already is.
    Hardly. If that were so, then Linux would currently be under attack by the toughest viruses and worms ever seen.

    Viruses and worms exist because security models and implementations have vulnerabilities.

    You see so many Windows viruses and worms because Microsoft's security model has some very basic flaws. Instead of dealing with them, Microsoft relies upon 3rd party anti-virus companies to issue very specific "patches" for each virus that comes out.
    1. Re:This is about programs, not biology. by BeerCat · · Score: 2, Interesting

      he script kiddies won't target Linux, since they don't have a clue about it.

      For now. I am reminded of Ken Macleod's "Cassini Divsion", where all electronic computer systems have been compromised by the "fast folk". An initial attempt to fight them, using a ship controlled by a different electronic system, succeeds for a bit, but is quickly also taken over, as the viruses mutate enough that even a different operating system is not effective protection.* So, for the sytstem used by the "fast folk" read Windows (all varieties), and for the "other" system read Linux / OS X (IIRC they thought they were safe because the hardware was different)



      *They succeeded by using mechanical computers, akin to those in Gibson's "The Difference Engine" (a novel that assumed that Babbage's difference engine was not only built, but mass produced)

      --
      "She's furniture with a pulse"
  18. Am I missing something here? by krvw · · Score: 3, Insightful

    I've got to be missing something here. Reverse engineering worm/virus code with tools like IDA Pro has been actively done by the anti-virus community for 17+ years. In November 1987 when a virus hit us at Lehigh University (where I worked at the time), a bunch of our students helped out by disassembling the virus and writing a piece of software to prevent it from spreading further.

    And we didn't feel that this was even groundbreaking work back then...

    What am I missing here?

    Cheers,

    Ken van Wyk

  19. E-Mail lists by Andrewkov · · Score: 2, Interesting

    One interesting point of the article -- The Bagle virus seaches the hard drive for email addresses to send itself too. If Outlook, Mozilla Mail, and other email clients used encrypted contact lists, that would prevent a lot these worms from propagating. I hope that's something that email client vendors will look at.

    1. Re:E-Mail lists by StormReaver · · Score: 2, Insightful

      "If Outlook, Mozilla Mail, and other email clients used encrypted contact lists, that would prevent a lot these worms from propagating."

      The email program itself would need to decrypt the list in order to use it. Any 3rd party program which requested email services from the email client (think COM) would need to have an exposed API to call in order to request that service. A virus would only have to call that API to decrypt the list.

  20. Exploit the worm's scanning engine to slow it by ftzdomino · · Score: 4, Informative

    Most worms these days scan IPs to find other exploitable hosts. I always thought we should look for exploits in the worm's scanning engine and then attempt to crash it by responding to its scanning requests with data which would do something like exploit a buffer overflow or off by one attack. These crashing response daemons would be located on systems which don't normally take requests of the service type the worm exploits. That way these would be very unlikely to affect anything legitimate. A worm whose scanning code has been crashed would be unlikely to infect other systems. It's also unlikely that crashing the scanning code would affect other services on the infected machine, limiting the legal liability of such a thing.

    I've had some luck against people scanning web servers for formmail.pl scripts. My formmail.pl sends random data without any CR or LF. One script so far accepted 2gb of data before disconnecting.

  21. Been done by wayne606 · · Score: 5, Interesting

    I remember when the RTM worm first appeared (was that '86?) and several Berkeley students stayed up all night decompiling it (this was VAX code so it was a bit more manageable). They posted the source code the next morning with bug fixes, including the critical one that turned the worm from a slow-moving annoyance to a rampaging network-killer...

  22. Can Reverse Engineering help stop worms and virii? by DrDebug · · Score: 2, Insightful

    Simple answer: No.

    The worm (or virus) is already out in the wild. Seeing how it works won't stop it.

    But seeing what it exploits might.

    There is a 99 percent chance that the worm/virus will exploit a known hole in the target application/operating system. Nowadays, these exploits have come much, much quicker than in the past. It used to be a few months before a hole was exploited; now it can be just a matter of hours.

    What would impress me is if they reverse-engineer a worm/virus and find that it exploits a hole that was unknown beforehand. Now THAT would show some intelligence on the part of the author (if not any ethics). The 'kiddie-scripters' that mutate the source code from a worm/virus and just hex-edit their initials into it aren't very creative at all; just adolescant vandals who want to make their mark with their brethern vermin in the dark underworld of the Internet.

    It's not that virus/worm authors are anything to be emulated. But you have to respect them. Like you have to respect terrorists. You may lothe them, but you have to respect them.

    However, reverse-engineering IS useful. It is forensics. Someday, maybe soon, the forensics team will be able to catagorize and maybe even identify the author of a virus by the way it is written. Currently, it is helpful in finding those security holes, so they can notify the authors of the program being attacked.

    Let's face it folks. Programming is still more of an art than a science. We imperfect human beings are trying to write perfect code, because the computer does exactly what it is told to do. We humans don't operate at that level very well. So we write imperfect code; something that can be eventually exploited given time and resources of anyone willing. It's gonna happen, whether your code comes from American, Indian, or Ukranian programmers. There are evil people out there, and they are going to check the doorknobs of every program to see if they can get it and cause trouble. Until someone comes up with a source-file hole checker, be prepared for more worms and virii.

    OK, I'm done ranting.

  23. Sanitary practices and the evolution of germs by Frater+219 · · Score: 4, Insightful
    In the realm of biological viruses and bacteria, there are steps we can take to discourage the evolution of worse and worse plagues. Although computer viruses are designed rather than evolved, some of these may apply to the computer realm as well.

    It's well-known that a parasite that kills its host damages its own chances for survival or reproduction. A germ that doesn't make you sick enough to stay home from work leaves you in able condition to cough that germ all over your coworkers. One that kills you right off has a much decreased chance of spreading to those people ... that is, unless your town is in the habit of leaving corpses lying around.

    If germs in corpses are able to infect the living, then there is much less "incentive" for germs to leave their hosts alive. If, on the other hand, your civilization isolates corpses, especially obviously infectious ones, then being in a corpse becomes a bad replication strategy for a germ.

    This is clearly a way in which human cultural practices affect the evolutionary environment of infectious disease organisms. Under medieval conditions, the Black Plague was pretty darned optimal as a survival strategy. In isolated villages in Congo, the Ebola bacterium can leave messy, nasty corpses lying around and still survive. In places with more effective medical response, that would not be a very effective survival strategy.

    What is the analogy to computer viruses? Right now, large portions of the Net have ridiculously crappy "medical response" to computers that are effectively "killed" (rendered useless) by virus and worm infection. Most commercial ISP networks are, to the unprotected Windows computer, the equivalent of rolling around naked in medical waste. This septic environment, in which dead and dying bodies are left to rot and spread their infections, just promote viruses that completely overwhelm the host.

    Moreover, the average Windows system and user have the equivalent of terrible hygiene practices. Personal hygiene, in the real world, means that you avoid filthy things when you can; you wash when you've come into contact with them; you wash regularly even if you don't think you have filth on you; and you make sure not to mix filth with your food. Public hygiene means that your society keeps filth and corpses away from the food supply, and keeps rotting garbage off the open street. When these practices break down, you get plagues.

    How to prevent this? First, some rudimentary public sanitation would help -- when a system is infected, it must be quarantined and prevented from infecting others. Second, computer users must learn to choose software which has good sanitary practices -- isolating untrusted data ("filth") from the system software ("food") and making sure to clean up those parts of the system that come into contact with the filth.

    Can Windows do this? I don't know. The SP2 firewall settings are an improvement. However, it is still a system with terrible hygiene, since user software which handles filth routinely runs with administrator privileges that have access to the food supply. Ick.

  24. Linux has a few million users. by khasim · · Score: 3, Interesting

    Even by the most conservative count, Linux has a few million users. That's more than enough to support a virus population.

    Even the old MS-DOS machines had a viable virus population, although the viruses, for the most part, had to be hand transported via floppies to each machine.

    With network enabled machines, it should be even easier to spread viruses. And it is. Just look at all of the Windows viruses, worms and trojans that are out there.

    If Linux was as un-secure as Windows, a simple link on /. would be enough to start a major Linux virus.

  25. Lack of competences? by Knx · · Score: 2, Insightful

    I think one reason why RCE is not done as fast as it potentially could might be that there are just fewer and fewer programmers out there who are able to quickly read, analyse and understand assembly code. Because they're simply not familiar enough with it.

    One obvious but irrefutable idea which arises from this article is that while we're almost all writing in hi-level languages nowadays, the final code is still in assembly. (Ok, that's not quite true for Java and the like, but let's focus on decent fully-compiled languages! ;-p /trolling) So, yes: RCE is usually done from assembly code.

    Now, how many IT schools are still providing decent assembly courses? The fact is, we don't need to understand assembly nowadays to become a programmer. Most of my co-workers just have no idea what assembly is, or even how a binary number looks like. Incidentally, it does sometimes show up in the way they're writing code in hi-level languages. For instance, they would write "x/4" when I would write "x>>2". But then again, who cares? Today's compilers should optimize that by themself, anyway. Ok, enough digression.

    My point is that an efficient RCE requires very specific competences, including but not limited to a very good knowledge in assembly and some months -- or, better, years -- of practice. This last point is important. Assembly coding being wild by nature, I believe it requires much more practice to be able to detect common structures, common tricks, etc. If you've just learned a trick without using it, chances are that you will just miss it in a foreign piece of code. (A "trick" being produced by either a hardcore pirate still directly writing in asm or the compiler used by some script-kiddie.)

    And finally, one reason why many white-hats among the virus-fighting-gang actually are former black-hats might be that not enough IT schools are providing a formation which is sucessfully matching the above criteria.

    --
    The problem with Slashdot memes is that YOU INSENSITIVE CLOD!
  26. Re:Because most virii are already freely available by walt-sjc · · Score: 2, Interesting

    If you REALLY RTFA, this is about malware / viruses (there is no such word as virii) that require human intervention - the nasty stuff that idiots click on due to simplistic social engineering. This is not about malware that (for example) go in via the RPC hole or other vulnerability.

    The POINT is that copycat versions may be caught by looking at how the original works and what it does in general rather than some kind of binary pattern match like the current generation of AV does.

    Many of the AV vendors claim that they have code that can detect mutated versions of malware, but in practice they never do.

  27. Re:Well by jsitke · · Score: 2, Interesting

    I was always under the impression that viruses are commonly reverse engineered. Doesn't sound like news to me.