hello hello everyone thank you thank you for coming here thank you to the organizers of the DEF CON for selecting my paper and not scheduling it at the same time as the DNS paper because otherwise the audience will be empty I think before starting the talk I would like to talk about definitions before studying any discussion you should settle on some definitions otherwise it'll be pretty pointless you wouldn't know what you are arguing about so yesterday when I've got my badge from DEF CON and I started hacking it I went to the website that was created by Kingpin that describes the badge and all the details about it and I stumbled on a very interesting definition on that page and that's the definition given by Kingpin and it defines a hacker to me a hacker can simply be defined as somebody involved in the exploration of the data and it defines a hacker to me a hacker can simply be defined as somebody involved in the exploration of technology somebody who wants to learn about technology and make it do things that never have been done before it's about creativity education experimentation and having fun and the hack in the technology would usually define a new and novel creation or method of solving a problem typically in an unorthodox fashion I think it's a great definition and I'm pretty sure by this definition me and a lot of my colleagues at McAfee would be hackers and as a matter of fact they started my sort of hacking career back in 1986 when I wrote a bunch of assembler programs that were hooking into dos version 1.0 and providing keyboard support for Russian language and screen output in Russian and I was fascinated by the computing technology since then and cracked a couple of games studied hacking into computer viruses and that sort of activity became my hobby and in 1994 there was security company that suddenly wanted to hire me and they offered to convert my hobby into a job which sounded just great so I jumped on it and since then I was involved in professional security I really really love what DEF CON is doing because I'm seeing that DEF CON provides a hell of a lot of great spirit and diversity and some of colleagues of mine come here every year no matter whether the company would pay for that or not they're just regulars so they loved DEF CON just that much and let me tell you I love you too and now that you have that message in your mailbox open it it just could be a virus I'm hoping it's a good one so let's define the virus a virus as opposed to a Trojan or other piece of malware is something that replicates that creates recursively copies of itself so we will be talking about good viruses something that replicates not Trojans not just malware that hacks into your computer starts sending stuff out for instance just viruses stuff that replicates the idea of good virus appeared long long ago in fact Fred Cohen in his first mathematical definition of a computer virus has a chapter describing how to create a good virus why is that why good or bad because viruses are created by humans and not by humans and not by humans and not by humans and not by humans people and people have intentions they can write something that does bad things they can write something that does good things and the argument where the viruses can be good or bad was going on since then every now and then somebody talks about good virus that compresses files and creates more disk space for you or does some other maintenance jobs rolls out patches for you that sort of stuff but when I was looking at this as a matter of fact there were several papers written about good viruses back in the 90s but since then there were a lot of developments in the security field so I thought it would be worth looking at that again and the first question that I had about good and bad viruses is why are we talking about good and bad viruses and why are we talking about technology and viruses are just a way of expressing technology in software why are we talking about technology being bad or good can't be bad or good technology isn't just that it's something that can be dangerous sometimes for example take a nuclear reaction if it's an atomic bomb it'll explode the nuclear reactor and it'll kill a lot of people that's pretty bad then if the same nuclear reaction is running under control in a power plant at the nuclear power plant it creates electricity that's good for everybody if the atom is split in the laboratory it's research it's great Technology, bad or good, dangerous or not dangerous. When atom bomb explodes, it's pretty dangerous. Why? Why is it different from the controlled chain reaction in a power plant? Because of the lack of control. When something goes out of control, it becomes dangerous. Pretty similar situation is with viruses. And during my talk, I'll try to answer a couple of questions that don't really seem obvious. Can a virus be written accidentally? I mean, is it possible to try to write a program which isn't a virus intentionally, and you would end up with something that replicates? Do you think it's possible? It is. Can the virus get out of control? And you write it, you put controls in place, and it does something else. Is it possible? Very much so. So, in my talk, I'll tell you three stories. The first is the story of already 71, a tool, and the virus. It was written as a tool. It happened to be a replicating worm. We'll go through a disassembly and operation of it. Then we'll have a look at the second story, a corrupted blood incident in World of Warcraft. And watch a video, how it went out of control. And the third story, an example of W32 NACHI, a worm that exploited a vulnerability to patch it. And what happened? We'll discuss how patching vulnerability using worms can be. We'll also discuss how patching vulnerability can be used, and make some conclusions. So, before we go to the next slide, let me ask you a question. If we do a Google search on good virus and bad virus, what do you think will come up more frequently? So, who thinks good virus would come up more frequently? Please, raise your hand. I see just two hands. Who thinks that bad virus would come up more frequently? That's a hell of a lot more people. Now, the results of the Google search. As you can see, good virus comes up approximately 50% more frequently in the Internet search. But other searches, like, for example... ... ...beneficial virus, beneficial worm, bad worm, horrible, awful. ... ... ... the results. So in the end, overall, the total count of bad stuff is 127, and the total count of good stuff is just 108. The difference is only due to, well, mainly due to horrible and awful virus searches, which is when people got really, really annoyed or pissed off by a virus that hit their machine, I guess. Good virus is probably coming from people who discuss it in academic circles, in conferences, and give talks about that. I'm hoping this presentation wouldn't change these results seriously, but I'm sure it will. So the results would look even better. More positive for good virus. So let's start our first story about already.com, a tool and a worm. This tool was written in 1991 and published in a magazine called PC Magazine. It's a very simple tool. It's a program of... Just 71 bytes long, so we'll be able to disassemble it in full. And the usage of that already.com is on the screen. Initially, if you start a batch file and then execute already.com, it will return you an error level. If it's one, that means this program has been executed today. And then you can skip some stuff. Now, it might be with a lot of errors, or a lot of mistakes. Some errors, though, were really hard to remove. I POW together those errors. And, in an extra bay we had a test that changed two milliseconds. That allowed us to get 40 seconds. In some cases you can even substantively deduct these errors in Java. So red!!! Sorry. that. Here is the disassembly. I'm sure people at the back cannot see it, so I'll zoom it. And the program consists basically of three simple blocks. The beginning of the program is retrieving the current date from the operating system. That's right here. Then it compares the result with the current date and year that are recorded in the body of the program. And the date and year. That are recorded right here at the end of the program body. That portion. So if the comparison between the two is successful, the program just exits with the error level one, which means it has already been executed today. If the comparison finds a mismatch, then the program does the following. That's the most interesting part. It creates a file called already.com in the current folder, and writes itself into it after updating the values of the operating system. date and time that were obtained from the operating system that means it's a self-modifying program that creates an exact copy of itself overwriting the body of itself on the disk when it overwrites itself normally just four bytes will be modified two for a year two for the date and in that case it doesn't return the error level one it returns error level zero the name of the program that it writes to the disk already dot-com is embedded in the body of the program it's at the very end why that tool happened to be a virus that was due to the complexity of the environment where it was operating you windows is a concept of current folder so if a program is executed from a folder which is different from where it is saved it will write the copy in the current folder thus creating a new quarter of itself if you go to some other place executed again here then other copy will be created and if you do it regularly the whole of your hard drive eventually will be sprinkled with with copy of already.com all over it so let's have a look at how it happens in reality here we have a folder called C tools and there is one file already dot-com in it 71 bytes long that's the current folder that's the current file now we go in another folder called C C C backslash test do a dir on it and it's empty zero bytes now we run our already dot-com which is in C tools and it executes it from the folder called C tools naturally and And at that point, the program creates a copy of itself. So an empty folder. See test, had zero bytes. Got a copy of already.com, 71 bytes, after the execution of the program. That's how it replicates. And still, of course, even though being a replicating worm, it's pretty innocent. It does what it says and does it well. The point is that when you don't take into account, the complexity of the environment where you write the program, you might end up with something that exhibits additional properties. And if you use techniques that are generally not recommended, self-modifying code, programs that modify other programs on disk or in memory, do injection, or use exploits, something unexpected might happen. And the more complex... The more complex is the environment, the more likelihood is that that thing occurs. And insecure environments are unexpectedly common. Just about any piece of software has its insecurities, as we all very well know. So let's have a look at the second story, the incident in World of Warcraft. How many of you play World of Warcraft? Could you please raise your hands? Not really that many, but there are some people. Oh, I forgot to ask. Maybe there are people who used to play World of Warcraft and now are playing something else? Could you raise your hands? Oh, that's a lot more. Wow. Wow sucks. So that incident happened in September 2005. Did anybody play World of Warcraft in September 2005? Actually, there are like five or six people. That's cool. You might have experienced that corrupted blood incident. I would really be interested in hearing your first-hand experiences. So if you can find me... After the... After the talk in room 106, I'd just appreciate that. Anyway, that incident happened in September 2005 when Blizzard, the company that produces World of Warcraft, rolled out a new release of the game. It was World of Warcraft 1.7. And they added a new so-called instance dungeon called Zul'Gurub. That looks very nice. That's a picture of it. Let me magnify it. So that's a nice place. Unfortunately, inside of that place lives a very unpleasant monster. And the name of that monster was Hakka, the Soul Flayer. It was the god of blood. And when the developers were thinking of how to implement that monster, they came up with a very cute idea. If it's the god of blood, why wouldn't it infect all the players that attack it with a disease, with a virus? And they implemented a virtual virus in World of Warcraft. And it was called Corrupted Blood. It was done on purpose. It was programmed in the software. And the way it works is that... If this monster infects a player, that player can infect somebody else. And that thing was so infectious. There is no human virus or a bacteria that spreads with as much certainty as Corrupted Blood. This infects you with 100% if you are just standing in the vicinity of other victim. It's just deadly. What happened? That wasn't supposed to happen. But it did. An epidemic started in World of Warcraft. What exactly went wrong? The timeline of that event is such. World of Warcraft 1.7, that included that change, went out on the 13th of September 2005. The epidemic started on several servers. World of Warcraft is organized in several not-related servers. Some players play on one server, some players on another, and the epidemic started on several of them, at almost the same time, on the 15th of September. So it took players a couple of days to get to that new place and progress enough to face that horrible monster. And eventually it was clear that the source of that epidemic on all the servers was that Hakkar, the Soul Flayer that lives in Zul'Gurub dungeon. So, what made this viral infection, which was programmed, so deadly? The parameters of that spell are such. It hits any player with a damage of 200 health points. And players who can only get into this dungeon are really high-level players. They have a lot of health points, 4,000 or 5,000 or some such. So each hit of corrupted blood doesn't hit them for too much. The spell affects them for 10 seconds, and it gives them 5 hits every 2 seconds. So in total, it will subtract about 2,000 health points from an average player that goes into the dungeon. The radius of the infection is about 100 yards. Which means pretty much everybody who joined the raid against that dungeon is 100 yards away. And that monster would get affected 100%, as I said, more deadly than Ebola. By design, that infection should be very limited in time and space, because it lasts for 10 seconds, and then it's over. You either die, or you survive. The problem was that that's a viral infection. It spreads. And there was a security oversight in World of Warcraft. it spread not just from player to player it spread to also non-player characters it spread to the pets and pets it's something that you can summon in a game like a dog or unicorn something like that and it would get infected and then because you are the master of that that you can hide it you can unsummon it and when that happens the infection is conserved it's frozen so the time it 10 second timer isn't ticking anymore so you go out of that dungeon you walk into a big city which is full of low level players and you summon your pet guess what happened next that's a screenshot from a place called iron forge and you can see some bones everywhere that's dead characters you can see some like clouds of red stuff that's corrupted bones blood infection and now let's watch a video and now let's watch a video if you have a look at the log in the right top in the right bottom corner it says corrupted blood affected you this character died that many HP points were absorbed you can see people running around with red waves all around crying the character that made the recording is very high level so although his health points suffer he doesn't die but others do go to the basically what was happening is that for several days world of warcraft was not playable by any low level characters so basically what was happening is that for several days world of warcraft was not playable by any low level characters if that's not a bad virus i don't know what is i mean come on several days you log into a game your character dies immediately fortunately, In world of warcraft, death isn't actually terminal the way to revive your character is to walk from a graveyard as a ghost and re-populate your body but it's pointless because you die again game. And as a result, many players couldn't play the game for several days until Blizzard rolled out a patch. And I like the official reaction of Blizzard while they were preparing a patch. I'll read it out and zoom it. It was actually a very cool reply. It appears that the hotfix remedy concocted to combat the recent Azerothian outbreak has not yielded desired results. They made several patches. They tried to isolate characters in certain areas, sort of to quarantine them. That didn't work. At this time, our medical staff is continuing to develop an effective cure. And they look forward to ensuring the health and vitality of the citizens of Azeroth in the near future. Well, it actually makes sense. They converted that software bug into some sort of in-game event, which is cool. And many players were actually quite excited about that. They said it's the first proper world event. I guess those higher-level characters were probably more excited than lower-level characters. And the fix eventually went out in World of Warcraft 1.8, which was released on the 10th of October. That's actually about two weeks after. But unofficially, that fix was actually available earlier than that. And the log that software released was that fixed a bug that would allow Hakkar's Corrupted Blood to work. And now we can use that to really increase the risk of health and vitality target pets because at that time it was pretty much clear how the infection was transported from an isolated dungeon to a populated place there are several discussions of that incident in world of Warcraft after the event and several security papers written about that and even medical institutions were interested in the logs to sort of analyze the simulated virtual environment how the infection spread and all that is there anybody from Blizzard in the audience I wonder anyone anybody knows anyone from Blizzard Wow you that's surprising somebody says that through a chain of six people you can reach pretty much everybody on the planet and we can't find anybody from Blizzard they are hiding well I guess there are lots of annoyed players around anyway what was interesting is not so much what happened in September or October which was pretty cool anyway but what happened later they silently fixed something else in nine in 193 release three months later in February 2006 they again changed how that spell behaves corrupted blood now deals direct damage with the following damage over time and no longer spreads to others in the raid they removed the viral property from that spell completely so before it couldn't only infect pets it was actually spreading within the raid group that attacked the monster three months later I guess they went through some nightmare scenarios and realized that something really really bad might still happen I have a theory wild theory we have one infection we have infection that moved slightly to the right then it moved again then it moves again if you have a chain of people long enough and they all keep running in the right direction you can still transport corrupted blood from a dungeon into a city I think that's why they did that fix they completely removed the replication property from the spell so what did we learn from that event replication went completely out of control in an environment that was actually created by these same software guys at Blizzard and that's pretty much what happened at Chernobyl the guys had a nuclear plant they started experimenting with it a little bit sort of trying to understand how long it will generate power when it was being cooled down and not understanding the full complexity of the system and the way it works and the way it works in the city of the environment they made a mistake and it blew up in both cases well to some extent similar situation happened with already 71 unexpected environment so the replication appeared same thing happened to the infamous Morris worm the very first internet worm which overloaded internet at the time it was really really small and and contemporary internet is so much complex so much more complex than at the time of the Morris worm that it's not funny so let's have a look how that how that problem demonstrated itself in the real internet environment story number three w32 nachi another name for it is velchia it's a worm which was created to be good to patch a vulnerability and naturally it went out of control so the history was such there was a very very bad outbreak on the 11th of August 2003 with w32 ms blaster so the history was such there was a very very bad outbreak on the 11th of August 2003 with w32 ms blaster so the history was such there was a very very bad outbreak on the 11th of August 2003 with w32 ms blaster so the history was such there was a very very bad outbreak on the 11th of August 2003 with w32 ms blaster so the history was such there was a very very bad outbreak on the 11th of August 2003 with w32 ms blaster so the history was such there was a very very bad outbreak on the 11th of August 2003 with w32 ms blaster so the history was such there was a very very bad outbreak on the 11th of August 2003 with w32 ms blaster so the history Another name for it is LoveSan. I'm sure there are network administrators in that audience who suffered from that outbreak, because it was pretty bad. So just seven days later, after the outbreak of MS Blaster, W32 Nachi was released, which was supposed to fix the problem. It does actually contain a code that downloads from Microsoft's site, official patch for MSO3-26, that was RPC Decom Vulnerability. It downloads the patch, it installs it, and plugs the security hole that let MS Blaster spread. The problem was that Nachi itself, being a worm, spreads as well through the same vulnerability. That overloaded many networks, especially because two worms were now competing for the same vulnerability. But to give the credit to the author, he didn't just put one control in place, one control being that once the vulnerability is patched, no spreading anymore to that host. He put another control in place. The worm was time-limited. It was supposed to self-destruct in 2004. So it was checking the date. And in 2004, it'll just remove itself. The interesting thing is that some computers don't have correct clocks. And on the 1st of January 2004, there were still at least 30,000 machines in the Internet infected with W32 Nachi. It was still spreading happily. It was still knocking on all the doors. And consuming. And using the network bandwidth. So what went wrong with this thing? Any software, be it a program, online game, batch tool, worm, it will contain bugs. All software contains bugs. Well, unless it's Hello World. All software contains bugs. All software contains bugs. And W32 Nachi will not be able to do that. It will neglect control in two places. The network load, it wasn't throttling itself. If it had been throttling itself properly, it would be fine. And it didn't die properly, as expected. Instead of checking the date, it should have consulted an NTP server. Found the proper date. Then it might have been better. The point is, Internet is a very complex environment. When you do something in it, stuff just happens that you don't know about so there is an idea of pitching using worms which w32 nachi was sort of trying to implement but I was talking to Microsoft guys about pitching using replication using worms that travel in a controlled fashion from one computer to another so exploiting sort of peer to peer propagation mechanism they are naturally very interested in that because if there is a widespread vulnerability in the windows product somewhere and if it's actually exposed to the Internet the worm can travel really really quickly to fix the vulnerability before we eats more targets you have to spread quicker than the worm to spread quicker you either have to have some complex mechanisms for propagating updates which normally ask the user do you want to install an update but that's too long if you ask a user that takes time the user may be sleeping computer may be running you need to patch it so the question is there is a vulnerability there is a worm spreading in the field Microsoft would naturally know what the vulnerability is and how to patch it should they release a worm which would go and patch it well I'm happy to say that only research folks and Microsoft are really thinking about it I don't believe they would ever implement anything like that for several reasons because if they need to release a worm and that does the patching they would not have time for QA and if they don't have time for QA it might not work as expected it might create more damage than solve problems so it's technically very very risky and it's a very very deep legal minefield because user consent is not collected at the time of the installation it really might do something to the machines that it not supposed to touch so I can better create of beer that Microsoft would never do that come to me if I lose and the conclusions replicative property is a rather dangerous technology and the reasons for it being dangerous is because it's available to just everybody and it's very hard to control as we have seen in the examples you can't really that easily control software it's just frequently buggy just imagine the situation if nuclear technology would be available to everybody in their garage . . . . probably wouldn't have existed today so even though experimenting with splitting the atom in the laboratory is fine that same technology being available to anybody with an ability to build a bomb in a garage would be bad that's why I'm saying that replication is dangerous and probably more than we expect it tends to go wrong and if you want to mess with viral properties you have to be very very careful because things just tend to misbehave but can useful virus be created yeah of course it's possible with enough controls in place with the properо software QA you can create something that will be useful that will propagate do something good but if you put so many controls in place most people wouldn't even call it a virus it'll be some sort of propagating software there would be some other name for it I guess that's actually the end of my presentation if you are interested there are some references in the proceedings on the DEF CON CD-ROM with a bit more discussion about bad viruses and good viruses in particular with points from both sides of the fence and if you have questions please fire away I'll be only too happy to try to answer them if you have more questions send them to my email MIG at McAfee.com just MIG not mig-29 like an aircraft so please questions anyone you