1、November 1, 2004,Introduction to Computer Security 2004 Matt Bishop,Slide #19-1,Chapter 19: Malicious Logic,What is malicious logic Types of malicious logic Defenses,November 1, 2004,Introduction to Computer Security 2004 Matt Bishop,Slide #19-2,Overview,Defining malicious logic Types Trojan horses
2、Computer viruses and worms Other types Defenses Properties of malicious logic Trust,November 1, 2004,Introduction to Computer Security 2004 Matt Bishop,Slide #19-3,Malicious Logic,Set of instructions that cause site security policy to be violated,November 1, 2004,Introduction to Computer Security 20
3、04 Matt Bishop,Slide #19-4,Example,Shell script on a UNIX system: cp /bin/sh /tmp/.xyzzy chmod u+s,o+x /tmp/.xyzzy rm ./ls ls $* Place in program called “ls” and trick someone into executing it You now have a setuid-to-them shell!,November 1, 2004,Introduction to Computer Security 2004 Matt Bishop,S
4、lide #19-5,Trojan Horse,Program with an overt purpose (known to user) and a covert purpose (unknown to user) Often called a Trojan Named by Dan Edwards in Anderson Report Example: previous script is Trojan horse Overt purpose: list files in directory Covert purpose: create setuid shell,November 1, 2
5、004,Introduction to Computer Security 2004 Matt Bishop,Slide #19-6,Example: NetBus,Designed for Windows NT system Victim uploads and installs this Usually disguised as a game program, or in one Acts as a server, accepting and executing commands for remote administrator This includes intercepting key
6、strokes and mouse motions and sending them to attacker Also allows attacker to upload, download files,November 1, 2004,Introduction to Computer Security 2004 Matt Bishop,Slide #19-7,Replicating Trojan Horse,Trojan horse that makes copies of itself Also called propagating Trojan horse Early version o
7、f animal game used this to delete copies of itself Hard to detect 1976: Karger and Schell suggested modifying compiler to include Trojan horse that copied itself into specific programs including later version of the compiler 1980s: Thompson implements this,November 1, 2004,Introduction to Computer S
8、ecurity 2004 Matt Bishop,Slide #19-8,Thompsons Compiler,Modify the compiler so that when it compiles login , login accepts the users correct password or a fixed password (the same one for all users) Then modify the compiler again, so when it compiles a new version of the compiler, the extra code to
9、do the first step is automatically inserted Recompile the compiler Delete the source containing the modification and put the undoctored source back,November 1, 2004,Introduction to Computer Security 2004 Matt Bishop,Slide #19-9,login source,correct compiler,login executable,user password,login sourc
10、e,doctored compiler,login executable,magic password,user password or,logged in,logged in,The Login Program,November 1, 2004,Introduction to Computer Security 2004 Matt Bishop,Slide #19-10,compiler source,correct compiler,compiler executable,login source,compiler source,doctored compiler,compiler exe
11、cutable,correct login executable,login source,rigged login executable,The Compiler,November 1, 2004,Introduction to Computer Security 2004 Matt Bishop,Slide #19-11,Comments,Great pains taken to ensure second version of compiler never released Finally deleted when a new compiler executable from a dif
12、ferent system overwrote the doctored compiler The point: no amount of source-level verification or scrutiny will protect you from using untrusted code Also: having source code helps, but does not ensure youre safe,November 1, 2004,Introduction to Computer Security 2004 Matt Bishop,Slide #19-12,Compu
13、ter Virus,Program that inserts itself into one or more files and performs some action Insertion phase is inserting itself into file Execution phase is performing some (possibly null) action Insertion phase must be present Need not always be executed Lehigh virus inserted itself into boot file only i
14、f boot file not infected,November 1, 2004,Introduction to Computer Security 2004 Matt Bishop,Slide #19-13,Pseudocode,beginvirus:if spread-condition then beginfor some set of target files do beginif target is not infected then begindetermine where to place virus instructionscopy instructions from beg
15、invirus to endvirusinto targetalter target to execute added instructionsend;end;end;perform some action(s)goto beginning of infected program endvirus:,November 1, 2004,Introduction to Computer Security 2004 Matt Bishop,Slide #19-14,Trojan Horse Or Not?,Yes Overt action = infected programs actions Co
16、vert action = virus actions (infect, execute) No Overt purpose = virus actions (infect, execute) Covert purpose = none Semantic, philosophical differences Defenses against Trojan horse also inhibit computer viruses,November 1, 2004,Introduction to Computer Security 2004 Matt Bishop,Slide #19-15,Hist
17、ory,Programmers for Apple II wrote some Not called viruses; very experimental Fred Cohen Graduate student who described them Teacher (Adleman) named it “computer virus” Tested idea on UNIX systems and UNIVAC 1108 system,November 1, 2004,Introduction to Computer Security 2004 Matt Bishop,Slide #19-16
18、,Cohens Experiments,UNIX systems: goal was to get superuser privileges Max time 60m, min time 5m, average 30m Virus small, so no degrading of response time Virus tagged, so it could be removed quickly UNIVAC 1108 system: goal was to spread Implemented simple security property of Bell-LaPadula As wri
19、ting not inhibited (no *-property enforcement), viruses spread easily,November 1, 2004,Introduction to Computer Security 2004 Matt Bishop,Slide #19-17,First Reports,Brain (Pakistani) virus (1986) Written for IBM PCs Alters boot sectors of floppies, spreads to other floppies MacMag Peace virus (1987)
20、 Written for Macintosh Prints “universal message of peace” on March 2, 1988 and deletes itself,November 1, 2004,Introduction to Computer Security 2004 Matt Bishop,Slide #19-18,More Reports,Duffs experiments (1987) Small virus placed on UNIX system, spread to 46 systems in 8 days Wrote a Bourne shell
21、 script virus Highlands Lotus 1-2-3 virus (1989) Stored as a set of commands in a spreadsheet and loaded when spreadsheet opened Changed a value in a specific row, column and spread to other files,November 1, 2004,Introduction to Computer Security 2004 Matt Bishop,Slide #19-19,Types of Viruses,Boot
22、sector infectors Executable infectors Multipartite viruses TSR viruses Stealth viruses Encrypted viruses Polymorphic viruses Macro viruses,November 1, 2004,Introduction to Computer Security 2004 Matt Bishop,Slide #19-20,Boot Sector Infectors,A virus that inserts itself into the boot sector of a disk
23、 Section of disk containing code Executed when system first “sees” the disk Including at boot time Example: Brain virus Moves disk interrupt vector from 13H to 6DH Sets new interrupt vector to invoke Brain virus When new floppy seen, check for 1234H at location 4 If not there, copies itself onto dis
24、k after saving original boot block,November 1, 2004,Introduction to Computer Security 2004 Matt Bishop,Slide #19-21,Executable Infectors,A virus that infects executable programs Can infect either .EXE or .COM on PCs May prepend itself (as shown) or put itself anywhere, fixing up binary so it is exec
25、uted at some point,November 1, 2004,Introduction to Computer Security 2004 Matt Bishop,Slide #19-22,Executable Infectors (cont),Jerusalem (Israeli) virus Checks if system infected If not, set up to respond to requests to execute files Checks date If not 1987 or Friday 13th, set up to respond to cloc
26、k interrupts and then run program Otherwise, set destructive flag; will delete, not infect, files Then: check all calls asking files to be executed Do nothing for COMND.COM Otherwise, infect or delete Error: doesnt set signature when .EXE executes So .EXE files continually reinfected,November 1, 200
27、4,Introduction to Computer Security 2004 Matt Bishop,Slide #19-23,Multipartite Viruses,A virus that can infect either boot sectors or executables Typically, two parts One part boot sector infector Other part executable infector,November 1, 2004,Introduction to Computer Security 2004 Matt Bishop,Slid
28、e #19-24,TSR Viruses,A virus that stays active in memory after the application (or bootstrapping, or disk mounting) is completed TSR is “Terminate and Stay Resident” Examples: Brain, Jerusalem viruses Stay in memory after program or disk mount is completed,November 1, 2004,Introduction to Computer S
29、ecurity 2004 Matt Bishop,Slide #19-25,Stealth Viruses,A virus that conceals infection of files Example: IDF virus modifies DOS service interrupt handler as follows: Request for file length: return length of uninfected file Request to open file: temporarily disinfect file, and reinfect on closing Req
30、uest to load file for execution: load infected file,November 1, 2004,Introduction to Computer Security 2004 Matt Bishop,Slide #19-26,Encrypted Viruses,A virus that is enciphered except for a small deciphering routine Detecting virus by signature now much harder as most of virus is enciphered,Novembe
31、r 1, 2004,Introduction to Computer Security 2004 Matt Bishop,Slide #19-27,Example,(* Decryption code of the 1260 virus *) (* initialize the registers with the keys *) rA = k1; rB = k2; (* initialize rC with the virus;starts at sov, ends at eov *) rC = sov; (* the encipherment loop *) while (rC != eo
32、v) do begin(* encipher the byte of the message *)(*rC) = (*rC) xor rA xor rB;(* advance all the counters *)rC = rC + 1;rA = rA + 1; end,November 1, 2004,Introduction to Computer Security 2004 Matt Bishop,Slide #19-28,Polymorphic Viruses,A virus that changes its form each time it inserts itself into
33、another program Idea is to prevent signature detection by changing the “signature” or instructions used for deciphering routine At instruction level: substitute instructions At algorithm level: different algorithms to achieve the same purpose Toolkits to make these exist (Mutation Engine, Trident Po
34、lymorphic Engine),November 1, 2004,Introduction to Computer Security 2004 Matt Bishop,Slide #19-29,Example,These are different instructions (with different bit patterns) but have the same effect: add 0 to register subtract 0 from register xor 0 with register no-op Polymorphic virus would pick random
35、ly from among these instructions,November 1, 2004,Introduction to Computer Security 2004 Matt Bishop,Slide #19-30,Macro Viruses,A virus composed of a sequence of instructions that are interpreted rather than executed directly Can infect either executables (Duffs shell virus) or data files (Highlands
36、 Lotus 1-2-3 spreadsheet virus) Independent of machine architecture But their effects may be machine dependent,November 1, 2004,Introduction to Computer Security 2004 Matt Bishop,Slide #19-31,Example,Melissa Infected Microsoft Word 97 and Word 98 documents Windows and Macintosh systems Invoked when
37、program opens infected file Installs itself as “open” macro and copies itself into Normal template This way, infects any files that are opened in future Invokes mail program, sends itself to everyone in users address book,November 1, 2004,Introduction to Computer Security 2004 Matt Bishop,Slide #19-
38、32,Computer Worms,A program that copies itself from one computer to another Origins: distributed computations Schoch and Hupp: animations, broadcast messages Segment: part of program copied onto workstation Segment processes data, communicates with worms controller Any activity on workstation caused
39、 segment to shut down,November 1, 2004,Introduction to Computer Security 2004 Matt Bishop,Slide #19-33,Example: Internet Worm of 1988,Targeted Berkeley, Sun UNIX systems Used virus-like attack to inject instructions into running program and run them To recover, had to disconnect system from Internet
40、 and reboot To prevent re-infection, several critical programs had to be patched, recompiled, and reinstalled Analysts had to disassemble it to uncover function Disabled several thousand systems in 6 or so hours,November 1, 2004,Introduction to Computer Security 2004 Matt Bishop,Slide #19-34,Example
41、: Christmas Worm,Distributed in 1987, designed for IBM networks Electronic letter instructing recipient to save it and run it as a program Drew Christmas tree, printed “Merry Christmas!” Also checked address book, list of previously received email and sent copies to each address Shut down several IB
42、M networks Really, a macro worm Written in a command language that was interpreted,November 1, 2004,Introduction to Computer Security 2004 Matt Bishop,Slide #19-35,Rabbits, Bacteria,A program that absorbs all of some class of resources Example: for UNIX system, shell commands: while true do mkdir x
43、chdir x done Exhausts either disk space or file allocation table (inode) space,November 1, 2004,Introduction to Computer Security 2004 Matt Bishop,Slide #19-36,Logic Bombs,A program that performs an action that violates the site security policy when some external event occurs Example: program that d
44、eletes companys payroll records when one particular record is deleted The “particular record” is usually that of the person writing the logic bomb Idea is if (when) he or she is fired, and the payroll record deleted, the company loses all those records,November 1, 2004,Introduction to Computer Secur
45、ity 2004 Matt Bishop,Slide #19-37,Defenses,Distinguish between data, instructions Limit objects accessible to processes Inhibit sharing Detect altering of files Detect actions beyond specifications Analyze statistical characteristics,November 1, 2004,Introduction to Computer Security 2004 Matt Bisho
46、p,Slide #19-38,Data vs. Instructions,Malicious logic is both Virus: written to program (data); then executes (instructions) Approach: treat “data” and “instructions” as separate types, and require certifying authority to approve conversion Keys are assumption that certifying authority will not make
47、mistakes and assumption that tools, supporting infrastructure used in certifying process are not corrupt,November 1, 2004,Introduction to Computer Security 2004 Matt Bishop,Slide #19-39,Example: LOCK,Logical Coprocessor Kernel Designed to be certified at TCSEC A1 level Compiled programs are type “da
48、ta” Sequence of specific, auditable events required to change type to “executable” Cannot modify “executable” objects So viruses cant insert themselves into programs (no infection phase),November 1, 2004,Introduction to Computer Security 2004 Matt Bishop,Slide #19-40,Example: Duff and UNIX,Observati
49、on: users with execute permission usually have read permission, too So files with “execute” permission have type “executable”; those without it, type “data” Executable files can be altered, but type immediately changed to “data” Implemented by turning off execute permission Certifier can change them
50、 back So virus can spread only if run as certifier,November 1, 2004,Introduction to Computer Security 2004 Matt Bishop,Slide #19-41,Limiting Accessibility,Basis: a user (unknowingly) executes malicious logic, which then executes with all that users privileges Limiting accessibility of objects should limit spread of malicious logic and effects of its actions Approach draws on mechanisms for confinement,