text
stringlengths
1
7.76k
source
stringlengths
17
81
584 MULTIPLE PROCESSOR SYSTEMS CHAP. 8 A serious problem with CORBA is that every object is located on only one ser- ver, which means the performance will be terrible for objects that are heavily used on client machines around the world. In practice, CORBA functions acceptably only in small-scale systems, such as to co...
clipped_os_Page_584_Chunk6801
SEC. 8.3 DISTRIBUTED SYSTEMS 585 Tuples are retrieved from the tuple space by the in primitive. They are ad- dressed by content rather than by name or address. The fields of in can be expres- sions or formal parameters. Consider, for example, in("abc", 2, ?i); This operation ‘‘searches’’ the tuple space for a tuple con...
clipped_os_Page_585_Chunk6802
586 MULTIPLE PROCESSOR SYSTEMS CHAP. 8 is also a primitive eval, which causes its parameters to be evaluated in parallel and the resulting tuple to be put in the tuple space. This mechanism can be used to per- form an arbitrary computation. This is how parallel processes are created in Linda. Publish/Subscribe Our next...
clipped_os_Page_586_Chunk6803
SEC. 8.3 DISTRIBUTED SYSTEMS 587 necessary to store old tuples in case they are needed later. One way to store them is to hook up a database system to the system and have it subscribe to all tuples. This can be done by wrapping the database system in an adapter, to allow an existing database to work with the publish/su...
clipped_os_Page_587_Chunk6804
588 MULTIPLE PROCESSOR SYSTEMS CHAP. 8 Much systems research in recent years has also gone into making large appli- cations scale to multicore and multiprocessor environments. One example is the scalable database engine described by Salomie et al. (2011). Again, the solution is to achieve scalability by replicating the...
clipped_os_Page_588_Chunk6805
SEC. 8.5 SUMMARY 589 often put on top of the operating system to provide a uniform layer for applications to interact with. The various kinds include document-based, file-based, ob- ject-based, and coordination-based middleware. Some examples are the World Wide Web, CORBA, and Linda. PROBLEMS 1. Can the USENET newsgrou...
clipped_os_Page_589_Chunk6806
590 MULTIPLE PROCESSOR SYSTEMS CHAP. 8 consists of 16 32-bit words, each of which requires one bus cycle to transfer, and the bus runs at 400 MHz, what fraction of the bus bandwidth is eaten up by moving the cache block back and forth? 11. In the text, it was suggested that a binary exponential backoff algorithm be use...
clipped_os_Page_590_Chunk6807
CHAP. 8 PROBLEMS 591 21. When a procedure is scooped up from one machine and placed on another to be called by RPC, some problems can occur. In the text, we pointed out four of these: pointers, unknown array sizes, unknown parameter types, and global variables. An issue not discussed is what happens if the (remote) pro...
clipped_os_Page_591_Chunk6808
592 MULTIPLE PROCESSOR SYSTEMS CHAP. 8 35. Copying buffers takes time. Write a C program to find out how much time it takes on a system to which you have access. Use the clock or times functions to determine how long it takes to copy a large array. Test with different array sizes to separate copying time from overhead ...
clipped_os_Page_592_Chunk6809
9 SECURITY Many companies possess valuable information they want to guard closely. Among many things, this information can be technical (e.g., a new chip design or software), commercial (e.g., studies of the competition or marketing plans), finan- cial (e.g., plans for a stock offering) or legal (e.g., documents about ...
clipped_os_Page_593_Chunk6810
594 SECURITY CHAP. 9 others’ hair. If Tracy and Camille were both registered users of the same computer the trick was to make sure that neither could read or tamper with the other’s files, yet allow them to share those files they wanted shared. Elaborate models and mechanisms were developed to make sure no user could g...
clipped_os_Page_594_Chunk6811
SEC. 9.1 THE SECURITY ENVIRONMENT 595 Phrased differently: while Camille may think she is the only user on the computer, she really is not alone at all! Attackers may launch exploits manually or automatically, by means of a virus or a worm. The difference between a virus and worm is not always very clear. Most people a...
clipped_os_Page_595_Chunk6812
596 SECURITY CHAP. 9 the term protection mechanisms to refer to the specific operating system mechan- isms used to safeguard information in the computer. The boundary between them is not well defined, however. First we will look at security threats and attackers to see what the nature of the problem is. Later on in the...
clipped_os_Page_596_Chunk6813
SEC. 9.1 THE SECURITY ENVIRONMENT 597 have. Even so, the original three still have a special place in the hearts and minds of most (elderly) security experts. Systems are under constant threat from attackers. For instance, an attacker may sniff the traffic on a local area network and break the confidentiality of the in...
clipped_os_Page_597_Chunk6814
598 SECURITY CHAP. 9 consist of thousands (and sometimes millions) of compromised computers—often normal computers of innocent and ignorant users. There are all-too-many ways in which attackers can compromise a user’s machine. For instance, they may offer free, but malicious versions of popular software. The sad truth ...
clipped_os_Page_598_Chunk6815
SEC. 9.1 THE SECURITY ENVIRONMENT 599 9.1.2 Attackers Most people are pretty nice and obey the law, so why worry about security? Because there are unfortunately a few people around who are not so nice and want to cause trouble (possibly for their own commercial gain). In the security litera- ture, people who are nosing...
clipped_os_Page_599_Chunk6816
600 SECURITY CHAP. 9 In general, we distinguish between attacks that passively try to steal infor- mation and attacks that actively try to make a computer program misbehave. An example of a passive attack is an adversary that sniffs the network traffic and tries to break the encryption (if any) to get to the data. In a...
clipped_os_Page_600_Chunk6817
SEC. 9.2 OPERATING SYSTEMS SECURITY 601 Here are two fairly simple examples. The first email systems sent messages as ASCII text. They were simple and could be made fairly secure. Unless there are really dumb bugs in the email program, there is little an incoming ASCII message can do to damage a computer system (we wil...
clipped_os_Page_601_Chunk6818
602 SECURITY CHAP. 9 An important part of the TCB is the reference monitor, as shown in Fig. 9-2. The reference monitor accepts all system calls involving security, such as opening files, and decides whether they should be processed or not. The reference monitor thus allows all the security decisions to be put in one p...
clipped_os_Page_602_Chunk6819
SEC. 9.3 CONTROLLING ACCESS TO RESOURCES 603 9.3.1 Protection Domains A computer system contains many resources, or ‘‘objects,’’ that need to be pro- tected. These objects can be hardware (e.g., CPUs, memory pages, disk drives, or printers) or software (e.g., processes, files, databases, or semaphores). Each object has...
clipped_os_Page_603_Chunk6820
604 SECURITY CHAP. 9 To make the idea of a protection domain more concrete, let us look at UNIX (including Linux, FreeBSD, and friends). In UNIX, the domain of a process is de- fined by its UID and GID. When a user logs in, his shell gets the UID and GID contained in his entry in the password file and these are inherit...
clipped_os_Page_604_Chunk6821
SEC. 9.3 CONTROLLING ACCESS TO RESOURCES 605 This situation models executing a SETUID program in UNIX. No other domain switches are permitted in this example. Object Domain2 Domain3 Domain1 Enter Printer1 Plotter2 Domain 1 2 3 File1 File2 File3 File4 File5 File6 Read Read Read Write Read Write Read Write Execute Read W...
clipped_os_Page_605_Chunk6822
606 SECURITY CHAP. 9 A B C Process Owner F1 A: RW; B: R F2 A: R; B:RW; C:R F3 B:RWX; C: RX File User space Kernel space ACL Figure 9-6. Use of access control lists to manage file access. This example illustrates the most basic form of protection with ACLs. More sophisticated systems are often used in practice. To start...
clipped_os_Page_606_Chunk6823
SEC. 9.3 CONTROLLING ACCESS TO RESOURCES 607 File Access control list Password tana, sysadm: RW Pigeon data bill, pigfan: RW; tana, pigfan: RW; ... Figure 9-7. Tw o access control lists. names and/or passwords to keep them separate. The point of this scheme is to pre- vent Tana from accessing the password file when she...
clipped_os_Page_607_Chunk6824
608 SECURITY CHAP. 9 done is edit the ACL to make the change. However, if the ACL is checked only when a file is opened, most likely the change will take effect only on future calls to open. Any file that is already open will continue to have the rights it had when it was opened, even if the user is no longer authorize...
clipped_os_Page_608_Chunk6825
SEC. 9.3 CONTROLLING ACCESS TO RESOURCES 609 The second way is to keep the C-list inside the operating system. Capabilities are then referred to by their position in the capability list. A process might say: ‘‘Read 1 KB from the file pointed to by capability 2.’’ This form of addressing is similar to using file descrip...
clipped_os_Page_609_Chunk6826
610 SECURITY CHAP. 9 the fourth field. Note that the original Check value is used because other outstand- ing capabilities depend on it. This new capability is sent back to the requesting process. The user can now give this to a friend by just sending it in a message. If the friend turns on rights bits that should be o...
clipped_os_Page_610_Chunk6827
SEC. 9.3 CONTROLLING ACCESS TO RESOURCES 611 other hand, ACLs allow selective rev ocation of rights, which capabilities do not. Finally, if an object is removed and the capabilities are not or vice versa, problems arise. ACLs do not suffer from this problem. Most users are familiar with ACLs, because they are common in...
clipped_os_Page_611_Chunk6828
612 SECURITY CHAP. 9 Compiler Mailbox 7 Objects Secret Read Execute Read Execute Read Write Read Execute Read Write Eric Henry Robert Compiler Mailbox 7 Objects Secret Read Execute Read Execute Read Write Read Read Execute Read Write Eric Henry Robert (a) (b) Figure 9-10. (a) An authorized state. (b) An unauthorized st...
clipped_os_Page_612_Chunk6829
SEC. 9.4 FORMAL MODELS OF SECURE SYSTEMS 613 The Bell-LaPadula Model The most widely used multilevel security model is the Bell-LaPadula model so we will start there (Bell and LaPadula, 1973). This model was designed for handling military security, but it is also applicable to other organizations. In the military world...
clipped_os_Page_613_Chunk6830
614 SECURITY CHAP. 9 5 2 6 4 3 1 D E C A B 4 3 2 1 Security level Legend Process Object Read Write Figure 9-11. The Bell-LaPadula multilevel security model. a path that moves information downward, thus guaranteeing the security of the model. The Bell-LaPadula model refers to organizational structure, but ultimately has...
clipped_os_Page_614_Chunk6831
SEC. 9.4 FORMAL MODELS OF SECURE SYSTEMS 615 1. The simple integrity property: A process running at security level k can write only objects at its level or lower (no write up). 2. The integrity * property: A process running at security level k can read only objects at its level or higher (no read down). Together, these...
clipped_os_Page_615_Chunk6832
616 SECURITY CHAP. 9 (a) (b) Client Server Collaborator Kernel Kernel Encapsulated server Covert channel Figure 9-12. (a) The client, server, and collaborator processes. (b) The encapsu- lated server can still leak to the collaborator via covert channels. a 1 bit, it computes as hard as it can for a fixed interval of t...
clipped_os_Page_616_Chunk6833
SEC. 9.4 FORMAL MODELS OF SECURE SYSTEMS 617 1 1 0 1 0 1 0 0 Server Server locks file to send 1 Time Collaborator Server unlocks file to send 0 Bit stream sent Figure 9-13. A covert channel using file locking. another bit is present in S. Since timing is no longer involved, this protocol is fully reliable, even in a bu...
clipped_os_Page_617_Chunk6834
618 SECURITY CHAP. 9 As a case in point, consider Fig. 9-14(a). This photograph, taken by the author in Kenya, contains three zebras contemplating an acacia tree. Fig. 9-14(b) appears to be the same three zebras and acacia tree, but it has an extra added attraction. It contains the complete, unabridged text of fiv e of...
clipped_os_Page_618_Chunk6835
SEC. 9.4 FORMAL MODELS OF SECURE SYSTEMS 619 Viewing the two images in black and white with low resolution does not do justice to how powerful the technique is. To get a better feel for how steganogra- phy works, one of the authors (AST) has prepared a demonstration for Windows systems, including the full-color image o...
clipped_os_Page_619_Chunk6836
620 SECURITY CHAP. 9 network packets, and most operating systems scramble passwords to prevent at- tackers from recovering them. Moreover, in Sec. 9.6, we will discuss the role of en- cryption in another important aspect of security: authentication. We will look at the basic primitives used by these systems. However, a...
clipped_os_Page_620_Chunk6837
SEC. 9.5 BASICS OF CRYPTOGRAPHY 621 E KE Encryption key Decryption key P P Plaintext in Plaintext out Encryption algorithm D KD Decryption algorithm Ciphertext C = E(P, KE) P = D(C, KD) Decryption Encryption Figure 9-15. Relationship between the plaintext and the ciphertext. plaintext ATTA CK would be transformed into ...
clipped_os_Page_621_Chunk6838
622 SECURITY CHAP. 9 system has the property that distinct keys are used for encryption and decryption and that given a well-chosen encryption key, it is virtually impossible to discover the corresponding decryption key. Under these circumstances, the encryption key can be made public and only the private decryption ke...
clipped_os_Page_622_Chunk6839
SEC. 9.5 BASICS OF CRYPTOGRAPHY 623 9.5.4 Digital Signatures Frequently it is necessary to sign a document digitally. For example, suppose a bank customer instructs the bank to buy some stock for him by sending the bank an email message. An hour after the order has been sent and executed, the stock crashes. The custome...
clipped_os_Page_623_Chunk6840
624 SECURITY CHAP. 9 public-key cryptography only to a relatively small piece of data, the hash. Note carefully that this method works only if for all x E (D (x)) = x It is not guaranteed a priori that all encryption functions will have this property since all that we originally asked for was that D (E (x)) = x that is...
clipped_os_Page_624_Chunk6841
SEC. 9.5 BASICS OF CRYPTOGRAPHY 625 Many computers already have TPM chips and many more are likely to have them in the future. TPM is extremely controversial because different parties have different ideas about who will control the TPM and what it will protect from whom. Microsoft has been a big advocate of this concep...
clipped_os_Page_625_Chunk6842
626 SECURITY CHAP. 9 First, the challenging party creates an unpredictable value of, for example, 160 bits. This value, known as a nonce, is simply a unique identifier for this verifica- tion request. It serves to prevent an attacker from recording the response to one re- mote attestation request, changing the configur...
clipped_os_Page_626_Chunk6843
SEC. 9.6 AUTHENTICATION 627 have a login procedure, but more sophisticated personal computer operating sys- tems, such as Linux and Windows 8, do (although foolish users can disable it). Machines on corporate LANs almost always have a login procedure configured so that users cannot bypass it. Finally, many people nowad...
clipped_os_Page_627_Chunk6844
628 SECURITY CHAP. 9 LOGIN: mitch LOGIN: carol LOGIN: carol PASSWORD: FooBar!-7 INVALID LOGIN NAME PASSWORD: Idunno SUCCESSFUL LOGIN LOGIN: INVALID LOGIN LOGIN: (a) (b) (c) Figure 9-17. (a) A successful login. (b) Login rejected after name is entered. (c) Login rejected after name and password are typed. feedback about...
clipped_os_Page_628_Chunk6845
SEC. 9.6 AUTHENTICATION 629 Lest anyone think that better-quality users pick better-quality passwords, rest assured that they do not. When in 2012, 6.4 million LinkedIn (hashed) passwords leaked to the Web after a hack, many people had fun analyzing the results. The most popular password was ‘‘password’’. The second mo...
clipped_os_Page_629_Chunk6846
630 SECURITY CHAP. 9 otherwise weak password enable attackers to harvest a large number of accounts, sometimes with full administrator rights. UNIX Password Security Some (older) operating systems keep the password file on the disk in unen- crypted form, but protected by the usual system protection mechanisms. Having a...
clipped_os_Page_630_Chunk6847
SEC. 9.6 AUTHENTICATION 631 users, Bobbie, Tony, Laura, Mark, and Deborah. Each user has one line in the file, with three entries separated by commas: login name, salt, and encrypted password + salt. The notation e(Dog, 4238) represents the result of concatenating Bobbie’s password, Dog, with her randomly assigned salt...
clipped_os_Page_631_Chunk6848
632 SECURITY CHAP. 9 The algorithm is based on a one-way function, that is, a function y = f (x) that has the property that given x it is easy to find y, but given y it is computationally infeasible to find x. The input and output should be the same length, for example, 256 bits. The user picks a secret password that h...
clipped_os_Page_632_Chunk6849
SEC. 9.6 AUTHENTICATION 633 1. Who is Marjolein’s sister? 2. On what street was your elementary school? 3. What did Mrs. Ellis teach? At login, the server asks one of them at random and checks the answer. To make this scheme practical, though, many question-answer pairs would be needed. Another variation is challenge-r...
clipped_os_Page_633_Chunk6850
634 SECURITY CHAP. 9 contains the user’s password (e.g., PIN code) so the terminal can perform an identi- ty check even if the link to the main computer is down. Typically the password is encrypted by a key known only to the bank. These cards cost about $0.10 to $0.50, depending on whether there is a hologram sticker o...
clipped_os_Page_634_Chunk6851
SEC. 9.6 AUTHENTICATION 635 Smart cards have many other potentially valuable uses (e.g., encoding the bearer’s allergies and other medical conditions in a secure way for use in emergen- cies), but this is not the place to tell that story. Our interest here is how they can be used for secure login authentication. The ba...
clipped_os_Page_635_Chunk6852
636 SECURITY CHAP. 9 the card is used, new software is installed on it. A disadvantage of this approach is that it makes an already slow card even slower, but as technology improves, this method is very flexible. Another disadvantage of smart cards is that a lost or stolen one may be subject to a side-channel attack, f...
clipped_os_Page_636_Chunk6853
SEC. 9.6 AUTHENTICATION 637 has a device like the one of Fig. 9-20. The user inserts his hand into it, and the length of all his fingers is measured and checked against the database. Spring Pressure plate Figure 9-20. A device for measuring finger length. Finger-length measurements are not perfect, however. The system ...
clipped_os_Page_637_Chunk6854
638 SECURITY CHAP. 9 used. Amsterdam Airport has been using iris recognition technology since 2001 to enable frequent travelers to bypass the normal immigration line. A somewhat different technique is signature analysis. The user signs his name with a special pen connected to the computer, and the computer compares it ...
clipped_os_Page_638_Chunk6855
SEC. 9.7 EXPLOITING SOFTWARE 639 9.7 EXPLOITING SOFTWARE One of the main ways to break into a user’s computer is by exploiting vulnera- bilities in the software running on the system to make it do something different than the programmer intended. For instance, a common attack is to infect a user’s browser by means of a...
clipped_os_Page_639_Chunk6856
640 SECURITY CHAP. 9 Although every exploit involves a specific bug in a specific program, there are several general categories of bugs that occur over and over and are worth studying to see how attacks work. In the following sections we will examine not only a number of these methods, but also countermeasures to stop ...
clipped_os_Page_640_Chunk6857
SEC. 9.7 EXPLOITING SOFTWARE 641 it easier to search the log later). Assume that function A is part of a privileged proc- ess, for instance a program that is SETUID root. An attacker who is able to take control of such a process, essentially has root privileges himself. The code above has a severe bug, although it may ...
clipped_os_Page_641_Chunk6858
642 SECURITY CHAP. 9 not represent a valid code address. As soon as the function A returns, the progam would try to jump to an invalid target—something the system would not like at all. In most cases, the program would crash immediately. Now assume that this is not a benign user who provides an overly long mes- sage by...
clipped_os_Page_642_Chunk6859
SEC. 9.7 EXPLOITING SOFTWARE 643 In the past, miners therefore brought canaries into the mine as early warning sys- tems. Any build up of toxic gases would kill the canary before harming its owner. If your bird died, it was probably time to go up. Modern computer systems still use (digital) canaries as early warning sy...
clipped_os_Page_643_Chunk6860
644 SECURITY CHAP. 9 Let us suppose the system uses stack canaries. How could we possibly change the return address? The trick is that when the attacker overflows buffer B, he does not try to hit the return address immediately. Instead, he modifies the variable len that is located just above it on the stack. In line 9,...
clipped_os_Page_644_Chunk6861
SEC. 9.7 EXPLOITING SOFTWARE 645 schemes. A generic name for this security measure is DEP (Data Execution Pre- vention). Some hardware does not support the NX bit. In that case, DEP still works but the enforcement takes place in software. DEP prevents all of the attacks discussed so far. The attacker can inject as much...
clipped_os_Page_645_Chunk6862
646 SECURITY CHAP. 9 to? Since the attacker has control over the stack, he can again make the code return anywhere he wants to. Moreover, after he has done it twice, he may as well do it three times, or four, or ten, etc. Thus, the trick of return-oriented programming is to look for small sequences of code that (a) do ...
clipped_os_Page_646_Chunk6863
SEC. 9.7 EXPLOITING SOFTWARE 647 good enough for the job. For instance, Fig. 9-23(b) suggests that gadget A has a check as part of the instruction sequence. The attacker may not care for the check at all, but since it is there, he will have to accept it. For most purposes, it is perhaps good enough to pop any nonnegati...
clipped_os_Page_647_Chunk6864
648 SECURITY CHAP. 9 A more important attack against ASLR is formed by memory disclosures. In this case, the attacker uses one vulnerability not to take control of the program di- rectly, but rather to leak information abour the memory layout, which he can then use to exploit a second vulnerability. As a trivial exampl...
clipped_os_Page_648_Chunk6865
SEC. 9.7 EXPLOITING SOFTWARE 649 10. } else 11. printf ("Sorry %s, but you are not authorized.\n"); 12. } 13. } The code is meant to do an authorization check. Only users with the right cre- dentials are allowed to see the top secret data. The function check credentials is not a function from the C library, but we assu...
clipped_os_Page_649_Chunk6866
650 SECURITY CHAP. 9 char *s="Hello Wor ld"; pr intf("%s", s); In this program, the character string variable s is declared and initialized to a string consisting of ‘‘Hello World’’ and a zero-byte to indicate the end of the string. The call to the function printf has two arguments, the format string ‘‘%s’’, which inst...
clipped_os_Page_650_Chunk6867
SEC. 9.7 EXPLOITING SOFTWARE 651 When this program is compiled and run, the output it produces on the screen is: Hello wor ld i=6 Note that the variable i has been modified by a call to printf, something not ob- vious to everyone. While this feature is useful once in a blue moon, it means that printing a format string ...
clipped_os_Page_651_Chunk6868
652 SECURITY CHAP. 9 ¨AAAA %08x %08x [...] %08x %n¨ Buffer B first parameter to printf (pointer to format string) stack frame of printf Figure 9-24. A format string attack. By using exactly the right number of %08x, the attacker can use the first four characters of the format string as an address. string (stored in buf...
clipped_os_Page_652_Chunk6869
SEC. 9.7 EXPLOITING SOFTWARE 653 to a newly allocated chunk of memory. Later, when the program no longer needs it, it calls free to release the memory. A dangling pointer error occurs when the pro- gram accidentally uses the memory after it has already freed it. Consider the fol- lowing code that discriminates against ...
clipped_os_Page_653_Chunk6870
654 SECURITY CHAP. 9 starts executing to handle a system call, it will run in the process’ address space. On a 32-bit system, user space occupies the bottom 3 GB of the address space and the kernel the top 1 GB. The reason for this cohabitation is efficiency—switching between address spaces is expensive. Normally this ...
clipped_os_Page_654_Chunk6871
SEC. 9.7 EXPLOITING SOFTWARE 655 This ability to cause undetected numerical overflows can be turned into an at- tack. One way to do this is to feed a program two valid (but large) parameters in the knowledge that they will be added or multiplied and result in an overflow. For example, some graphics programs have comman...
clipped_os_Page_655_Chunk6872
656 SECURITY CHAP. 9 user types in ‘‘abc’’ and ‘‘xyz’’ respectively, then the command that the shell will execute is cp abc xyz which indeed copies the file. Unfortunately this code opens up a gigantic security hole using a technique called command injection. Suppose that the user types ‘‘abc’’ and ‘‘xyz; rm –rf /’’ in...
clipped_os_Page_656_Chunk6873
SEC. 9.7 EXPLOITING SOFTWARE 657 To prevent this, the program performs a check to make sure the user has write access to the file by means of the access system call. The call checks the actual file (i.e., if it is a symbolic link, it will be dereferenced), returning 0 if the re- quested access is allowed and an error v...
clipped_os_Page_657_Chunk6874
658 SECURITY CHAP. 9 from the premises without warning, the next day (or next week) the logic bomb does not get fed its daily password, so it goes off. Many variants on this theme are also possible. In one famous case, the logic bomb checked the payroll. If the per- sonnel number of the programmer did not appear in it ...
clipped_os_Page_658_Chunk6875
SEC. 9.8 INSIDER ATTACKS 659 inserted by a programmer working for a computer manufacturer and then shipped with its computers, the programmer could log into any computer made by his com- pany, no matter who owned it or what was in the password file. The same holds for a programmer working for the OS vendor. The back do...
clipped_os_Page_659_Chunk6876
660 SECURITY CHAP. 9 triggers the real login program to start and display the prompt of Fig. 9-27(a). The user assumes that she made a typing error and just logs in again. This time, how- ev er, it works. But in the meantime, Mal has acquired another (login name, pass- word) pair. By logging in at many computers and st...
clipped_os_Page_660_Chunk6877
SEC. 9.9 MALWARE 661 GREETINGS FROM GENERAL ENCRYPTION! TO PURCHASE A DECRYPTION KEY FOR YOUR HARD DISK, PLEASE SEND $100 IN SMALL, UNMARKED BILLS TO BOX 2154, PANAMA CITY, PANAMA. THANK YOU. WE APPRECIATE YOUR BUSINESS. Another common application of malware has it install a keylogger on the infected machine. This prog...
clipped_os_Page_661_Chunk6878
662 SECURITY CHAP. 9 at a competitor’s factory and with no system administrator currently logged in. If the coast was clear, it would interfere with the production process, reducing prod- uct quality, thus causing trouble for the competitor. In all other cases it would do nothing, making it hard to detect. Another exam...
clipped_os_Page_662_Chunk6879
SEC. 9.9 MALWARE 663 9.9.1 Trojan Horses Writing malware is one thing. You can do it in your bedroom. Getting millions of people to install it on their computers is quite something else. How would our malware writer, Mal, go about this? A very common practice is to write some gen- uinely useful program and embed the ma...
clipped_os_Page_663_Chunk6880
664 SECURITY CHAP. 9 Most common programs are in /bin or /usr/bin, so putting a Trojan horse in /usr/bin/X11/ls does not work for a common program because the real one will be found first. However, suppose the cracker inserts la into /usr/bin/X11. If a user mistypes la instead of ls (the directory listing program), now...
clipped_os_Page_664_Chunk6881
SEC. 9.9 MALWARE 665 biological viruses reproduce. The virus can also do other things in addition to reproducing itself. Worms are like viruses but are self replicating. That difference will not concern us for the moment, so we will use the term ‘‘virus’’ to cover both. We will look at worms in Sec. 9.9.3. How Viruses ...
clipped_os_Page_665_Chunk6882
666 SECURITY CHAP. 9 A somewhat related attack uses the Windows desktop, which contains short- cuts (symbolic links) to programs. A virus can change the target of a shortcut to make it point to the virus. When the user double clicks on an icon, the virus is ex- ecuted. When it is done, the virus just runs the original ...
clipped_os_Page_666_Chunk6883
SEC. 9.9 MALWARE 667 the entire file system starting at the root directory by changing to the root directory and calling search with the root directory as parameter. The recursive procedure search processes a directory by opening it, then read- ing the entries one at a time using readdir until a NULL is returned, indic...
clipped_os_Page_667_Chunk6884
668 SECURITY CHAP. 9 virus some more, but it does not do what it is supposed to do, and the user will no- tice this instantly. Consequently, many viruses attach themselves to the program and do their dirty work, but allow the program to function normally afterward. Such viruses are called parasitic viruses. Parasitic v...
clipped_os_Page_668_Chunk6885
SEC. 9.9 MALWARE 669 Memory-Resident Viruses So far we have assumed that when an infected program is executed, the virus runs, passes control to the real program, and then exits. In contrast, a memory- resident virus stays in memory (RAM) all the time, either hiding at the very top of memory or perhaps down in the gras...
clipped_os_Page_669_Chunk6886
670 SECURITY CHAP. 9 When the computer is booted, the virus copies itself to RAM, either at the top or down among the unused interrupt vectors. At this point the machine is in kernel mode, with the MMU off, no operating system, and no antivirus program running. Party time for viruses. When it is ready, it boots the ope...
clipped_os_Page_670_Chunk6887
SEC. 9.9 MALWARE 671 Device Driver Viruses Getting into memory like this is a little like spelunking (exploring caves)—you have to go through contortions and keep worrying about something falling down and landing on your head. It would be much simpler if the operating system would just kindly load the virus officially....
clipped_os_Page_671_Chunk6888
672 SECURITY CHAP. 9 Source Code Viruses Parasitic and boot sector viruses are highly platform specific; document viruses are somewhat less so (Word runs on Windows and Macs, but not on UNIX). The most portable viruses of all are source code viruses. Imagine the virus of Fig. 9-28, but with the modification that instea...
clipped_os_Page_672_Chunk6889
SEC. 9.9 MALWARE 673 to infect the boot sector of the hard disk. Once the boot sector is infected, it is easy to start a kernel-mode memory-resident virus on subsequent boots. Nowadays, other options are also available to Virgil. The virus can be written to check if the infected machine is on a (wireless) LAN, somethin...
clipped_os_Page_673_Chunk6890
674 SECURITY CHAP. 9 just as devastating. Another category of virus writers is the military, which sees vi- ruses as a weapon of war potentially able to disable an enemy’s computers. Another issue related to spreading viruses is avoiding detection. Jails have notoriously bad computing facilities, so Virgil would prefer...
clipped_os_Page_674_Chunk6891
SEC. 9.9 MALWARE 675 the Internet to their knees within a few hours of its release. Morris’ motivation is unknown, but it is possible that he intended the whole idea as a high-tech practical joke, but which due to a programming error got completely out of hand. Technically, the worm consisted of two programs, the boots...
clipped_os_Page_675_Chunk6892
676 SECURITY CHAP. 9 propagating even if the system administrator there started up his own version of the worm to fool the real worm. The use of one in seven created far too many worms, and was the reason all the infected machines ground to a halt: they were infested with worms. If Morris had left this out and just exi...
clipped_os_Page_676_Chunk6893
SEC. 9.9 MALWARE 677 background. Neither of these are considered spyware. If Potter Stewart were alive, he would probably say: ‘‘I can’t define spyware, but I know it when I see it.’’† Others have tried harder to define it (spyware, not pornography). Barwinski et al. (2006) have said it has four characteristics. First,...
clipped_os_Page_677_Chunk6894
678 SECURITY CHAP. 9 which causes the browser to download and execute the software. At this point, the machine is infected and the spyware is free to do anything it wants to. The second common route is the infected toolbar. Both Internet Explorer and Firefox support third-party toolbars. Some spyware writers create a n...
clipped_os_Page_678_Chunk6895
SEC. 9.9 MALWARE 679 but not to anyone subsequent to him outside the legal profession. Once the user has accepted the license, he may lose his right to sue the spyware vendor because he has just agreed to let the spyware run amok, although sometimes local laws over- ride such licenses. (If the license says ‘‘Licensee h...
clipped_os_Page_679_Chunk6896
680 SECURITY CHAP. 9 Spyware should not be confused with adware, in which legitimate (but small) software vendors offer two versions of their product: a free one with ads and a paid one without ads. These companies are very clear about the existence of the two versions and always offer users the option to upgrade to th...
clipped_os_Page_680_Chunk6897
SEC. 9.9 MALWARE 681 4. Library rootkits. Another place a rootkit can hide is in the system library, for example, in libc in Linux. This location gives the malware the opportunity to inspect the arguments and return values of system calls, modifying them as need be to keep itself hidden. 5. Application rootkits. Anothe...
clipped_os_Page_681_Chunk6898
682 SECURITY CHAP. 9 on the TLB, observe the performance, and compare it to previously measured per- formance on the bare hardware. Another class of detection methods relates to timing, especially of virtualized I/O devices. Suppose that it takes 100 clock cycles to read out some PCI device register on the real machine...
clipped_os_Page_682_Chunk6899
SEC. 9.9 MALWARE 683 ‘‘NO ROOTKITS FOUND!’’ These require more complicated measures, but fortu- nately no active rootkits have appeared in the wild yet. There are two schools of thought about what to do after a rootkit has been discovered. One school says the system administrator should behave like a surgeon treating a...
clipped_os_Page_683_Chunk6900