Security Notes4
Security Notes4
Security Notes4
control
protecting programs is at the heart of computer security. So we need to ask two important
questions:
Secure Programs
when we say that a program is "secure." ,security implies some degree of trust that the
program enforces expected confidentiality, integrity, and availability.
What are the problem faced when Fixing Faults in a programme.
The pressure to repair a specific problem encouraged a narrow focus on the fault
itself and not on its context. In particular, the analysts paid attention to the
immediate cause of the failure and not to the underlying design or requirements
faults.
The fault often had nonobvious side effects in places other than the immediate
area of the fault.
The fault could not be fixed properly because system functionality or performance
would suffer as a consequence
A flaw can be either a fault or failure, and a vulnerability usually describes a class of
flaws, such as a buffer overflow. In spite of the inconsistency, it is important for us to
remember that we must view vulnerabilities and flaws from two perspectives, cause and
effect, so that we see what fault caused the problem and what failure (if any) is visible to
the user
to understand program security, we can examine programs to see whether they behave as
their designers intended or users expected. We call such unexpected behavior a program
security flaw; it is inappropriate program behavior caused by a program vulnerability
Program security flaws can derive from any kind of software fault. That is, they cover
everything from a misunderstanding of program requirements to a one-character error in
coding or even typing. The flaws can result from problems in a single code component or
from the failure of several programs or program pieces to interact compatibly through a
shared interface. The security flaws can reflect code that was intentionally designed or
coded to be malicious, or code that was simply developed in a sloppy or misguided way.
Thus, it makes sense to divide program flaws into two separate logical categories:
inadvertent human errors versus malicious, intentionally induced flaws.
1
When a human makes a mistake, called an error, in performing some software activity,
the error may lead to a fault, or an incorrect step, command, process, or data definition in
a computer program
Types of Flaws
the inadvertent flaws fall into six categories
Definition
A buffer (or array or string) is a space in which data can be held. A buffer resides in
memory. Because memory is finite, a buffer's capacity is finite. For this reason, in many
programming languages the programmer must declare the buffer's maximum size so that
the compiler can set aside that amount of space.
Let us look at an example to see how buffer overflows can happen. Suppose a C language
program contains the declaration:
char sample[10];
The compiler sets aside 10 bytes to store this buffer, one byte for each of the ten elements
of the array, sample[0] through sample[9]. Now we execute the statement:
sample[10] = 'A';
2
The subscript is out of bounds (that is, it does not fall between 0 and 9), so we have a
problem. The nicest outcome (from a security perspective) is for the compiler to detect
the problem and mark the error during compilation. However, if the statement were
sample[i] = 'A';
Incomplete Mediation
Incomplete mediation is another security problem that has been with us for decades.
Attackers are exploiting it to cause security problems.
Definition
http://www.somesite.com/subpage/userinput&parm1=(808)555-
1212&parm2=2004Ja
Definition
Access control is a fundamental part of computer security; we want to make sure that
only those who should access an object are allowed that access. (We explore the access
control mechanisms in operating systems in greater detail in Chapter 4.) Every requested
access must be governed by an access policy stating who is allowed access to what; then
the request must be mediated by an access policy enforcement agent. But an incomplete
mediation problem occurs when access is not checked universally. The time-of-check to
time-of-use (TOCTTOU) flaw concerns mediation that is performed with a "bait and
switch" in the middle. It is also known as a serialization or synchronization flaw
3
Code Type Characteristics
Virus Attaches itself to program and propagates copies of itself to other programs
4
Viruses That Surround a Program-:An alternative to the attachment is a virus that runs
the original program but has control before and after its execution. For example, a virus
writer might want to prevent the virus from being detected. If the virus is stored on disk,
its presence will be given away by its file name, or its size will affect the amount of space
used on the disk. The virus writer might arrange for the virus to attach itself to the
program that constructs the listing of files on the disk. If the virus regains control after
the listing program has generated the listing but before the listing is displayed or printed,
the virus could eliminate its entry from the listing and falsify space counts so that it
appears not to exist. A surrounding virus is shown in
5
Integrated Viruses and Replacements-:A third situation occurs when the virus replaces
some of its target, integrating itself into the original code of the target. Such a situation is
shown in figure . Clearly, the virus writer has to know the exact structure of the original
program to know where to insert Finally, the virus can replace the entire target, either
mimicking the effect of the target or ignoring the expected effect of the target and
performing only the virus effect. In this case, the user is most likely to perceive the loss
of the original program
6
Document Viruses-:Currently, the most popular virus type is what we call the document
virus, which is implemented within a formatted document, such as a written document, a
database, a slide presentation, or a spreadsheet. These documents are highly structured
files that contain both data (words or numbers) and commands (such as formulas,
formatting controls, links). The commands are part of a rich programming language,
including macros, variables and procedures, file accesses, and even system calls. The
writer of a document virus uses any of the features of the programming language to
perform malicious actions
Homes for Viruses? The virus writer may find these qualities appealing in a virus:
It is hard to detect.
It is not easily destroyed or deactivated.
It is easy to create.
7
One-Time Execution, Boot Sector Viruses, Memory-Resident Viruses
Virus Signatures
Prevention of Virus Infection-:
Test all new software on an isolated computer. If you must use software from a
questionable source, test the software first on a computer with no hard disk, not
connected to a network, and with the boot disk removed. Run the software and
look for unexpected behavior, even simple behavior such as unexplained figures
on the screen. Test the computer with a copy of an up-to-date virus scanner,
created before running the suspect program. Only if the program passes these tests
should it be installed on a less isolated machine.
Open attachments only when you know them to be safe. What constitutes "safe" is
up to you, as you have probably already learned in this chapter. Certainly, an
attachment from an unknown source is of questionable safety. You might also
distrust an attachment from a known source but with a peculiar message.
Make a recoverable system image and store it safely. If your system does become
infected, this clean version will let you reboot securely because it overwrites the
corrupted system files with clean copies. For this reason, you must keep the image
write-protected during reboot. Prepare this image now, before infection; after
infection it is too late. For safety, prepare an extra copy of the safe boot image.
Make and retain backup copies of executable system files. This way, in the event
of a virus infection, you can remove infected files and reinstall from the clean
backup copies (stored in a secure, offline location, of course).
Use virus detectors (often called virus scanners) regularly and update them daily.
Many of the virus detectors available can both detect and eliminate infection from
viruses. Several scanners are better than one, because one may detect the viruses
that others miss. Because scanners search for virus signatures, they are constantly
being revised as new viruses are discovered. New virus signature files, or new
versions of scanners, are distributed frequently; often, you can request automatic
downloads from the vendor's web site. Keep your detector's signature file up-to-
date.
Causes of Trapdoors
8
Developers usually remove trapdoors during program development, once their intended
usefulness is spent. However, trapdoors can persist in production programs because the
developers
intentionally leave them in the program for maintenance of the finished program,
or
Salami Attack-:
Developmental Controls
specify the system, by capturing the requirements and building a model of how
the system should work from the users' point of view
design the system, by proposing a solution to the problem described by the
requirements and building a model of the solution
implement the system, by using the design as a blueprint for building a working
solution
test the system, to ensure that it meets the requirements and implements the
solution as called for in the design
review the system at various stages, to make sure that the end products are
consistent with the specification and design models
manage the system, to estimate what resources will be needed for development
and to track when the system will be done
maintain the system, tracking problems found, changes needed, and changes
made, and evaluating their effects on overall quality and functionality
9
how we recognize high-quality secure software?
Reuse. Components developed for one purpose can often be reused in other
systems. Reuse of correct, existing design or code components can significantly
reduce the difficulty of implementation and testing.
Testing. A single component with well-defined inputs, output, and function can be
tested exhaustively by itself, without concern for its effects on other modules
(other than the expected function and output, of course
Coupling
10
Encapsulation-:encapsulation is the "technique for packaging the information
[inside a component] in such a way as to hide what should be hidden and make
visible what is intended to be visible
Peer Reviews-:There are careful distinctions among three types of peer reviews:
Inspection: This more formal process is a detailed analysis in which the artifact is
checked against a prepared list of concerns. The creator does not lead the
discussion, and the fault identification and correction are often controlled by
statistical measurements.
peer reviews
hazard analysis
testing
good design
prediction
static analysis
configuration management
analysis of mistakes
11
12