CHAPTER 3 Program Security
CHAPTER 3 Program Security
CHAPTER 3 Program Security
UDIT
Sonali C.
Introduction
In previous chapter we cover why we need security We will see in this chapter how to apply security And how it can be achieved. Protection programs is heart of security. To secure a program:
How do we keep programs free from flaws How do we protect computing resources against programs that contain flaws?
UDIT
What is security?
It implies some degree of trust that program enforce expected confidentiality, integrity, availability.
Security characteristic depends on application and users perceptions about software quality. Here we have to make sure that the program:
UDIT Sonali C. 3
Human makes mistake (error) in performing some s/w activity, error may lead to fault (incorrect data or action or command) in program which may results in failure (system not performing as required) of the system Fault is inside system where as failure can be seen by users i.e outside.
UDIT
Sonali C.
UDIT
Sonali C.
TERMINOLOGYUnexpected Behavior
Inadequacies of patch-and-penetrate PROGRAM SECURITY FLAW
To achieve program security, one way is to compare requirements with the behavior.
i.e. Check whether program behaves as their designer intended or users expected.
UDIT Sonali C. 6
Unexpected Behavior
A program with Trojan horse is vulnerable, but the user cannot see any security flaw in program. Address program security flaw to find causes not only in existing failure but also in incipient ones (not yet explore or partly exist) Not only to identify but also we have to prevent harm cause by flaws.
UDIT Sonali C. 7
UDIT
Sonali C.
Array bounds example (some languages do not check array bounds, and in others array bounds do not have to be pre-specified)
Char sample[10]; for(int i=0;i<10;i++) Sample[i] = A; Sample[10] = B;
UDIT
Sonali C.
UDIT
Sonali C.
10
UDIT
Sonali C.
11
Users data space, overwriting other existing data Users program data,
Overlaying an already executed instruction, with no effect Overlay an instruction not yet executed, with the result an instruction with operation code 0X42 (internal code for character B) will be executed. If there is no such instruction, the system will halt with illegal instruction exception. Otherwise the machine will use succeeding bytes as if they were rest of the instruction
UDIT
Sonali C.
12
Security Implication
Replace code in the system space, insert overflow data corresponding to machine code for instructions, and gain control back from the operating system, with higher privileges. Cause an overflow into the stack, change either
old stack pointer thereby changing the context for the calling procedure) or Return address to cause control to transfer where (s)he wants
Pass parameters on to a web server that causes buffer overflow and crashes the program
Sonali C. 13
UDIT
UDIT Sonali C. 14
Security Implication
http://www.things.com/order.asp?custID=101 &part=555A&qy=20&price=10&shipcost=5&tot al=205
UDIT
Sonali C.
15
Costs $100 You count out the money on the counter Cashier turns around, you take $20 back Cashier doesn't notice Still get the $100 item
During the time that an access to resources (files) is checked and the time the result of the check is used, the user can change the descriptor of the resource, thereby exploiting the lack of synchronization Use of digital signatures can alleviate this problem
Sonali C. 16
UDIT
Malicious Code
Why worry about Malicious code? Malicious code can do anything that a program can. Malicious code runs under the users authority. Malicious code can do anything that a user can, but without his/her permission or knowledge Definition: Unanticipated or undesired effects in
UDIT
Sonali C.
17
CONT
to other nonmalicious programs by modifying them It will attach itself to a program, either destroying it or coexisting with it.
Transient: its life depends on the life of the host Resident: locates itself in memory, and can remain
active or be activated as a stand-alone program even after its attached program ends (runs even when host program isn't running)
UDIT Sonali C. 18
CONT
also has a non-obvious malicious effect Logic bomb: detonates when a specified condition occurs Time bomb: logic bomb whose trigger is a time or date Worm: program that spreads copies of itself (as a standalone program) through a network
UDIT
Sonali C.
19
CONT
bound, with the intent of exhausting some computing resource. Trapdoor or backdoor: Someone can access the program by other than obvious, direct call, perhaps with special privileges
Its undocumented entry point to the system Inserted during code development
UDIT
Sonali C.
20
How viruses attach & types of viruses Qualities appealing to virus writers Boot sector viruses and Memory-resident viruses Virus signatures Polymorphic viruses Virus prevention Targeted malicious code: Trapdoors, Salami attacks,
covert channels
UDIT
Sonali C.
21
For a virus to do its work, it must be executed. Once executed, it may install itself in permanent memory, or spread itself E-mail attachments: A common means is via e-mail attachments Virus appended to a program: when the program is executed, the virus is also executed Virus that surrounds a program: Runs the original program, but has control before and after the program execution Integrated virus: integrates itself into the original program Document virus: virus implemented in a formatted document
Sonali C. 22
UDIT
Appended Virus
Dnt need any information about program Easy to write and append and simple Virus do its task and then transfers to original program.
UDIT
Sonali C.
23
For a virus to do its work, it must be executed. Once executed, it may install itself in permanent memory, or spread itself E-mail attachments: A common means is via e-mail attachments Virus appended to a program: when the program is executed, the virus is also executed Virus that surrounds a program: Runs the original program, but has control before and after the program execution Integrated virus: integrates itself into the original program Document virus: virus implemented in a formatted document
Sonali C. 24
UDIT
UDIT
Sonali C.
25
For a virus to do its work, it must be executed. Once executed, it may install itself in permanent memory, or spread itself E-mail attachments: A common means is via e-mail attachments Virus appended to a program: when the program is executed, the virus is also executed Virus that surrounds a program: Runs the original program, but has control before and after the program execution Integrated virus: integrates itself into the original program Document virus: virus implemented in a formatted document
Sonali C. 26
UDIT
Integrated virus
UDIT
Sonali C.
27
For a virus to do its work, it must be executed. Once executed, it may install itself in permanent memory, or spread itself E-mail attachments: A common means is via e-mail attachments Virus appended to a program: when the program is executed, the virus is also executed Virus that surrounds a program: Runs the original program, but has control before and after the program execution Integrated virus: integrates itself into the original program Document virus: virus implemented in a formatted document
Sonali C. 28
UDIT
UDIT Sonali C. 29
UDIT
Sonali C.
30
Gain control very early in boot process Cannot be detected easily Virus code is not easily noticed by user
Sonali C. 31
UDIT
UDIT
Sonali C.
32
UDIT
Sonali C.
33
UDIT
Sonali C.
34
UDIT Sonali C. 35
Detecting Virus
Tracking Storage Pattern Execution Pattern Transmission Pattern
UDIT
Sonali C.
36
Polymorphism Virus
Virus Signature can be the most reliable way for a scanner to detect Virus. A virus that can change its appearance Forms:
More than one alternative but with equivalent beginning words, on installation one of the words is installed Move pieces of the virus around to make detection difficult Embed random numbers Encrypting viruses
UDIT
Sonali C.
37
Virus Prevention
Not sharing executable code Setting e-mail handlers not to automatically open attachments Be careful with large datasets and graphics since they can have embedded in them executables Be careful with Microsoft file design problem (operating system may switch to the application of the hidden file type) Use only commercial software acquired from reliable, well-established vendors (?)
Sonali C. 38
UDIT
Virus Prevention
Test all new software on an isolated computer Open attachments only when known to be safe Make a recoverable system image and store it safely Backups of executable system files Use detectors regularly and update frequently
UDIT
Sonali C.
39
True
Can appear only in data files, Word docs, or only in programs: False. (Depends on what you mean by data) Spread only through floppies or email: False. What about file sharing, bulletin boards, etc.?
UDIT Sonali C. 40
UDIT
Sonali C.
41
the testing, they can be used as trapdoors Poor error checking: Unacceptable input may not be
caught but passed on to the user for use Undefined opcodes: hardware equivalent of poor error checking
UDIT
Sonali C.
42
Trapdoors
Trapdoors
UDIT
Sonali C.
43
Trapdoors
Causes
UDIT
Sonali C.
44
UDIT
Sonali C.
45
Salami attack
Programs that disregard small amounts of money in computations (interest, tax calculations, etc.) may be vulnerable to salami attack where such shavings from transactions can be accumulated elsewhere
UDIT
Sonali C.
46
Interface Illusion
UDIT
Sonali C.
47
UDIT
Sonali C.
48