Testing Code Security
Testing Code Security
Testing
Code
Security
Auerbach Publications
Auerbach Publications
Taylor & Francis Group
6000 Broken Sound Parkway NW, Suite 300
Boca Raton, FL 33487-2742
© 2007 by Taylor & Francis Group, LLC
Auerbach is an imprint of Taylor & Francis Group, an Informa business
This book contains information obtained from authentic and highly regarded sources. Reprinted
material is quoted with permission, and sources are indicated. A wide variety of references are
listed. Reasonable efforts have been made to publish reliable data and information, but the author
and the publisher cannot assume responsibility for the validity of all materials or for the conse-
quences of their use.
No part of this book may be reprinted, reproduced, transmitted, or utilized in any form by any
electronic, mechanical, or other means, now known or hereafter invented, including photocopying,
microfilming, and recording, or in any information storage or retrieval system, without written
permission from the publishers.
For permission to photocopy or use material electronically from this work, please access www.
copyright.com (http://www.copyright.com/) or contact the Copyright Clearance Center, Inc. (CCC)
222 Rosewood Drive, Danvers, MA 01923, 978-750-8400. CCC is a not-for-profit organization that
provides licenses and registration for a variety of users. For organizations that have been granted a
photocopy license by the CCC, a separate system of payment has been arranged.
Trademark Notice: Product or corporate names may be trademarks or registered trademarks, and
are used only for identification and explanation without intent to infringe.
QA76.9.A25.V359 2007
005.8--dc22 2007060350
Contents
Acknowledgements.................................................................................................. xxi
About the Author................................................................................................... xxiii
1 Introduction.............................................................................................. 1
Why Is This Book Being Written? ................................................................... 1
Why Am I Writing This Book.......................................................................... 2
Goals of This Book .......................................................................................... 3
Intended Audience............................................................................................ 4
How This Book Is Organized.......................................................................... 4
2 Security Vocabulary................................................................................. 7
Virus or Attack Naming.................................................................................... 7
Security Terminology ........................................................................................ 8
vi
vii
viii
ix
x
xi
xii
xiii
xiv
xv
xvi
xvii
xviii
xix
Acknowledgments
xxi
xxii
taught me a lot and shared my passion for security. Thank you for your
encouragement and support. I did do it!
Thanks to my agent, Neil Salkind at Studio B, for his patient work in
selling my idea and encouraging me
A huge note of appreciation is due to my editor John Wyzalek who
waited patiently as this new author discovered a few of the truths of
writing something this size. Thank you for understanding my desire to
make this book the very best it can be and not killing me when it took
far longer than I thought it would.
Lastly, thanks to the rest of my family, friends, and co-workers, past
and present. You served as guinea pigs, moral support, test readers, and
generally kept me from insanity while understanding that this book
consumed my life for a while. Thank you for your patience, forbearance,
cheese to go with my whine, and just for being there!
xxiii
Chapter 1
Introduction
jargon and terminology, locating information can take a lot of time and
a lot of data mining.
All too often, in the course of this research, testers become lost —
especially the more junior testers. What security testing do they need to
do? There are a lot of vulnerabilities to choose from. Do they need to
wade through the intricate details of each one to determine if they need
to test for it? It’s a time-consuming, daunting, and nearly overwhelming
task. How do they go about designing test cases for it? How do they
integrate this into their ongoing process and methodology? What is this
threat-modeling process, and do they care?
There really aren’t resources for those testers who want to learn more
of a framework with which to approach security testing but are not yet
assigned to a product; or for those testers in school or in a test certification
program. There needs to be a consolidated resource available that will
teach the basic software security concepts specifically to testers and that
will start at a basic-enough level to be truly useful to them.
The view in the software industry is already changing. The idea that
security testing is an arcane specialization that only a few testers practice
is disappearing. The idea that security testing is the domain of only white-
box testers is also disappearing. Software security is really everyone’s
problem and, more and more often, even entry-level testers are expected
to be familiar with basic software security and include it as a standard
part of their test practices.
Introduction 3
How to think about the process of security testing and the differ-
ences between it and traditional functional testing
What role threat-modeling plays and its pitfalls are
How to approach the creation of a security test plan
What the root problems are behind various types of vulnerabilities,
especially those that have been exploited, and ideas on how to
test for them
The goal of this book is not to make anyone into a security expert or
a hacker. There are plenty of books and reference materials already
available on that subject, and I’ve listed a few in the section on additional
reading at the back of this book.
The word security encompasses a huge amount of territory, and not
all of it could (or should) be covered in this book. Subjects such as
Intended Audience
The intended audience for this book is the beginning-to-intermediate
software tester. Advanced or more senior testers may find the information
of use as well, but they are not the primary audience for this material,
and some of the subjects may be more simplified than they would prefer.
Although some of the information in this book uses Microsoft Win-
dows® (Microsoft Corporation, Redmond, Washington) functionality as an
example case, it is purely because that’s what I’m most familiar with. Most
classes of security vulnerabilities are not unique to a particular operating
system, and the concepts introduced are not platform or operating-system
dependent. In the cases of the few that are unique or specific, I have
noted that in their section.
Introduction 5
Chapter 2
Security Vocabulary
SKA
WSOCK32.SKA
SKA.EXE
I-Worm.Happy
PE_SKA
Trojan.Happy99
Win32/SKA
Happy99.Worm
As you can see, you really can’t count on much in the way of
consistency in any particular virus’s names. This makes researching a
particular virus not only a little more difficult, but seeing any relationships
between multiple viruses or attacks becomes extremely difficult. So, never
rely on the name of the virus to tell you much of anything about it.
Security Terminology
Software security and software security testing, like many other special-
izations, comes with its own concepts and vocabulary. At first it can seem
somewhat like attempting to decipher the Rosetta Stone; so, I have made
a list of some of the most common terms and their meanings to make it
easier for you to be able to get the most from this book. Remember that
this is not a complete list but only a basic one.
Security Vocabulary 9
Chapter 3
11
quality by throwing more and more people at it had been showing its
weak points, including the fact that it wasn’t really scalable.
Now the goal became to “work smarter, not harder.” Test automation
became the “magic bullet,” and huge efforts were begun to automate
everything possible. The accepted wisdom was that this would reduce
the costs associated with software testing by reducing the number of
people needed to achieve the same or better level of test coverage.
A side effect of this movement was that, to be considered for a position
as a software tester, many employers now wanted considerable coding
and programming skills. If anything, coding skills were considered more
important than test skills. More developers moved into software testing
who already had the programming skills but needed to learn to test. There
were more resources available to testers by this time, but they were still
focused mostly on development and program management instead of
skills specific to testing.
By now, new test methodologies were being introduced and champi-
oned by various segments of the industry. Testers were being inundated
with theories, opinions, and tools. Probably the biggest challenge as testers
at this time was figuring out how to stay informed and sift through all
the changing technologies and automation requirements for things they
may be able to use on their projects. Then they had to figure out which
to integrate into their ongoing professional repertoire so they could do
the best job of testing possible with the least amount of overhead.
At this point the pendulum had swung back a bit, and automation
was no longer perceived as the be-all end-all cure for the expenses of
software testing. However, software testers were still left with the problem
of trying to integrate knowledge and skills that are not produced with an
eye to software testing into something they can use to improve their test
efforts. This was especially difficult for those testers performing black-box
testing where the lack of visibility into the code makes it more difficult
to use the code-level techniques.
A whole new challenge has now arisen. Testers are now being told
to integrate security testing into their test passes or to switch entirely from
functional testing to security testing. It sounds simple — if you are not
the tester being told to change your entire mindset about testing and to
do it now, if not sooner.
90
80
70
% of Those Surveyed
60
50 Home
School
40 Work
30
20
10
0
1984 1989 1993 1997 2001 2003
Figure 3.1 Computer use in the United States: 1984 through 2003.
70
60
50
% of Those Surveyed
40 Home
School
30 Work
20
10
0
1997 2001 2003
Figure 3.2 Internet use in the United States: 1997 and 2003.
70
59.5
55.3
54.5
60
48.6
46.5
50
41.7
40.1
37.4
Percent
40 1997
32.3
32.8
2001
26.4
25.7
30 2003
22.1
21.5
19.3
17.6
20
12.5
11.7
11.5
11.5
10.4
10.2
9.4
7.2
6.8
6.2
10
5.2
4.3
3.9
3.2
2.3
2.1
2.1
0.6
0
0
0
ls
et
ph line
n
l
es
es
es
es
s
e
ai
ts
io
al
io
rn
nd
Jo
in
c
ic
ic
Em
am
n
d
eC
vi
at
te
n
nl
e
rv
Ra
rv
a C l Fu
ra
nm
er
Te e O
m
In
O
Se
on
Se
fo
/S
to
or
ay
ua
nk
g
ig
rs
lth
d
ts
nf
sin
ch
en
ss
Pl
an
ou
ut
Ba
uc
le
sI
ea
ar
A
st
lU
M
od
ts
rt
t/H
Se
Li
ol
uc
ta
s,
po
Pr
ho
s,
ck
ke
To
en
od
ie
,S
se
Sc
to
Ta
ov
nm
Pr
er
ha
eS
M
th
on
rc
er
ad
ea
or
Pu
ov
n
Tr
W
io
TV
at
s,
n
no
ew
rm
ew
io
N
fo
Vi
at
In
rm
fo
In
Figure 3.3 Population 18 years and older using the Internet for a specific task:
1997, 2001, and 2003.
The way people deal with personal finances has changed. In 1997,
online banking wasn’t even reported, but by 2003 18 percent of adults
used online banking.
Even shopping habits have changed. The percentage of adults who
used the Internet to research purchases and products was also not mea-
sured in 1997, but in 2003 it was at 46.5. The percentage who actually
bought something online rose from 2 in 1997 to 32.3 in 2003.
The expansion and migration of all these activities from their prior
methods such as in person (sometimes called brick and mortar), catalog,
or mail to being performed online have the following multiple impacts
when it comes to security:
Users are visiting the Internet and making use of more and more
online resources; thus more potential victims are being exposed
to more potentially malicious software.
As users become more and more used to carrying out tasks that
involve their most sensitive information online, they naturally have
a tendency to become more trusting and less likely to continually
exercise sufficient caution when disclosing personal data. This
makes their vulnerability to some attacks increase significantly.
In its own way, it was akin to publishing studies of the way safety
restraints can be built into automobiles to save lives. Once there was a
push that made the issues known and indicated that there were steps that
could be taken to alleviate or eliminate them, the ability to merely accept
or ignore the issues or their consequences was no longer as viable of an
option.
Potential downtime
What will be the impact in dollars of downtime on the business
if this software is adopted?
What other systems will be affected by this software going
down? What is the cost associated with that?
Data theft
What data does this system collect?
What data does this system store?
What is the cost associated with the theft of that data?
What is the cost associated with the destruction of that data?
What is the cost associated with the publication or spread of
that data?
Cyber-vandalism
What is the impact of possible vandalism or destruction of this
software or its data?
Bibliography
Computer Use in the United States: October 1984. United States Census Bureau.
Available from http://www.census.gov/population/www/socdemo/computer/
p23-155.html.
Computer Use in the United States: October 1989. United States Census Bureau.
Available from http://www.census.gov/population/www/socdemo/computer/
p23-171.html.
Computer Use in the United States: October 1993. United States Census Bureau.
Available from http://www.census.gov/population/www/socdemo/computer/
computer93.html.
Computer Use in the United States: 1997. United States Census Bureau. Available
from http://www.census.gov/population/www/socdemo/computer/97tabs.
html.
Computer and Internet Use in the United States: September 2001. United States
Census Bureau. Available from http://www.census.gov/population/www/
socdemo/computer/ppl-175.html.
Computer and Internet Use in the United States: October 2003. United States
Census Bureau. Available from http://www.census.gov/population/www/
socdemo/computer/2003.html.
Computer and Internet Use in the United States: October 2003 Special Studies.
United States Census Bureau. Available from http://www.census.gov/prod/
2005pubs/p23-208.pdf.
Howard, M. and Lipner, S. The Trustworthy Computing Security Development
Lifecycle. March 2005, Microsoft Corporation. Available from http://msdn.
microsoft.com/library/default.asp?url=/library/en-us/dnsecur e/html/
sdl.asp.
Chapter 4
I consider the analyzing and questioning of both the giving and accepting
of trust in any form as the key to security testing. When I read my first
book focused on software security, Writing Secure Code by Michael
Howard and David LeBlanc (Microsoft Press, 2001), I was intrigued by
the stress put on one of its core concepts — “All input is evil.” After quite
a few years of security testing and self-education, I’ve decided that, though
it’s a valuable and very true concept, it really doesn’t go far enough.
When carefully examined, most security exploits occur because of trust.
Quite often this takes the form of a security vulnerability where trust is
granted inappropriately. This can apply to cases of explicit trust where,
for example, a source is verified; then anything coming from (or believed
to be coming from) that specific source is trusted. It can also be cases of
implicit trust where, for example, incoming information is trusted because
it uses a particular protocol and the correct port.
All trust is misplaced. You’ll find that these words appear a lot through-
out the rest of this book as I point out trust issues to consider. This is
also the key statement to remember when understanding the mindset
differences between functional and security testing.
As software is designed and developed, a number of things are taken
for granted that are outside the direct control of the software that is relying
on them. Because software is written to specifically solve one or more
problems, the focus during the design and development process is on
how it will solve the target problem or problems for the intended cus-
tomers in the easiest, most effective, and least expensive way possible.
23
In all these cases, assumptions were made, and trust was granted based
on those assumptions. But trust that is issued based on assumption is
inherently dangerous.
Chapter 5
Security Testing
Considerations
27
That being said, despite the common wisdom of reducing test time
and expense by eliminating redundant test cases, I strongly feel that there
should be overlap between purely functional test cases and security test
cases. This is because the pass or fail criteria for the two types of tests
can be so different. I’ve found that more bugs are missed when assessing
the results of a test case if the tester is attempting to assess both functional
and security criteria at the same time. The mindset is different as well as
the validation and verification, and it’s far too easy to not be 100 percent
thorough with both.
As an example, if I am running boundary tests on my software’s sign-
up function, and specifically on the username field, it would be a typical
functional test for me to try employing a username that is the length of
the username field +1 long. If I was running a black-box security test on
that field, I would try a very long username and construct it with a specific
set of characters that I could recognize if it came up in an error dialogue
or in a tool I may be using to examine the contents of memory, the
registry, etc. Although these are both overly long entry tests, they are not
equivalent and should really not be combined into a single test.
Most of the time, the steps required to set up and run a security case
aren’t well suited to a functional case, and combining them isn’t attempted,
but if the question comes up, think carefully before that type of test case
consolidation is attempted.
That said, I have had the experience, while running one type of test,
of getting ideas for another type of test, and those flashes of intuition
should not be ignored. I advocate always keeping a notepad at hand.
Code Maturity
Traditionally, the guideline for testing existing code is that the more mature
the code is, the smaller the percentage of bugs that will be found in that
code. This is based on the fact that bugs are often found by users and
through prior test passes, so there are fewer and more esoteric functional
bugs left to find as time goes on. This “stable” code is often only given a
More security vulnerabilities and attack vectors are found all the
time, so code that was written before those came to light may still
contain them.
More ways are found to exploit security vulnerabilities previously
deemed to be unexploitable every day, so code that was written
prior to those exploits is more likely to still contain those vulner-
abilities.
More tools are being created and distributed that allow exploits to
be created and attacks carried out by a greater number of people
who have far less technical knowledge than ever before. This
increases the odds that any security vulnerabilities already present
in existing code will be found and exploited, and having these
vulnerabilities in existence and exploitable for longer periods of
time gives these tools and attackers longer to discover and craft
exploits for them.
Developers (and testers) have become more security conscious
over time and are less likely to make the same mistakes today that
they might have made previously. This is partly due to receiving
more security training and partly due to self-education, as vulner-
ability exploits hit the news.
Code Complexity
The rule of thumb for testing when it comes to code complexity remains
basically the same. The more complex the code in the project, the more
likely it has to have functional bugs. The more complex the code, the
more likely it is to have security vulnerabilities as well.
Code Coverage
This speaks more about how much prior testing the code has received
but specifically about how much prior security testing. If the code has
received extensive security testing previously via code analysis (code
reviews or security test tools), it’s less likely to contain security vulnera-
bilities than code that has never been examined before.
You should know that it’s very difficult to use automated code coverage
tools to provide meaningful data on security testing. The standard of
measurement for code coverage metrics is the percentage of code touched
during a test pass, but this isn’t terribly meaningful for security test efforts.
Although it’s common (and wise) for white-box testers to walk through
all the code in search of security vulnerabilities, the actual percentage of
code that is touched by testing is really most meaningful to functional
testing.
Accidental Discovery
Almost everyone I’ve talked to has discovered some bug or undocumented
feature in software by accident. These can be very minor things, or
sometimes a major bug turns up this way. I still remember that, during a
class I took on a popular spreadsheet program, the instructor taught us
Insider Information
It’s not at all unusual for current or former employees to leak information
about security vulnerabilities — both specific vulnerabilities and more
general areas of possible vulnerabilities. This also goes for employees of
companies doing contract or subcontract work in either software produc-
tion or technical and product support. Because these people are in
positions where they have access to everything from lists of known security
vulnerabilities to source code, they can do considerable damage — both
to the software company as well as the customers and consumers using
the software.
Some insider information isn’t as deliberately harmful, but with enough
pieces of this information (not harmful in and of themselves), attackers
may be able to connect the dots and get lucky enough to fi nd an
exploitable vulnerability. Just consider how long it would take for one of
the old “Easter eggs” to be found after a product is released, and you
will get an idea of how fast what most likely started out as a hint or two
on how to access the Easter egg became a full-fledged set of instructions
and then became common knowledge.
The reason or reasons for the deliberately malicious leak varies greatly,
but the most common reasons are revenge, vanity, or greed.
ethical hackers (often called grayhats) and the security professionals (often
called whitehats).
What?
The first question is what the attackers may aim at. The answer is basically
the list of assets that may be at risk and, if you are doing threat modeling,
this list of assets and the one from the threat model should be in agreement.
If they are not in agreement, the differences should be analyzed and
resolved.
I deliberately look at this list of possible attack targets separately from
any threat model because I seem to think of different assets when I am
making a list for my own use instead of for a formalized process. After
this list is made, I do reconcile it with the list used in the formal threat
model (if one is being done).
A few ideas of assets that could serve as the goal of an attack are:
User Assets
User login information
User permissions
User data
System Assets
Availability of system and services
System processes
Data and information on system
System permissions
Network Assets
Availability of network
Why?
Why would someone want to attack the asset? If there was no reason to
attack it (i.e., it’s not attractive in some way), then there would be no
point in doing so. This is basically their motivation for the attack. The
reasons can include:
Cyber-Terrorism
Hacktivism
Cyber-extortion
Defamation
Data
Data theft
Data destruction
Data modification
Resources
System resource theft
Network resource theft
Who?
Who are the people that are performing the attack? There can be any
number of them from both sides of the proverbial fence (malicious
attackers and security researchers) and of all skill levels. These can include:
Security researchers
Script kiddies
Talented individual hackers
Organized crime
Attacks for hire
Disgruntled current or former employees
Competitors
Create a Matrix
The easiest way I’ve found to clearly see the combinations that I believe
are useful or valid for my project is to create a basic matrix and walk
through it. I rate the various combinations according to how much of an
issue I think they are for my project. To make life easier, I rate each line
from 1 to 3, with 1 as the highest level of concern. This gives me the basic
data for creating security personas, if I am using them, or later test cases.
Table 5.1 shows what just a small sample of a matrix can look like.
Table 5.1 What, Why, and Who Security Matrix (Partial) (Continued)
Priority Asset Motivation Attacker
Trojan
A Trojan in software security means a seemingly attractive or innocuous
program that hides malicious software inside.
This is named after the ancient Trojan horse of the Trojan wars where
King Odysseus of the Greek state of Ithaca set a giant wooden horse
before the gates of Troy that, instead of being a gift, hid Greek warriors.
When the citizens of Troy dragged it inside, it allowed the Greek soldiers
to come out of the horse and open the gates of Troy to let the army into
the city.
Trojans aren’t typically capable of spreading themselves, but instead
they require a separate method of distribution, and that usually consists
of the file containing the Trojan being transmitted to potential victims
using methods like e-mail, instant messaging, IRC, ICQ, etc. When the
potential victim opens the file, the Trojan is installed. Trojans can also be
Virus
A computer virus is a program, typically malicious, that reproduces by
adding itself to other programs, including those belonging to the operating
system. It cannot run independently but needs a “host” program to be
run in order to activate it.
The source of the name is a reference to biological viruses that are
not considered alive in the usual sense and can’t reproduce independently,
but rather invades host cells and corrupts them into producing more
viruses.
Macro Viruses
A macro virus uses some sort of scripting language, often Visual Basic™
(Microsoft Corporation, Redmond, Washington) or JavaScript™ (Sun Micro-
systems, Inc., Santa Clara, California), and infects types of datafiles from
applications that support that scripting language. This is most well known
from the incidents of infections among the various datafiles of Microsoft
Office™ (Microsoft Corporation, Redmond, Washington) suite.
Multi-Partite Virus
This is simply a virus that exhibits the characteristics of more than one
of the types of viruses.
Worm
A worm is a program that can copy a fully functional version of itself to
other machines across a network without intervention. It doesn’t usually
require another program in order to run, but worms can, and do, some-
times hide behind other programs.
The source of the name is a derivative of “tapeworm,” which is a
parasitic organism that lives inside a host and saps the host’s resources
in order to maintain itself.
Logic Bomb
This is a piece of code that sits and waits for some piece of program
logic to be activated and then activates the bomb’s payload. Date bombs
are the most common type of logic bomb, but the trigger could be anything
from a message to the deletion of a file or directory, or a file size.
Logic bombs don’t replicate themselves but instead have to be specif-
ically targeted to the recipient. These are sometimes attached to a delivery
mechanism that will install the logic bomb on a user’s system.
Imagine that someone persuades you to give him or her the last four
digits of your social security number to “verify your identity,” and then
you get a call from a very convincing man who says he is from your
bank and who tells you that the bank has intercepted a case of suspected
identity theft using the social security number it has on file for you. He
tells you the last four digits and then asks you to repeat the entire number
so he can verify that your number is indeed the one being used and the
bank can take action. By the end of the call, if you’ve fallen for the con
game, the con man has your entire social security number and certainly
already has your name, address, and phone number. Now the con man
has a set of data that can result in identity theft.
There are two basic types of social engineering — active and passive.
Active Attacks
In active social engineering, the con artist has direct contact with the
potential victim. This could take the form of telephoning the victims to
talk them into revealing a password or other private information, and in
many ways this resembles one of the more classic telephone scams.
This could also be an in-person attack where the con artist shows up
at the office door and pretends to be a representative of your company’s
software vendor, and needs to install an emergency patch on your system.
Almost all active attacks depend on one or more of the following
methods to gain the information and access the con artist needs:
Passive Attacks
Passive attacks attempt to obtain information with stealth. They tend to
be carried out in bulk so as to maximize the return. After all, why send
one or two e-mails (or even fifteen or twenty) when you can send tens
of thousands for not much more of an investment? This is true especially
if you are using someone else’s e-mail server or account.
These passive attacks use some of the same methods as the active
attacks but aren’t nearly as specific as the latter. They don’t have as high
a percentage of success, but with the quantity involved and the relative
inexpensiveness, only a few successes are needed for them to pay off.
They are also more anonymous than the active attacks.
Phishing
Passive attacks include items like phishing, where many thousands of e-
mails are sent to potential victims claiming that the person needs to change
a password or verify a credit card number, and includes a helpful link to
click on to do so. This link typically leads to a look-alike site, many of
which are quite cleverly done, but entering data on these look-alike sites
is the equivalent to handing the attacker your information.
A lot of these links are titled in a way intended to conceal the truth
of their origin or exact nature. The hyperlink title may be “eBay Password
Change,” but if the potential victim hovers over the text to see the URL,
they may be able to tell that it doesn’t even have a similarity to eBay.
Some of the URLs themselves are designed to deceive. A phisher may use
a domain very similar to that of the legitimate entity they are masquerading
as (for example “www.ebaysecurity.com”) These links are, however, sim-
ilar enough to deceive the potential victim who only gives it a quick glance.
Lately, I’ve even seen some look-alike sites place a false “lock” symbol
on their web page to pretend to be an HTTPS site. Because users are
taught to look for this lock symbol as a sign that a site is safe, they may
see that lock and never even look at the address and see it’s not an
HTTPS site at all, but rather an HTTP site using a bitmap to deceive them.
There is also a play on trust if the e-mail you get happens to claim
to be from a company or entity you already use. Most of the time, that
is merely a random event because phishing e-mails tend to be “blanket”
mails rather than specifically targeted e-mails.
E-mail headers are notoriously easy to spoof, but despite that fact
being rather well known, many people still believe that the e-mail they
receive is indeed from who it claims to be from.
These passive attacks can also include pop-ups and redirects that the
potential victim can’t verify the source of and which may lead them to
believe that they need to enter their name and password again, but that
information is really being sent to the phisher instead.
Urban Legends
Although not technically a security risk, a look at how urban legends
begin and are subsequently spread is an interesting study in some of the
aspects of social engineering.
Urban legends are cautionary tales couched as tales of actual events
that always seem to happen to someone only slightly removed from the
alleged writer. Some are true and some are fictitious, but they all share
the fact that they play on human fears. Most urban legends ar e also
modern tales — supposedly taking place relatively recently.
These are often spread in e-mail and are typically forwarded to us by
a friend, family member, coworker, or online acquaintance. I often see
them spread in newsgroups and e-mail lists as well. Although many of
these tales seem dubious at best, a surprising number of people will look
at the e-mail and immediately begin forwarding them to their friends and
e-mail lists without ever attempting to verify the information they contain.
When these people are confronted with information that the e-mail
they forwarded is an urban legend and that they should check their
information before passing it on, they almost inevitably became defensive.
They immediately claim that it has to be true because it came from so-
and-so who would never send them something that isn’t true. Their
defensiveness seems to be dual edged — part “how dare I cast doubt on
the integrity of so-and-so” and part feeling embarrassed that they fell for
the story and didn’t ask questions.
However, the point doesn’t seem to get through that I am not casting
doubt on so-and-so’s integrity. I’m sure that the people who forwarded
that mail, all the way up the line to whoever first received it from the
original author, sincerely believed that it was true and the cautionary tale,
picture, warning, etc., should be passed on to their friends and relatives.
Each person in the chain trusted the information’s source. The motives
of the original author, however, are often a different matter.
All trust is misplaced. Just because someone you know forwards an e-
mail to you, never trust that the e-mail is true.
to take extra care in your bug reports to explain the risks and possible
costs if this vulnerability is exploited or if it contributes to an exploit.
I’ve heard this response in reaction to security bugs I’ve filed, but my
answer is always the same — it may not be a user scenario but it’s an
attacker scenario.
All trust is misplaced. Never trust the intentions of the consumers of
your product. Pessimism is rarely misplaced.
more secure product, it never means there isn’t a need for security testing.
Even the most dedicated and security-aware developer will miss things
that a security tester performing a comprehensive review and test pass
may be able to catch.
There is also the issue that, although many developers may have a
security focus, they may not have a great deal of security training to go
with it.
All trust is misplaced. Never trust the use of secure coding practices
or standards to be the sole source of your product’s security.
It’s obvious that placing trust in all three of these statements being
true all the time is a long shot at best.
All trust is misplaced. Never trust that the backend is unreachable.
Requirements Phase
The first task at this stage is to gather information on:
Design Phase
This phase is the one during which the prioritized feature list from the
requirements phase is taken, broken down into logical areas or categories,
and then functional specifications are written. The functional specifications
document what the system is going to do.
Implementation Phase
Once the design specifications are complete, the implementation phase
begins. The whole focus of this phase is to write the code to implement
the design specifications that were produced in the prior stage. Sometimes,
as design specifications are completed and reviewed, developers will begin
writing the code for them even as other design specifications are still
being completed and reviewed.
Peer code reviews and formal code reviews are also a typical part of
this phase.
Again, although it’s not traditionally included in this phase, as soon as
the code for any particular area is at all testable, you should start to test
it. This will help the goal of finding bugs as early as possible and also
compress the time needed to test the release.
I also advise you to attend any formal code reviews you can, even if
you aren’t a hugely technical tester or you are doing purely black-box
testing. I constantly pick up useful information and a better understanding
of the system by attending code reviews.
The other point I want to stress is that you should be talking to the
members of the other disciplines all throughout the software life cycle. I
realize that there are some authors and speakers who seem to treat
software testing as a discipline that operates almost in a vacuum and
doesn’t really speak or work closely with any other disciplines, but I feel
that this is one of the worst messages that can be given to any new tester.
I strongly believe that consistent communication with the other disciplines,
especially with your developers, is a key ingredient in an excellent test
effort. So, not only should you attend code reviews but you should also
ask questions — lots and lots of questions.
Verification Phase
This is the traditional phase for the majority of testing to be done in.
During this phase, the code written in the implementation phase and any
other code in the system that is carried forward is tested to verify that it
meets its specifications. It includes functional testing as well as security
and other types of testing, although they are not being done against the
standard of the functional and design specifications but rather against
other criteria or standards.
During the verification phase, the focus is on the bugs. The process
of finding bugs, filing them, fixes being made to resolve them, and then
those fixes being verified is called a “find/fix cycle,” and there are typically
several of these in the verification phase of each release.
If the product needs a beta release to a larger audience than the
product team, the system can be released one or more times during this
phase, and the beta testers will also be able to contribute bugs they find.
As these bugs are reported, they are usually given to one or more testers.
The testers then take the beta bugs and perform a number of steps on
them before they are passed into the regular bug process:
It is possible to have more than one beta release, and each one would
follow the same cycle. The number of beta releases is usually determined
as a part of the initial phase of the life cycle and included in the release
criteria.
At the very end of this phase, there is typically a formal regression
pass where all bugs fixed in this release (and sometimes the high-priority
bugs from prior releases) are verified again to make sure that none of
them has returned (regressed) before the product is released as complete.
Release Phase
Once the verification phase has been completed, the code is checked to
see that all release criteria have been met, then approved or signed off
on for release (typically by a representative of each discipline), and then
the code signed, if necessary.
The code is then released to whatever method of delivery is appropriate
to the type of system it is meant for. This is typically called RTM (released
to manufacturing) or RTW (released to Web) at this stage.
Support Phase
The released system now is in the support phase, and product support
(or technical assistance) takes over the daily work by assisting customers
and researching any bugs or feature requests that are submitted by the
system’s customers.
Any bugs that must be fixed before the next product release is planned
are often assigned to a QFE (quick fix engineering) or OE (ongoing
engineering) team to be fixed. The fixes are then grouped and pushed
out to the system’s customers as service packs as well as integrated into
the system code to insure that the fix is included in the next version of
the system. The urgency and severity of the issue determines if the fix
must also be released as a patch or “hot fix.”
Security updates, on the other hand, are generally issued as patches
and released for download immediately rather than holding them for
release until enough other code fixes are accumulated. This is because
most security fixes made between releases are urgent.
security review into a structured process that can reduce the number of
security vulnerabilities found after system shipment. There are four main
high-level principles in the SDL.
Secure by Design
The system has to be designed from the start to protect both itself and
any information it processes, as well as to be resistant to attacks. This
design has to be carried out through implementation as well.
Secure by Default
The default state of the system should minimize the possible risks when
attacks (successful or unsuccessful) take place. This includes items such
as running at least access, turning off features not needed by the majority
of users, etc.
Secure in Deployment
The software needs to be shipped with documentation and manuals that
will help both the end users and administrators install and use the software
securely. Any updates must also be easy to install.
Communications
There must be open and responsible communication with consumers
when product vulnerabilities are found, in order to keep the end users
and administrators aware of how to take proactive measures to protect
themselves.
In addition to the preceding four main principles, the SDL lays out the
security tasks that need to take place at each step in the traditional software
development life cycle.
Probably, the key aspect to the success of any attempt to adopt SDL
is education — a lot of education. Most people (in all disciplines) do not
come to a project already completely educated on what they need to do
to insure an effective and comprehensive job of implementing SDL. An
educational effort needs to be put in place, both at the beginning of SDL
adoption and on an ongoing basis. This can be an in-house or a contract
effort, or even a mix, depending on the size of the organization and its
needs. Figure 5.2 shows a graphical representation of SDL.
Requirements Phase
The first thing to be done at this stage is to determine a person who will
serve as the point of contact, advisor, and resource as the release goes
through the stages of SDL to release. This person must have the training
and experience sufficient enough to lead and guide the project and its
team. Such a person is the Security Advisor (SA), who also assists in
reviewing plans, making recommendations, and insuring any required
resources or training are received by the team.
During the requirements phase, the following decisions are made:
All of the preceding steps should be taken into account and addressed
at the same time the new feature and other requirements are being
collected.
Design Phase
During this phase in the software development life cycle, the overall plan
and architecture for the system is created. As the project goes through
this stage, the SDL focus is:
Implementation Phase
During this phase, coding and integration are performed. Note that, in
the Microsoft version of the SDL, this is when the for mal testing is
conducted, but testing should (and usually does) continue all the way
through until the system is actually shipped. Any steps that can be taken
in this phase to prevent or remove security flaws are very inexpensive,
and they significantly reduce the chance that these flaws will make their
way into the final version of the system. In the SDL, the following steps
are implemented:
Verification Phase
This is the phase in which the features are code complete and testing
(include beta testing) is being conducted. In the SDL, this is the time that
more focused code reviews and a specific security test pass are conducted.
It allows review and testing of not only the new or modified code but
also the legacy code that was not modified during the release phase.
Release Phase
The release phase in the SDL is when the system is put through a final
security review (FSR). This review is designed to answer the question of
whether the system is now ready to be released to the customers from a
security standpoint. The stated ideal is to have the FSR conducted two to
six months before the system is to be released, both to insure that the
FSR is conducted on code that is as mature as possible and as least likely
to be changed. Of course, this depends heavily on the release schedule
of the system, and the move to faster and more nimble release schedules
makes this timeline an almost unattainable goal in many cases.
The FSR is intended to be conducted by an independent team, and
sometimes even by outside security review consultants. This is to try to
isolate the FSR from preconceptions and biases that exist on the product
design team as much as possible.
with your own. This relationship can be as simple as running on the same
piece of hardware, running on the same network, and where your system
is designed to directly interact with another system or systems.
If your system has poor (or no) security, it is putting all the other
interrelated systems at increased risk. Failing to find and fix security
vulnerabilities has repercussions as well, even if you feel that your own
system has no real assets to protect that would make any difference.
For example, my system is a little applet for amusement, written in C,
which acts like a fortune cookie. It has a UI that takes a string as a
question and returns a string that is your fortune. Now, say this ships
with one or more large software packages as a “game”; there may be a
lot of copies out there. It’s also able to take the input via an API and
return the string result. It sounds harmless, and there’s not even anything
to protect.
Now, what happens if I am calling the API and, instead of passing in
a string that’s a reasonable length (assuming I know what that is) for a
question, I pass in a string that overflows the buffer? I have a buffer
overrun vulnerability and any attacker owns the computer my system is
installed on. This is akin to having a house with alarms and huge locks
and thick strong doors — and leaving the front door standing open. The
lack of a very simple security test for my system has now compromised
every computer it is installed on.
a little bit of tunnel vision when it comes to implicit interfaces with other
systems.
Most developers I’ve worked with are also somewhat optimistic. When
they write code, their first concern is to make it work and, often, once
they get it to work, they don’t test it themselves any further, and they
retain an optimistic view that it won’t break unduly.
Risk
What asset is at risk because of this security bug?
Cost to Fix
What is the cost in time to fix and do any retesting of the revised code
if this bug is fixed? You may not know the cost, but you can often get
an idea by talking to one of the developers.
Cost if Exploited
What are the monetary and nonmonetary costs to the company if the bug
is used in a security exploit? What are the costs to the customers?
Possible Solutions
These would be ways to eliminate the security bug completely, and may
be possible if the bugs are pretty clear-cut code mistakes or oversights.
Possible Mitigations
Consisting of ways to mitigate the security bug, these can include addi-
tional validations, filtering, etc. They may not eliminate the bug but will
mitigate or reduce the risks of its existence.
Be Persistent
Don’t let a lack of immediate understanding or eagerness on the part of
the other team members put you off. Software security is a complex and
unfamiliar subject for many companies, and it can take time to really see
some change taking place.
Share Knowledge
Any knowledge you can share with others on your product team, your
division, or even your company can help keep attention on the subject
of security and educate others at the same time. This can be as simple
as passing around articles of interest and as complex as holding informal
classes or meetings to review the basics of various security subjects.
the industry, what is being done to address them, etc. Even the number
of security related tests, how often they are run, and the state of any
threat modeling can be valuable information for informational reports or
e-mails.
Bibliography
Alberts, C., Dorofee, A., Stevens, J., and Woody, C. Introduction to the OCTAVE®
Approach. August 2003. Available from http://www.cert.org/octave/pubs.
html.
Bernz. The Complete Social Engineering FAQ. August 17, 1999. Available from
http://packetstormsecurity.org/docs/social-engineering/.
Granger, S. Social Engineering Fundamentals: Hacker Tactics. 2001. Available from
http://www.securityfocus.com/infocus/1527.
Howard, M. and Lipner, S. The Trustworthy Computing Security Development
Lifecycle. March 2005, Microsoft Corporation. Available from http://msdn.
microsoft.com/library/default.asp?url=/library/en-us/dnsecure/html/sdl.
asp.
McGraw, G. XP and Software Security?! You gotta be kidding. 2003. Cigital.
Available from http://www.cigital.com/presentations/xpuniverse.
Nyman, J. Positive and Negative Testing. 2002. GlobalTester, TechQA. Available
from http://www.sqatester.com/methodology/PositiveandNegativeTesting.
htm.
Patch Management in Healthcare. March 29, 2005. Symantec Corporation. Available
from http://enterprisesecurity.symantec.com/industry/healthcare/article.cfm?
articleid=5502.
Chapter 6
73
Threat modeling starts with documenting any way the system being
modeled has of being accessed (called “entry points”). Then, any func-
tionality that can be accessed through those entry points is examined to
determine which assets can be affected. Any way that an attacker can
possibly affect an asset is termed a threat. If a threat is investigated and
proven to be possible to realize, the threat then becomes a vulnerability.
The end goal of threat modeling is to produce a document (a threat
model) that details the potential attackers, the possible targets, and any
vulnerabilities that can be exploited. From this threat model, testing can
be done and mitigations designed, but merely completing a threat model
once is not enough. The model must be reviewed regularly and any new
types of vulnerabilities and system changes accounted for.
I tend to use a spreadsheet program for threat modeling, but I’ve also
seen databases used as well.
Attack Path
An attack path is the sequence of steps (often tracked in a threat tree)
that must be traversed to achieve a threat. If this attack path has no
mitigations, it is considered a vulnerability.
Condition
A condition is an action or weakness that must be present in the attack
path for a threat to be a vulnerability (an unmitigated threat).
Entry Points
Entry points are places where the control or data crosses the boundary
of the system being modeled. In an office, the obvious candidates would
be the doors, windows, and elevators, but the not so obvious entry points
are the drop ceiling panels, the telephone cables, the electric cables, the
water supply, the airconditioning ducts, and the network cables.
All points of transition of either control or data into or out of the
application must be considered. This includes any interaction with other
applications, network data, network services, network time services, APIs,
and administrative controls. Note also that:
Infrastructure entry points can include data that is read from the
file system or configuration stores such as the registry.
Layered entry points are items such as Web pages where each Web
page is not only a separate entry point but also every function carried
out by every one of those Web pages is a separate entry point.
External Dependency
An external dependency is a dependency on another system that will
affect the security of the system under test if it is not abided by.
Exit Points
Exit points share some aspects with the entry points but include items
such as the garbage chute behind the building, the trash cans outside the
office doors, the break room sink drain, the toilet and bathroom sink
drains, etc. These are places where data or information leaves the system.
They can also include log files.
Risk
Risk is the measurement or assessment of the real or potential danger of
the threats, conditions, or vulnerabilities in the system.
System
A system is the set of functionalities is being modeled, which is charac-
terized by having interactions outside its own control and having assets
to protect.
Threat
A threat is what an attacker may attempt to do to a system. All threats
against a system are compiled into a threat profile.
Threat Model
A threat model is the output document of threat modeling that details the
system’s threat profile, any background information, and an analysis of
the system’s mitigations and vulnerabilities in relation to that threat profile.
Threat Profile
A threat profile is a list of all threats for the system being profiled.
Trust Levels
Also called access categories, trust levels are the set of rights given to any
entity based on what is known (or thought to be known) about that entity.
Sometimes these correspond to user groups.
Use Scenario
How the system is intended (or not intended) to be used.
Vulnerability
A vulnerability is a threat that is unmitigated and therefore is a valid way
for an attacker to be able to realize a threat.
Once the entry points are all listed, they are cross-referenced with the
trust levels that are supposed to be required to access them.
If you have entry points where the functionality used and even trust
levels needed depend on the information included in a specific request,
these are termed “layered entry points.” They are most often Web pages,
and they must be listed as if each was a separate entry point. APIs are
also really layered threats, but they work well when modeled with a class
or method layering scheme.
Even though the preceding is technically a list of entry points, exit
points should be listed as well. Exit points are the places where data or
control is moved from the system to external entities. Vulnerabilities in
exit points are often those that result in information disclosure, and even
if the information disclosed isn’t overly damaging in itself, it can lead to
other attacks or threats to other systems.
Entry points are usually mapped out by the designers and architects
but, especially in the case of legacy code, you should track any interactions
or entry and exit points you find in the course of testing and verify that
all these entry and exit points are tracked in the threat model. If they are
not, they need to be added to the model.
A sample and very simple entry point list (but which does include
layered entry points) may look like Table 6.1.
1 Web server All Web pages layered on (1) Remote anonymous user
listening this — the port that the (2) Remote registered user
port Web server listens to (3) Application administrator
(4) Web site administrator
1.1 Login page Page for existing users to (1) Remote anonymous user
log in to the system or (2) Remote registered user
request a redirection to (3) Application administrator
the registration page
1.1.1 UserLogin Compares user (1) Remote anonymous user
function credentials entered on (2) Remote registered user
the Web page to those in (3) Administrator
the database’s Users
table and returns a
session if the credentials
match
1.2 Registration Page for new users to set (1) Remote anonymous user
page up a login (2) Remote registered user
(3) Administrator
1.2.1 UserRegister Creates a new entry in the (1) Remote anonymous user
function database’s Users table
Document Assets
Now a list is made of all the assets that an attacker might be interested
in attacking. This includes assets that an attacker may want to steal as
well as those the attacker may wish to damage or prevent others from
legitimate access to. Remember that without a reason to attack the system,
an attack wouldn’t exist. Some of the assets are tangible assets such as:
Process tokens
Database contents
User data
Processes
Data consistency
Company or software reputation
Resource availability
Some assets are called “transitive” assets — they are accessible when
a component acts as the gateway to the functionality and assets of the
other components. An example of this is an ACL (Access Control Mech-
anism) that checks to see if a user has rights to a resource. The use of
the ACL functionality means that the ACL has now become a transitive
asset.
When I participate in a threat modeling process, I list all the assets I
can come up with, and I don’t take any asset off the list merely because
someone does not feel that the asset would be interesting to an attacker.
Instead, it remains until it’s proven that even if that asset was compromised,
there would be no repercussions or damage.
Once the assets are listed, they are cross-referenced with the trust
levels that are supposed to be required in order to access them.
For each asset, a determination is made as to what damage an attacker
could cause and what information could be gained if the attacker gains
access or control of the asset. Although this is not technically a part of
this stage of threat modeling, it pays to start thinking of it now. Later it
becomes a part of the prioritization of mitigation and testing.
A sample and very simple asset list may look like the one shown in
Table 6.2.
Notice that some of these assets are privacy concerns as well. In some
systems, there may be regulations or restrictions made on the protection
of PII (Personally Identifiable Information) or on any other data your
system may collect and store. Stored data of this type must always be
listed as an asset and specifically addressed — including the storage of
backups or logs that may also contain this data.
There will be some security risks that arise during the pr ocess of
documenting use scenarios that simply cannot be addressed effectively
by the system being modeled because they are outside its control. These
should be noted as well.
The purpose of this documentation process is to create a limit to the
scope of the threat analysis by indicating what situations will and will not
be considered as part of the threat model.
Samples of some use scenarios are shown in Table 6.4.
1 The Web service only enforces that password length be greater than
eight characters, but the users must choose passwords that are hard
to guess or discover via brute force
2 If a user tries to log in unsuccessfully three times, the user will be
blocked from logging in again for 1 hour. After 1 hour, the user may
attempt to login again.
Response
Data
Data Files
Request
User
Data
Response
Service
Auth
Request
Request
Auth
Response
Auth
Service
work back toward the root asset and threat. Not all systems are alike.
Starting from known vulnerabilities will limit the threat profile to known
threats and will neglect threats that are very unique to the particular system
being modeled. Although this approach will help jumpstart your threat
model, it shouldn’t be the only approach used.
Instead, you can start with the system’s assets. First, you identify these
and for each asset, the possible attack goals. Then for each goal, you
figure out how it might be possible for the attacker to fulfill all or part
of these attack goals against the assets. This approach is a little more
versatile than the approach that starts with known vulnerabilities but still
has the possibility of becoming a rote task. If this happens, it can suffer
from loss of creative thinking.
Just listing threats will only provide a laundry list of those that may
or may not exist. The threats have to be investigated to verify their validity,
and steps should be taken to mitigate them.
Classify Threats
Threats are now categorized. This means that threats are grouped together
according to one or more common criteria to make it easier to understand
the threat as well as to determine priority.
One way to do this is through the STRIDE method, introduced in
Writing Secure Code, Second Edition (Microsoft Press, 2003) by Michael
Howard and David LeBlanc. The basics of STRIDE are explained at a high
level later in this chapter.
Prioritize Vulnerabilities
Now this list of vulnerabilities is prioritized to determine the order in
which they must be addressed for attention and mitigation. There are
several ways of doing this, but I tend to use a slightly modified version
of the DREAD method, which is described in greater detail later. The end
result of this prioritization is a list that’s grouped into vulnerabilities of
similar urgency and ready for mitigation.
Mitigate Vulnerabilities
Now these identified and grouped vulnerabilities must be mitigated or
resolved in some way. Sometimes the core asset can be removed because
it’s a legacy item or not really necessary. Other times the vulnerability
needs to be treated as any other bug, albeit usually with a fairly high
priority, and a mitigation designed and implemented in order to resolve it.
Temporary Files
Quite a few systems create one or more temporary files that are supposed
to be deleted after their use is fulfilled. But personal experience has taught
me that even without an intruder, these files aren’t always deleted on
schedule, and this fact is first discovered by the monitoring (if there is
monitoring in place that can detect this) or when the disk fills up and
processes start to fail.
Depending on what is contained in the temporary files, they can be
as much of a target as any other source of data. This includes not only
the ones that escaped deletion but ones in transition. If the file can be
found and accessed, it can be copied or manipulated.
All trust is misplaced. Just because it’s a temporary file, never trust it
to be truly temporary and discount the times when it may be accessible.
Database Backups
This includes both online copies and those transferred onto other storage
media for some reason. Data copies are often stored without the same
attention to security and detail as that given to the “live” data. Offsite
backup services keep copies, operations or IT teams keep copies, and
there are often copies that are kept synched for live failover or hot swaps.
These are all normal and expected to exist, but they need to also be listed
as assets, and threats to them considered.
All trust is misplaced. Never trust that backup copies of valuable data
are treated with the concern and security they deserve.
Log Files
A lot of data is logged for good reasons but it’s not often listed as an asset
on threat models, which can be a serious mistake. Sometimes this is
transactional information within a database, but often information is logged
to the system or application event logs on various machines. Even someone
who hasn’t been able to access the database itself may well manage to
access log files and troll through them for any useful information.
The first question that should always be asked is why the data is being
logged and if that level of logging is actually needed.
If the logging is needed, then all the log files (and any copies of them)
must be added as assets and addressed in the threat model.
All trust is misplaced. Never trust that the only place valuable data
exists is in the actual database tables.
At the very least, this data should be sanitized, and it’s not that difficult
to generate completely bogus test data and avoid the problem all together.
If the real data must be used, every instance of it must be listed as an
asset and addressed in the threat model.
All trust is misplaced. Never trust sensitive data to be treated with
appropriate care and security when used for testing or development
purposes.
Failover Data
If a system is mission critical, there is often a requirement for full or partial
redundancy of data, and this is sometimes addressed by utilizing one of
two solutions: (1) an entire backup data center with constantly updated
copies of all data so that if the primary data center goes down for any
reason, the secondary data center can pick up the work without significant
downtime to the customers, or (2) sometimes a separate data center is
not needed but instead a separate database server is kept updated.
These failover systems also need to be listed as assets and addressed
in the threat model.
All trust is misplaced. Never trust failover data to be safe merely because
it isn’t in active use or is not on the same servers.
Threat Trees
Threat trees are a way to systematically examine each threat and determine
whether it’s a vulnerability or has been mitigated to a threat.
A threat tree begins with a root node or root threat. This root node
then has one or more child conditions that must be true for an attacker
to exploit the threat. Any of these child conditions can have one or more
children of their own. An AND relationship is created by having two or
more conditions at the same level and sharing the same parent node.
Otherwise, an implicit OR condition exists.
Once the tree is created, each leaf node (a child node with no child nodes
of its own) in each tree must be followed back to the root node. If a path
can be found where there is no mitigating node or a path exists that involves
a broken AND statement — that threat has now become a vulnerability.
In threat trees, the conditions in the trees can have mitigations asso-
ciated with them. This is because the conditions represent specific actions
or situations that must occur, while the threat is less concrete. The
conditions also have a risk associated with them (usually rated via the
DREAD system or a similar system).
Threat trees can be represented graphically as in Figure 6.2. Threat
trees can also be represented textually as in Figure 6.3.
Neither of these two options is distinctly better than the other, so use
any method that allows easy representation of the information, along with
being the most usable when integrating with other processes in use.
Threat 1:
Access
Employee Paper
Files
1.1 1.2
Directly Access Obtain Copies
Original Files Of Files
1.1.2
1.1.1
Access Files
Access Files on
Off Company
Company Site
Site
1.1.1.1 1.1.1.2
Get Physical Recruit Help
Access to on-site From
Records storage Insider
Attack Path
An attack path is the route from a leaf condition (child node that has no
children of its own) back to the root threat and including any AND conditions.
These attack paths are mapped out on threat trees, and any attack path
without at least one mitigating node is an exploitable vulnerability.
DREAD
DREAD™ (Microsoft Corporation, Redmond, Washington) is a method of
evaluating security risks developed at Microsoft Corporation and docu-
mented in Writing Secure Code, Second Edition (Microsoft Press, 2003),
by Michael Howard and David LeBlanc.
One thing that may be a little confusing about DREAD is that it is
often called a “threat modeling” system, but I generally use it as a
vulnerability evaluation system. Mitigated thr eats are generally not
included. This is why I use “vulnerability” instead of “thr eat” in the
descriptions of the process.
To compare the relative severity of vulnerabilities, a numerical score
or rank is assigned to each one. This rank is the average of the scores
in each of the categories that comprise the DREAD system. The typical
implementation uses a scale of 1 to 10 for the score, with 1 being the
lowest (least severe) and 10 the highest rank (most severe).
The problem I’ve discovered with using this 1 to 10 scale is that it’s
just too broad. A lot of time can be wasted while debating whether a
particular score is a 7 or an 8. Some DREAD users cut the scale down to
1 to 3, but I prefer 1 to 5. That allows sufficient granularity while still
remaining usable.
I also never use the Discoverability category because my own expe-
rience is that it’s almost counterproductive. All vulnerabilities will be
eventually found by external attackers or those people who will disclose
the vulnerability publicly. Attempts to guess how hard or easy something
is to find or to downgrade the overall rating of the vulnerability because
“it’s secret” is completely false security. There are quite a few vulnerabilities
that were known to the software teams for months or years but remained
unpatched because it was felt that they didn’t need urgent attention, mostly
because they would be so hard to find. But they were found and exploited,
anyway.
All trust is misplaced: Never trust secrecy or obscurity to provide
security.
Once the vulnerability has been given a score for each of the DREAD
categories, the individual scores are totaled and then averaged to generate
the vulnerability’s overall rating. Then, the list is sorted by the overall
rating (highest to lowest), resulting in a prioritized list of vulnerabilities
that must be addressed and tested.
The DREAD categories are now examined:
Damage Potential
This is the amount of damage possible if the vulnerability is exploited.
Note that this is not merely physical damage but can include intangible
damage like reputation, customer confidence, etc. It can also include
information disclosures like credit card information. It can even include
items like violation of legal or regulatory mandates.
Reproducibility
This is a measure of how easy or difficult it would be to reproduce the
successful exploit of the vulnerability. If the vulnerability could be suc-
cessfully exploited on every attempt, that would rate a higher score than
an exploit attempt that was only successful one time per year or one time
per 10,000 attempts.
Exploitability
This is a measure of how easy or difficult it is to exploit a vulnerability.
It includes factors like the preconditions required for the exploit, how
many steps or separate actions are required, and how difficult it may be
to find a system that meets all the preconditions. For example, if a system
has to be running an application that has only sold several thousand
copies, the rating would be lower than if the exploit didn’t require that
limited market package.
Affected Users
This measures how many users (or what percentage of total users) would
be affected by an exploit of this vulnerability. This includes not just items
like denial of service or server crashes but also the cases of information
disclosure. Obviously, the greater the percentage of users affected, the
higher the score; a total DoS or database access may be a 10, but something
that only affects a few users may be a 1 or a 2.
Discoverability
This is a measure of how likely it is that a vulnerability will be found if it
remains unpatched. As I mentioned earlier, I never actually use this category.
STRIDE
STRIDE is a system for categorizing the discovered vulnerabilities that
have been identified so, in reality, it’s actually more of a vulnerability
classification system than a threat modeling system.
Classifying a vulnerability by its category or categories makes it easier
to quickly understand what an attacker can do. It can also help in the
assignment of priorities to vulnerabilities. The categories of vulnerabilities
that are considered to have the highest level of risk are different, based
on the program being tested. Elevation of Privilege is typically considered
the most serious, but it’s not mandated. If a particular business or industry
has regulatory laws, this can have an impact on which categories are
intrinsically more serious than others.
Because vulnerabilities can often be classified as belonging to multiple
categories, it’s very important to be certain that each vulnerability is
classified according to its root cause. If a vulnerability enables tampering
with data alone, it would be categorized as a Tampering threat. If it
enabled tampering with data because of an elevation of privilege, it would
instead be considered an Elevation of Privilege threat.
STRIDE is an acronym that stands for the services it renders, which
are as follows:
Spoofing Identity
An attacker appears to be a user, component, or system that is afforded
some level of trust by the system being modeled.
Repudiation
An intruder is able to deny performing some malicious activity because
the system can’t prove otherwise.
Information Disclosure
Attackers or users can see information they should not normally be able
to have access to.
Denial of Service
An attacker causes legitimate users to be unable to use the nor mal
functionality of a service, system, or resources.
Elevation of Privilege
An attacker uses illegitimate means to assume trust level with different
(typically greater) privileges than the attacker should have.
MERIT
MERIT™ (Carnegie-Mellon University, Pittsburgh, Pennsylvania) (Manage-
ment and Education of the Risk of Insider Threat) is a modeling system
specifically focused on system sabotage by insiders. This is a pilot study
or a proof of concept for a method developed by the Carnegie Mellon
University’s Software Engineering Institute and is in response to an analysis
of insider crimes (the Insider Threat Study) conducted in conjunction with
the U.S. Secret Service. There is a paper available on this new method
on the CERT® Web site, and the link is listed in the Bibliography for this
chapter. It definitely makes some interesting reading.
This is of the most use to you when determining mitigations and risk
because insiders are a concern during this process as well as external
attackers. This can also be useful when attempting to examine and develop
attacker profiles or personas, or when developing test cases that include
insider attack situations.
The MERIT information is really geared toward managers and employee
policy makers as well as managers of employees, but it has some good
points to make about the access granted and not recorded or tracked. It
also really made me think about just what risks are posed by insiders
because it’s very easy to give fellow employees blanket trust.
The Insider Threat Study (also available from the CERT® Web site)
examines 49 cases of insider sabotage that took place between 1996 and
2002 and met a rather stringent set of criteria. After verifying that these
cases met the criteria, they were then analyzed for similarity and patterns
with some interesting results.
The MERIT document has some excellent information and an interest-
ing example situation for study.
Analysis
Following are some of the aspects at play when it comes to Insider Attacks:
Paths that are discovered by the insider. These are existing paths
that have either been revealed to or discovered by the employee.
Although these can be used maliciously, they aren’t necessarily
created for the purpose of being malicious.
planted while the employee has access, and set to take effect after some
trigger is tripped — such as on a preset logic bomb, etc.
Behavioral precursors come before technical precursors, and the study
indicates that when the level of the technical precursors rises above the
level of the behavioral precursors, the attack is imminent. This seems to
be because the employee’s emotions and effort are channeled into laying
the technical groundwork for the attack. Technical precursors will drop
off after an attack because the employee’s disgruntlement is eased by the
attack having been carried out.
Defense Aspects
The two best defenses for these insider attacks aren’t a surprise at all:
If the employees have known access paths that are not needed to
perform their job functions, these should be disabled as soon as
possible.
If the threat posed by the employee is sufficiently high, the orga-
nization may choose to disable even the known paths needed by
the employees to perform their job functions.
If the risk then reaches the point that the organization chooses to
terminate the employee, all known access paths must be immedi-
ately disabled, but the organization must be aware that unknown
access paths may still be available. Thus, knowing as many paths
as possible will greatly reduce the risks.
and look for ways in which the infrastructure protecting the assets is
vulnerable.
Bibliography
Cappelli, D.M., Keeney, M., J.D., Ph.D., Kowalski, E., Moore, A., Shimeall, T., and
Rogers, S. Insider Threat Study: Computer System Sabotage in Critical Infra-
structure Sectors. U.S. Secret Service and CERT® Coordination Center, May
2005. Available from http://www.cert.org/archive/pdf/insidercross051105.
pdf.
Cappelli, D.M., Desai, A.G., Moore, A.P., Shimeall, T.J., Weaver, E.A., and Willke,
B.J. Management and Education of the Risk or Insider Threat (MERIT):
System Dynamics Modeling of Computer System Sabotage. CERT Program,
Software Engineering Institute and CyLab at Carnegie Mellon University.
Available from http://www.cert.org/archive/pdf/merit.pdf.
Howard, M. and LeBlanc, D. Writing Secure Code, 2nd ed. Microsoft Press,
Redmond, Washington, 2003.
Octave. Carnegie Mellon Softwar e Engineering Institute. Available from
http://www.cert.org/octave/.
Snider, W. and Swiderski, F. Threat Modeling. Microsoft Press, Redmond, Wash-
ington, 2004.
Chapter 7
Creating Personas
Personas are expressed as one or more fictional people whose aspects
are based on your knowledge of your real customers. However, this does
not mean that these personas are created out of thin air. Instead, the
process of gathering requirements and features for the system being
developed should include the development of user personas. Sometimes
other methods are also used to obtain extra data or insight to insure the
accuracy of personas. These can include focus groups, customer visits,
user surveys or interviews, product support reports, etc.
107
Name Troy
Age 24
Marital Status Single
Parental Status No Children
Income Status $27,000
Employment Retail Full Time
Story Troy is an up and coming young professional with a BA in
Business Administration who has just been named assistant
manager of the electronics store he has been working at for the last
3 years.
Troy is very technology savvy and his primary hobby is MMORG
games.
As he has spent more time at work, he has had less time to spend
shopping and running errands and is now starting to explore online
shopping and services. His new raise has offered a disposable
income that will make these well within reach.
Using Personas
Once personas are created, they can be used as stand-ins for the real
users everywhere, from design to development to testing. They constitute
an excellent way of getting all the team members into the mindset of
their customers. They can also spark useful conversations about what the
motivations and needs of each persona may be.
Sometimes, especially if there are quite a few of them, the set of
personas is divided into primary and secondary personas. A primary
persona is someone whose needs must be satisfied, and the secondary
persona is someone whose needs should be satisfied.
Personas are often combined with use cases to create very specific
scenarios. The persona is referred to by name, and the various aspects
of that persona influence how the scenario will play out. These personas
can also be used to develop alternate scenarios that may not have been
as obvious without the personas to base them on.
Personas can be used throughout the software development process
and by all disciplines. In my experience, the use of personas results in
quite a few animated conversations around just what “Michael” would
think of a particular menu arrangement, or what “Sue” would do if she
forgot her password.
These functional personas are often used in testing to help develop
functional test cases and to provide the necessary point of view to perform
ad hoc testing. They can also provide a way to communicate bugs and
concerns to the rest of the team in a way they can easily relate to.
Pitfalls of Personas
The use of personas, although very useful, does have some drawbacks,
which you should be aware of because some of them specifically impact
security testing.
Persona Flaws
Another issue occurs when a set of customers isn’t adequately or correctly
represented. There are a number of possible reasons for this:
Security Personas
The biggest problem with security testing and personas can be solved, at
least in part, by creating specific security personas. These will allow you
to take advantage of the benefits of persona testing while performing
security testing.
The creation of security personas is similar to that of functional per-
sonas, but instead of them being based on the customers, you can start
with the information already collected for threat modeling and risk assess-
ment and begin to build an aspect matrix for the attackers, as shown in
Table 7.3.
Now you can take this matrix and translate it into attacker descriptions
that apply to a potential persona. A very basic sample is shown in
Table 7.4.
Motivation Hacktivism
Cyber-extortion
Defamation
Cyber-tagging
Headlines/press
Data theft
Data destruction
Data modification
System resource theft
Network resource theft
Identity Security researcher
Script kiddie
Independent hacker
Organized crime
Attacker for hire
Disgruntled current or former employee
Competitors
Bibliography
Cooper, A. The Inmates Are Running the Asylum: Why High Tech Products Drive
Us Crazy and How To Restore the Sanity. Sams Publishing, Indianapolis,
Indiana. 2002.
Chapter 8
After all the techniques and background information, this is the chapter
that really focuses on the reason why this book was written — teaching
you how to develop a plan with which to conduct security testing on
your system.
Like all methodologies or processes, there will certainly be aspects of
what I present here that you will always use, there will be aspects you
will only use for the first time or two you conduct a security test pass,
and there may be aspects or steps that never apply to you. I would advise
you to read the entire process before you decide to discard or change
an aspect or step. After that, make the process your own and really
integrate what you can use into your ongoing test arsenal.
This process should be started as soon as possible during the system’s
life cycle, but there are some interrelations with other parts of security
testing, threat modeling in particular. So this seems like it would be a
linear process but it really isn’t, and you will often temporarily put aside
your actual security test plan in order to produce or participate in another
security-related task. Flexibility will be required, especially until this pro-
cess is more familiar to you.
115
start from scratch, whereas in future releases you will be able to review
the plans and results from prior releases to give you a jump start.
I use a test case system called a TCO (test case outline) to document
and organize my test cases as they are being generated. I use the
information in my security TCO to also drive the actual test plan. The
details of the number of test cases and scope of testing will give me
something to base my time estimates on.
This test case outlining system is documented in Chapter 28 of this
book. I would encourage all new testers to try the TCO system, but you
may also use a different system to track and document your test cases if
necessary.
There is generally one security test plan per release, but there may be
one or more functional test plans, mostly depending on the size of the
system and its complexity. If test plans need to be split up, you have to
be sure that the plans overlap instead of having a gap between them
where testing is lax or missing.
Priority
Explicit test case steps including validation
Because this document can grow to an unwieldy size, there are often
multiple TCOs for each release, and each one of them deals with a different
security risk or area of the product.
Incoming Information
This corresponds with the entry points on the threat model. Each piece
of incoming information must be listed separately as it must be tested,
usually in multiple ways, as part of the security testing.
Initialization files
Registry data
User login data
User-supplied data (per API or per stored procedure)
Files
Database queries
Database query results
Outgoing Information
This corresponds with the exit points of the threat modeling process. This
list is for any place where data or control leaves the control of the system.
This list also includes items that move from one part of the system to
another and those items that deliberately overlap incoming information
and will serve to help you overcome the tendency to trust that data.
This list would include items such as:
Files
Database queries
Database query results
Registry data
User registration data
Dependencies
This is a list of the dependencies your system has on both its own
subsystems and on external systems. The purpose of this section is to
explore those dependencies and the assumptions made about them while
conducting security tests.
A dependency is something that your system depends upon in order
to work. Without that dependency, your system would fail to function.
Interactions/Interoperability
This is a list of all the systems that the system you are testing interacts
with. The reason you are listing these is so that you can look at these
interactions, challenge the assumptions made about them, and then exam-
ine their vulnerabilities to see if your mitigations will compensate if those
vulnerabilities are exploited.
Remember to not just look at the most current version of these items.
It’s not at all unusual to have software of varying ages installed on the
same system, trusting the user to have the most curr ent version of
everything, including patches, is definitely misplaced trust.
This list can include items like:
Gather Information
The next step is probably what you would expect: that of gathering the
information you will need in order to proceed. Although this process
appears daunting and tedious, once you start into it, it really isn’t too bad.
As you gather this information, the easiest way to keep track of it is
to note it in the appropriate section of the TCO. These are temporary
notes but will serve to keep information organized and available for the
next phase, where you are going to use it as part of the process of creating
test cases.
If the information affects multiple sections of your TCO, it should be
noted in each area it affects.
Your test plan, on the other hand, should document where you looked
for this information.
bug tracking lists. (There are Web sites listed in Chapter 29 under section
Recommended Web Sites and Mailing Lists.) These are security bugs that
have been made publicly known, and despite the logic that says that
anything publicly known should have a corresponding bug in the internal
bug tracking system, experience has told me that is not always the case.
After looking through these bug databases, I recommend using your
favorite search engine or two and trying a few searches for Web sites and
Usenet groups that mention your system and any of a few keywords that
are commonly used with security issues like the following:
This is just to give you a feel for what the customers of your system
are complaining about that may have to do with security.
Competitive Systems
Once you have exhausted the issues that relate directly to your own
system, you should repeat the searches on the security bug databases and
the search engines, but, instead of being targeted at your own system,
you should see what relates to your top competitors. Similar competitive
products are often based on similar technology, and it’s possible for a
security bug that has been found in one product to have the potential to
appear in another. Web browsers are a good example of this.
This search can also give you some ideas on what has been done or
is possible to be done with these security vulnerabilities, and you can
integrate those ideas into your own threat modeling or plans.
If these systems are produced by your own company, you may have
access to that system’s bug records and can start looking for security issues
there. If not, you can only repeat the security bug database and search
engine process again.
This review is partly to see what has been tested before and also what
hasn’t been tested. If only functional testing has been done before, you
can probably see pretty easily where there are possibilities of security
vulnerabilities.
If security testing has been done before, there will be more data to
go on that will tell you what has been tested, what cases were run, and
even what vulnerabilities were discovered.
If you are not also doing the functional testing for your system, you
will want to collaborate with the tester who is and keep up-to-date copies
of the current test plan and test cases to refer to.
Known Vulnerabilities
Your System
The notes you made in the last step will now become items you want to
have a test case or test cases specifically address. Reviewing these known
vulnerabilities will also spark some ideas on other items to test.
The goal of these test cases is to verify that the known vulnerability
is no longer reproducible and has been removed or mitigated.
Unknown Vulnerabilities
Once you have developed a test case for each known vulnerability, you
need to branch out and create test cases to search for vulnerabilities that
are currently unknown.
These tests constitute the majority of the tests run in any security test
passes. Unlike the known vulnerability cases, where you know exactly
what you are looking for, these cases are designed to look for something
that may or may not exist. I’ve found that the easiest way to do this is
to go through each of my initial lists in turn and try to think of what
vulnerabilities may be possible in each item in that list.
There are some potential vulnerabilities, which are pretty much of
universal concern for any system. These include items like buffer overruns,
plaintext storage of sensitive data, etc.
Then, there are potential vulnerabilities that are more dependent how
your particular system functions. If your system has a dependency on a
database, potential vulnerabilities may include structured query language
(SQL) injection. But if your system has no Web site interface, there may
not be a need (or a way) to test for XSS (cross-site-scripting) vulnerabilities.
In order to give a jump start to your test cases, Chapter 9 includes
some ideas of what should be examined according to the type of system
Prioritize Tests
Now that you have written your test cases, you need to be able to prioritize
them so that you have a clear idea of what cases are considered to be
the most important.
You need to know this now to be able to communicate this information
both in your test plan and on the schedule for the system. If you are told
that you have a set amount of time to run security tests, you will be able
to then look at your highest priority test cases and determine how many
of them you can run in that amount of time.
You will also want to be able to report the time needed by test case
priority, i.e., priority 1 test cases will take four weeks to run, priority 2
cases will take another three weeks to run, etc.
This is also the way you can keep your testing on track and ensure
that you are running those cases first that most need to be run, instead
of just those that are easiest to run.
Test case prioritization is one of the harder test skills to teach, because
so many of the factors that contribute to it are not easily quantified. You
really have to do the best job you can, and, after each release of your
system, continue to revisit and adjust the criteria you use for your test
case prioritization.
At the end of this stage, your TCO or test case documentation will
have a priority listed for each test case. I used a scale of 1 to 3 where
the ratings have the following meanings:
The test plan should include the fact that the test cases are prioritized
to allow better scheduling.
If you have to narrow down the pool of test cases, you can pick a subset
of the test cases for each vulnerability that you think is most likely to reveal
the vulnerability’s presence. Those will stay as the original priority and the
rest of the equivalent cases would be downgraded to a lower priority.
Sometimes you will find that you have written test cases for vulnera-
bilities that were not considered in the threat model. These should be
added to the threat model and prioritized.
Each tool you use should be examined for these downsides and a way
to compensate determined if those downsides would compromise the test
results and make them unreliable.
These downsides and risks should be documented in the test plan, as
well.
Draft a Schedule
The next step is to develop a draft test schedule for the security testing
of your system. Scheduling is probably one of the least scientific and most
disliked aspect of test planning, so don’t feel like you are missing some-
thing obvious if it’s not easy for you to do.
The goal at this point is to look at the schedule that has been
determined for your system and any hard dates that must be met. You
will have to work within those dates as much as you can.
There is always a trade-off to be made between a schedule and what
can be tested, but this is where the test case prioritization can really pay
off by allowing you to give three different time frames, depending on
which priority of cases you plan to run.
One rule of thumb you always want to follow is building in your
padding before you release a schedule. As soon as the dates are out there,
no matter how much you explain, if they are raw dates and have no
padding; they will become set in stone, and when the inevitable problems
occur, you will immediately be behind schedule.
I typically build in a 50 percent to 75 percent padding on top of the
actual time needed to perform tasks. If my meeting schedule is unusually
heavy, I’ll adjust the padding percentage to compensate. The amount of
actual padding you need will be something that you discover over time,
but I would always recommend building in at least 50 percent.
This is before any additional time is built in for things like tools, etc.,
and is used for investigation, issues, etc., that are inevitable.
Note any failures and their root causes, then look for any similar
cases that could fail with a similar root cause, and if those have
not been included in the test pass already, I mark them to be run
Correct any false information that appears in my test documents
Note any additional cases that I can think of as I am in the process
of testing
Mark any cases that took a huge amount of time
Track how long I estimated for the test pass and how long it
actually took so that I can continue to perfect my estimates
Note when I was blocked from being able to make progress by
something outside my control and for how long
All of these are to make easier the postmortem and any future planning
for this system’s security testing.
You should always postmortem the results for your own improvement,
but I recommend you also write up an e-mail or a report that can then
be distributed to your team, so that more people can benefit from the
insight and lessons learned.
Chapter 9
Sample Security
Considerations
Universal
There are some considerations that are pretty much universal, in that most
systems need to ensure they are addressed. It’s not a guarantee that your
system will need to have these tested, but it’s likely.
Default Installation
These are considerations that are based on the default installation of the
system and the trusts and assumptions that are made during the installation.
133
Authentication
These are considerations that have to do with how a user is authenticated
by the system and when.
Input
These are considerations that have to do with the input your system
consumes. Remember that all input is evil!
Security Validations
These are considerations that have to do with the way security is enforced
and validation is done by the system.
Cryptographic Considerations
These are considerations that have to do with the use of encryption
technology in your system.
Home-Grown Cryptography
If your system uses home-grown cryptography instead of one of the
proven and tested algorithms, the strength of the encryption isn’t really
known; therefore, any encrypted data is at increased risk.
Operational Environment
These are the considerations that have to do with the operating system
or machines that the system runs on.
Registry Entries
If your system stores data in the registry and accepts it as trusted, that
data is subject to tampering by the user outside the system that uses the
registry.
System Pathing
If your system relies on information in the system path, it is vulnerable
to path modifications when looking for resources such as DLLs, etc.
Information Disclosure
This set of considerations has to do with the system giving the user too
much information that the user doesn’t really need.
Extraneous Code
These considerations have to do with code that exists in the system and
which isn’t necessary for the system’s correct functioning.
Stand-Alone Applications
These are the considerations that are common in stand-alone applications.
Application Process
These considerations apply to the system’s processes while running.
Output
These considerations apply to the way in which the system’s output is
handled.
Backward Compatibility
These considerations have to do with your system’s ability to be backward
compatible.
Operational Environment
These considerations are centered around the environment in which your
system operates.
APIs
These considerations are centered around systems that implement an
application programming interface (API) as a whole or part of their
functionality.
Application Process
These are considerations that relate to the application’s process.
Input
These considerations have to do with how the system accepts input.
Language
These considerations have to do with the programming language that
your system uses.
Operational Environment
These considerations have to do with the environment in which your
system operates.
Session Persistence
If your system persists its sessions, an attacker may be able to locate and
steal such session information and use it to implement an attack.
Specialized Considerations
These are considerations that are specific to APIs.
Application Process
These considerations have to do with the process under which the system
is running.
Input
These considerations are related to the system’s acceptance of input.
Data Transfer
These considerations have to do with the system’s data transfer function-
ality. Traffic is considered trustworthy if specifically directed to or from
ports, sockets, and Point-to-Point Tunneling Protocol (PPTP).
Named Pipes
If your system trusts data based on its transmission source, an attacker
only has to use that transmission method to provide malicious code for
consumption by the system.
Client
These considerations are related to the system’s clients.
No Antirepudiation Validation
If the system does not maintain sufficient validation and records, an
attacker may be able to repudiate an attack.
Server
These considerations have to do with the system’s server functionality.
No Antirepudiation Validation
If the system does not maintain sufficient validation and records, an
attacker may be able to repudiate an attack.
Specialized Considerations
These considerations have to do with the specialized functionality of Web
servers/Web services/distributed systems.
Chapter 10
Pseudonyms
Forceful browsing
Description
Most Web browsers have a standard behavior of listening on port 80 for
HTTP traffic and port 443 for HTTPS traffic. A Web server is only supposed
to access files reachable from its own document root directory. But the
common gateway interface (CGI) is intended to allow ordinary programs
(those that are not Web servers) to interact using a Web browser interface.
Ordinary programs are not bound by the same rules as a Web server, and
they can access any part of the file system. CGI interfaces are present at
the core of almost all Web applications.
To add to the problem, most Web servers are only able to run as a
single user: IUSR on IIS and nobody on most Apache systems. The identity
of the remote user has no bearing on this as this is the Web server’s own
user identity. So, all human users are grouped into a single system user
for the purposes of local file permissions. The Web server can restrict
access to a CGI to specific users but cannot limit the files that the CGI
can access.
147
URL Guessing
The simplest form of forceful browsing is for an attacker to just guess the
names of Web pages and enter them in the browser to see if they find a
real page and if they can access it. Because the only security on these
pages is that they are not linked to anywhere on the site that can be seen
by a regular user; if the attacker correctly guesses the address, they succeed
in obtaining access to whatever is on that page.
layer (SSL) can be used to hide the session variable, but hardly any site
uses SSL on all pages, even when the session variable is used. Other
vulnerabilities (like cross-site scripting) can also be used to obtain the
session variables from the cookies or browser history of other users.
Anatomy of an Exploit
URL Guessing
An attacker visits a Web site — for example, http://www.myweb-
site.html/default.html. When the attacker browses the site, the attacker
notices that there is a pattern to the URLs being seen.
The link titled “New Member” leads to the URL http://www.myweb-
site.html/newmember.html.
The link titled “Consultants” leads to the URL http://www.myweb-
site.html/consultants.html.
The attacker notices that there is no URL listed that seems to have
anything to do with site administration and decides to see if he can find
it. He guesses at a couple of URLs until he happens to guess the correct
URL to achieve some level of access: http://www.myweb-
site.html/admin.html.
Now that the attacker has guessed the correct URL, he has access to
the administrative functions of the Web site.
Session Replay
An attacker sits down at a coworker’s desk after the coworker has stepped
away, and the computer is left unlocked. The coworker had just shown
the attacker the new item he bought at a major online retailer.
The attacker opens the coworker’s browser history and opens the link
to the online retailer. When this link is opened, the attacker notices that
the online retailer shows the user as logged on.
The attacker navigates to the account management page and changes
the coworker’s email address and password to his own, then logs out of
the online retailer’s site and closes the browser before returning to his
own desk.
Real-World Examples
Kerio Personal Firewall™ (Kerio Technologies, Inc., Santa Clara, California)
is a firewall for workstations. In 2003, a session replay vulnerability was
reported.
The vulnerability reported involved a flaw in the authentication when
the firewall’s remote administration was being used. The traffic during the
session is encrypted, but if the entire administration session is captured
using a network sniffer and then replayed as a whole, the server recognizes
it as a valid session.
The impact of this vulnerability is that an attacker could record a
session and replay it at will to cause the same administrative commands
to be sent to the firewall. These can be disabling to the firewall, etc.
Test Techniques
URL Guessing
Start testing for brute-force browsing vulnerabilities by mapping your site.
Begin by creating a list of all the URLs that are intended to be safe and
accessible to everyone, including those people who aren’t logged in. This
should be done from the documentation or specifications because you
want to know the intended behavior, not the actual behavior.
Now log on to your site as an administrator and manually walk through
all the pages you can access or find links to, noting the URLs of each
page as you go. This can also be done via a Web spider program, if you
want to use one.
The next step is to log out of the site completely, and clear your
browser cache and cookies. Go back to your site and try all of the URLs
— both from the safe list and the administrator list. Mark each of the
URLs that is reachable.
Now repeat this process while logged in as a normal user. Again, mark
each of the accessible pages. If there is any page that is accessible by
nonadministrators and it is not on the safe list, then you have a URL-
guessing security vulnerability.
Session Replay
To test for session replay vulnerabilities, start by seeing if you can detect
how your system is storing session information.
Log into the system as a regular user, and navigate to a URL that
requires you to be logged into the system to access. Look at the URL that
is displayed in your browser’s address bar. Does it contain any parameters
with names like “session” or any long strings of seemingly random letters
and numbers? If either of these are true, the URL probably contains the
session variable.
Now save the current page to a local file, and log out of your site.
Delete your browser’s cache and clear your cookies, then try opening the
saved file in your browser, and click on one of the links. If you can still
navigate around the site, your system may be vulnerable to a session
replay attack.
Try copying the URL to a file, and close your browser. Clear your
cache and cookies again. Reopen your browser and paste the URL into
the address bar and see if you can access the site without logging in. If
you can, you may have a session replay attack.
To verify your findings, try the same process from a different machine
with the locally saved file and the URL. If you can still access the site
without logging in, you have a confirmed vulnerability.
Chapter 11
Pseudonyms
Buffer overflows
Stack buffer overruns
Heap buffer overruns
Stack smashing
Heap smashing
Description
A buffer overrun is caused when data is stored in a buffer that is too
small to contain the data being stored. This causes the data to “overflow”
or “overrun” into adjacent memory.
If the software being tested is written in C or C++, even only in part,
this is definitely something that should be carefully tested. Errors in, or
failure to, bounds-check data before it is stored or used is an easy mistake
for a developer to make.
This is becoming a less commonly reported flaw in released software
because of the increased education of developers who program in C and
C++ and the increased migration to managed code. But, it requires
continued vigilance on the part of everyone who produces software.
153
free memory, and is usually tracked with the use of a linked list where
each block of memory has headers that point to the next allocated block
of memory in the heap. These are updated as memory in the heap is
allocated or freed. When the heap is corrupted by a heap-based buffer
overrun, the results can be unpredictable, as some of the linked list
structure is typically overwritten in the process of the overrun. A sample
view of the heap is shown in Figure 11.5.
The number of vulnerabilities involving heap buf fer overruns is
expected to grow, as more and more steps are taken to protect the stack,
and attackers turn to heap overruns instead. There is still a belief that not
much can be done with heap buffer overruns because of the inherently
dynamic nature of its storage structure, and this leads to heap buffer
overruns not being subjected to scrutiny as they should be.
Anatomy of an Exploit
Most exploits of buffer overruns start with first knowing that buffer overrun
vulnerability exists. This can be discovered in multiple ways, including
personal experimentation and seeing it posted on one of the many boards
frequented by hackers.
Once the vulnerability is known, the attacker needs to carefully craft
a string to exploit the buffer overrun. Merely overflowing the buffer may
be enough to crash the system or the application using the buffer that is
being overrun. To achieve something else, the right information has to
be inserted in the right place in the buffer.
In some cases, the attacker will be able to find out where in the buffer
the application’s variables are stored, but sometimes the attacker will start
to systematically explore by overflowing the buffer via the exploit with a
pattern of larger and larger data until a recognizable effect is achieved.
Once the attacker finds out how long a string is required to achieve
the desired effect, they have an exploit of the vulnerability. Now, they
can combine this exploit with other codes to create malicious software
to distribute or install.
Real-World Examples
Buffer Overrun
Arguably the most famous example of a buffer overrun happened on
November 3, 1988, now often known as “Black Thursday.” A 99-line
bootstrap program plus a large object file, both in C, infected Sun Micro-
systems’ Sun 3 systems and VAXTM computers running variants of 4 BSD
(Berkeley Software Distribution) Unix®.
One of the exploits used was a buffer overrun of the fingerd program’s
input buffer. Fingerd (a background process or daemon) was using the
C gets call that takes input to a buffer without any bounds check. In this
case, a string of 536 bytes was passed to fingerd, which overflowed its
input buffer and overwrote parts of the stack. This string was specifically
designed so the return stack frame for main was then a pointer into the
buffer on the stack.
There were instructions written into the passed string at that location,
which were then executed when main attempted to return. On VAXen,
this meant the worm was connected to a remote shell via the transmission
control protocol (TCP) connection, and the worm proceeded to infect the
system. On Sun, this resulted in a core file error because the code wasn’t
in place to corrupt a Sun version of fingerd.
receipt, the information was not bounds checked and was copied into an
8-byte fixed length buffer in a heap allocated SSL_SESSION. Because the
structure of the heap-allocated SSL_SESSION is known, the buffer was
carefully overflowed with miscellaneous data until it r eached the
session_id_length field in the SSL_SESSION buffer, and then overwrote
the data in that field with a value of 0×70 (112).
Then the worm terminated the connection with a “client finished”
message in order to have the server respond with its standard “server
finished” message, which contains the session_id data. But, because the
worm overrode the session_id_length with a much larger value, the server
tells the worm the entire 112 bytes of the SSL_SESSION structure, starting
at the session_id.
Now that the worm has this information, it reuses the same attack
vector again but this time it sets up shell code to run when the “client
finished” message is received by the server.
Test Techniques
Testing for buffer overruns means testing every variable to see if it is
bounded or not. The basic stages of buffer overrun testing are the same
for both black-box and white-box testing.
Find and Document All Entry Points into the Product You
Are Testing
Be sure that all entries are examined, not just the UI (user interface) or
application programming interfaces (APIs). It is common for software that
was once written as a standalone program to have been improved to
include a public API, Web methods, or other ways of exposing the
program’s functionality to other uses. Too often, when this is done, there
are places where assumptions are made instead of explicit checks.
As the entry points are documented, make special note of any input
that may later be used to calculate a buffer allocation size.
0
1
For the strings, if the datatype is unknown, start with a string of 16,000
characters. If the input is supposed to conform to a particular format,
each segment of the string should be tried with the test string separately
and then in combination. For example, if you were submitting an e-mail
address, you might try:
<test string>@email.com
<test string>.me@email.com
Me.<test string>@email.com
Me.me@<test string>.com
Me.me@email.<test string>
Black Box
Because there is no visibility into the code in black-box testing, the process
of testing for buffer overruns is a little trickier than it would be during
White Box
In white-box testing, all variables need to be traced back to where they
enter the system, and then followed through the system from there. Any
time the variable is manipulated or has memory allocated for it, the code
must be carefully examined for any problems.
Run the tests under a debugger. This makes it easy to examine items
such as what is on the heap or stack, or what is in the registers. If a
portion of the test string appears on the stack, you may have found a
stack overrun. If a portion appears on the heap, you may have a heap
overrun. If a portion of the test string appears in the process register, you
have a buffer overrun that is most likely exploitable. If a section of the
test string appears in the instruction pointer (called the EIP register), you
have definitely found a buffer overrun, and it is exploitable.
Bibliography
Baker, B. and Pincus, J. Beyond Stack Smashing: Recent Advances in Exploiting
Buffer Overruns. IEEE Security and Privacy, 2004, pp. 20–27. Available
online at http://www.lib.duke.edu/libguide/cite/printed_mag.htm.
Braverman, M. Win32/Blaster: A Case Study From Microsoft’s Perspective. Virus
Bulletin Conference. October 2005. Virus Bulletin Ltd. Available from
http://download.microsoft.com/download/b/3/b/b3ba58e0-2b3b-4aa5-
a7b0-c53c42b270c6/Blaster_Case_Study_White_Paper.pdf.
CERT Advisory CA-2002-27 Apache/mod_ssl Worm, CERT Coordination Center,
2002, Available from http://www.cert.org/advisories/CA-2002-27.html.
CERT Vulnerability Note VU#102795. CERT Coordination Center, 2002, Available
from http://www.kb.cert.org/vuls/id/102795.
Donaldson, M.E. Inside the Buffer Overflow Attack: Mechanism, Method and
Prevention. April 2002. Available from http://www.sans.org/reading_room/
whitepapers/securecode/386.php.
Ferrie, P., Perriot, F., and Szor, P. Virus Analysis 3 Blast Off! Virus Bulletin.
September 2003. Available online at http://pferrie.tripod.com/vb/blaster.
pdf#search=%22win32%20blaster%20analysis%22.
Howard, M. Fix Those Buffer Overruns! May 2002. Available from http://msdn.
microsoft.com/library.
Chapter 12
Pseudonyms
Cookie poisoning
Cross-site cooking
Cookie theft
Description
Background
Cookies are technically small pieces of text that are sent to the Web client
browser by a server and intended to be sent back to the server, unchanged,
each time it accesses the same server or another server in the same
domain. Cookies are used for authentication, tracking, maintaining state
over stateless HTTP, as well as maintaining specific information about the
user such as their site preferences, etc. The minimum size of a cookie is
a name–value pair.
Cookies were originally developed for use in Web applications that
used online or virtual shopping baskets. Cookies allowed for the contents
of the basket to be changed, based on the user’s actions and tracked
items in the basket between browser sessions.
165
Cookies are also used when users log in to a Web site. Users enter
their username and password into a login page and, if they are authen-
ticated, a cookie is saved that allows the Web site to know the users are
already logged in as they navigate around the site. This permits them
access to any functionality that may be available only to logged-in users,
probably the primary use of cookies at this time.
Cookies are also used to save user preferences for a site so that the
site presentation and functionality can be personalized, based on the
preferences of the user.
Cookies can also be used to track user actions across the site or domain.
There are also some third-party cookies that allow for tracking across
multiple sites. Most tracking done within a site or domain is done to
gather usage data for that site. Tracking over multiple sites is done by
advertising companies to build usage profiles to allow for more targeted
marketing.
Cookies are destroyed at the point the user closes the browser unless
a deletion date has been set. If a deletion date has been set, the cookie
will be destroyed on that date instead. The cookies that have deletion
dates are called persistent cookies.
Cookies are supposed to be sent only to the server that set them or
another server in the same Internet domain. However, a Web page in one
domain may contain images or components that are referenced on a page
in the original domain but which are stored on a server in another domain.
When these components are retrieved, cookies can be set for the second
domain. These are called third-party cookies.
There are some privacy and security concerns around the use (and
misuse) of cookies and that has caused some legislation to be enacted in
the United States and the European Union. It is also important to know
that the only real restriction on cookies is a maximum of 300 at a time,
which is respected by most browser manufacturers. The site can create
one cookie or a lot of cookies — the number is truly up to the site in
question and its needs.
Cookie Risks
Cookie Theft
Cookies are supposed to be sent only between the Web browser and the
server or servers in the same domain that set the cookie. But, if the cookie
is being sent over an ordinary HTTP connection, it is visible to anyone
across the network using a packet sniffer. This means cookies really cannot
contain sensitive information. This is sometimes overcome by using HTTPS
to encrypt the connection, but that’s not the solution because it only
solves one of the problems associated with having sensitive data stored
in cookies.
For example, cross-site scripting can be used to send cookies to servers
that should not be receiving that data. Encryption does not help stop this
cookie theft, which is often done with a simple snippet of HTML posted
to a site that users can be tricked into clicking on, and which will send
their cookie for that site to a location that the attacker specifies. Because
the request is coming from the same domain intended for the cookie,
there are no problems. These cookies can then be exploited by connecting
to the same site using the stolen cookies, thus spoofing the original owner
of the cookie.
Cookie Poisoning
Cookies are supposed to be sent back to the server unchanged, but
attackers can modify the value of a cookie before sending them back to
the server. This is typically done to carry out some sort of attack against
the server that relates to some sort of data contained in the cookie. For
example, if a cookie contains the price per item for something in the
shopping basket, a change to this value in the cookie may cause the
server to charge the user a lower price for that item. This process of
modifying a cookie before it is sent back to the server is called cookie
poisoning. Sometimes, cookie poisoning is used after cookie theft.
Most Web sites only store a randomly generated unique session iden-
tifier in the cookie, and everything else is stored on the server. This pretty
much eliminates the threat of cookie poisoning.
Cookie Inaccuracies
Even outside of deliberate cookie tampering, there are aspects to how
cookies are used in some situations that cause cookies to carry inaccurate
data on which to base sensitive transactions.
One issue is that separate people using the same computer, browser,
and user account will unavoidably share cookies. Another is that if a
single user uses multiple browsers, multiple computers, or multiple user
accounts, it means that the user will have multiple sets of cookies.
Cross-Site Cooking
Despite the fact that each site is supposed to have its own set of cookies
and to not be able to alter or set cookies for any other site, there are
some browser flaws that cause cross-site cooking vulnerabilities and allow
malicious sites to break this rule.
This is similar to cookie poisoning, but instead of the attacker attacking
the site itself, the attacker is now attacking nonmalicious users with
vulnerable browsers.
Many browsers have a flaw in how they deal with overly relaxed
cookie domains. They are supposed to require a two-dot specification for
all domains under the following top-level domains:
.COM
.EDU
.NET
.ORG
.GOV
.MIL
.INT
Anatomy of an Exploit
Cookie Theft
The attacker posts an auction that includes a link to what is advertised
to be additional pictures or information about the object in the auction.
Instead, when users click on the link, their cookie for the auction Web
site is sent to the attacker’s server, where a CGI script logs the information.
Now the attacker can look through the list of cookies and pick some
of the most recent cookies to use to try to log in to the auction site and
spoof the user.
Cookie Poisoning
The attacker visits an E-commerce site and adds an expensive item to his
shopping cart. Then, the user examines the cookie stored on his system
from that site to see whether the cookie includes the total cost of the
items in the attacker’s cart.
The attacker then modifies the cookie on his system to change the
total to be $5.00 and resaves the cookie. Then, the user returns to the E-
commerce site and checks his cart to see that the total is now $5.00 and
proceeds to order the items for the false price.
Cross-Site Cooking
The attacker crafts a cookie for the domain “.COM.UK” and sets up a Web
site to distribute the cookie. Then, the attacker posts a link to his Web
site on various bulletin boards or via e-mail, and when the users click on
the link, they are given the attacker’s crafted cookie that can then overwrite
or disrupt the real business they do with Web sites in that international
domain.
Real-World Examples
Cookie Theft
A cookie theft vulnerability was reported in January 2005 in the Froogle™
(Google, Inc., Mountain View, California) comparison shopping service.
Although the details reported are sketchy, it appears that malicious Java-
Script in a URL points to Froogle. Once a user clicks that link, the JavaScript
executes a redirect to a malicious Web site, which then steals the user’s
Google™ (Google, Inc., Mountain View, California) cookie.
This stolen cookie apparently contained the username and password
for the “Google Accounts” centralized log in service, information that is
used by multiple Google services.
Cross-Site Cooking
At the moment, cross-site cooking is a proof of concept that demonstrates
the vulnerability and hasn’t emerged in the wild.
Test Techniques
Black-Box Testing
The first thing you need to do is know just what cookies are being created
by the application and when. But all cookies are not kept as created.
Some are modified by the application as it runs, and you need to know
when and how the cookies are modified.
As a black-box tester, you really need to explore the application, track
what cookies are being set where, and exactly what they contain. Then,
delete or modify the cookie, and see where the system is looking for the
data from the cookies. You need to see where the application modifies
the cookies.
I generally start with a spreadsheet and have the page name on the
left, a column for the date and time obtained, and then the contents of
the cookies on the right, so I can compare them and the track changes.
You should make multiple passes through the product with different user
identities to give you a good amount of data to examine, and always
include as many user states as you can (logged in, not logged in, a variety
of user permission levels, etc.).
Compare to Documentation
Just because you are doing black-box testing does not mean that you
cannot seek out any documentation on what the individual cookies are
supposed to do and contain.
If there is any documentation available, compare that to your spread-
sheet of notes and guesses and see if any issues are immediately obvious.
Disparities can emerge between documentation and reality, and there may
be cases where security measures (secure flag and expiration date) are
not in place where they should be. These tested cookies become the first
to manipulate and explore for vulnerabilities, as described in the next step.
Modify Cookies
Now you need to start experimenting with the cookies to see if you can
find vulnerabilities. If you have documentation to use, you can start with
the ones you marked as most interesting. Otherwise, you can start wher-
ever you think the most risk is.
Start by modifying one field of one cookie at a time. If you have found
a pattern to the cookie, test both inside and outside the pattern.
Naturally, cookies with one or more pieces of data in clear text are
the easiest to modify, but to experiment with other cookies and cookie
fields, too.
Don’t stay within the field size the real cookie is using. It may be
possible to create an overflow, and that should be explored as well.
Don’t stay within the apparent data type of the cookie’s field. The
server should be checking all incoming data and validating type before use.
Write down the results of each attempt and listen to your intuition
when it comes to potential vulnerabilities.
Cookie Misuse
Don’t forget to try other cookie uses that go beyond cookie tampering.
Try testing as if you had stolen someone else’s valid cookie.
White-Box Testing
White-box testing of cookie vulnerabilities uses the same basic theories,
but because you have direct insight into the code that saves and reuses
the cookies, you don’t have carry out the somewhat tedious task of reverse-
engineering the cookie itself.
Chapter 13
Pseudonyms
Code insertion
Malicious scripting
XSS
Description
Cross-site scripting (abbreviated to XSS so as not to be confused with the
abbreviation for cascading style sheets) is a vulnerability rooted in the
way HTML content is generated and interpreted by client browsers. These
vulnerabilities are usually found in Web applications and allow attackers
to inject HTML or client-side scripting into the input of a Web-based
application in the hope (or with the knowledge) that the input the attacker
provided will be returned unparsed. If a dynamic Web page is output
with the malicious code in it, the victim’s browser attempts to render it
as though it were HTML, complete with an attempt to execute the scripting.
This same scripting can post information it discovers to a third-party
Web site as a parameter, which allows the attacker a way to collect it for
subsequent use.
173
Cookie theft
Session ID theft
Defacing a Web site
Limited execution of arbitrary code on the victim’s machine, par-
ticularly, if it’s a trusted Web site or a Web-driven client application,
or even if it is combined with an unsafe ActiveX control
Manipulating the DOM (Document Object Model)
Cookie poisoning
Changing user settings
JavaScript
VBScript
ActiveX
HTML
Flash
Nonpersistent or Reflected
This is the most common type of cross-site scripting vulnerability by far
— a vulnerability where data from a Web client is immediately used by
the server to generate a page to return to the user. If unvalidated user-
supplied data is included in the resulting Web page without HTML encod-
ing, this will allow client-side code to be injected into the dynamic page.
A classic example of this is encountered in search engines; if you
search for a string that includes some HTML special characters, often the
search string will be redisplayed on the results page to indicate what was
searched for, or the search terms will at least appear in a new search text
box for easier editing. If all occurrences of the search term are not HTML-
Persistent or Stored
This is not the most common type of attack, but it is the most powerful.
This vulnerability occurs when data provided to a Web application by an
attacker is first stored persistently on the server, and then later it’s displayed
to users in a Web page without being HTML-encoded. This is a classic
problem with message boards, where users can post HTML-formatted
messages for other users to read.
One of the reasons this is a more serious or significant vulnerability
is that an attacker can post an attack once and can potentially affect a
large number of users without having to resort to social engineering. The
attacker also doesn’t need to use the Web application itself to exploit this
vulnerability. Any data received by the Web application by other means,
including e-mail, system logs, etc., is capable of exploiting these vulner-
abilities.
DOM-Based or “Local”
This cross-site scripting vulnerability is one that is focused on the DOM
(Document Object Model). When JavaScript is executed, the browser sends
several objects that represent the DOM back to JavaScript.
One of these is the document object, which contains most of the
properties of the page that executed the JavaScript. The document object
contains multiple other objects, all populated from the browser’s point of
view — which is important to remember.
Basically, this type of XSS modifies the DOM itself to take advantage
of any Web pages that then use the DOM information. Some DOM objects
are not under the control of the server-provided page or are only partially
under its control, yet the contents of those objects are used dynamically.
An example of this would be the document.URL that contains the
URL the browser navigated to, not the URL extracted from the HTML
body. This means that if a hyperlink is sent that contains scripting as part
of the URL, and the page referenced uses that document.URL value in
a dynamic page, the script embedded in the URL is executed.
Some DOM objects that are at risk:
Document.URL
Document.URLEncoded
Document.location (and many of its properties)
Document.referrer
Window.location (and many of its properties)
Anatomy of an Exploit
Nonpersistent or Reflected Exploit
Here, the attacker discovers a Web site that has an XSS vulnerability by
entering a string such as “<test>” to see if the string is reflected back with
the greater-than and less-than symbols unencoded.
Once XSS vulnerability is found, the attacker crafts a URL that will
exploit the vulnerability, and he sends the crafted URL to another user of
the site, generally as a spoofed e-mail.
When the potential victim visits the site using the link contained in
the e-mail, the malicious script contained in the crafted URL is executed
by the potential victim’s browser as if it came from the Web site with the
XSS vulnerability. The script steals whatever sensitive information it can
and sends the data to the attacker.
The attacker can use the credentials of the other users to log in with
their privileges.
DOM-Based or Local
Here, the attacker must know of a Web site with a page that uses part
of the DOM not wholly under the control of the server-side page.
Once the attacker finds a page that parses the URL, or similarly uses
information in the DOM to provide data for client-side logic, the attacker
can craft a URL to take advantage of that vulnerability and e-mail or
otherwise distribute the URL to potential victims.
When the potential victim receives the link and clicks on it, the
malicious code is exploited; the vulnerable Web page is returned from
the server and may now run a variety of commands with whatever
privileges the user has on the computer it is running on.
Real-World Examples
There are multiple real-world examples of cross-site scripting vulnerabilities:
PayPal XSS
In June 2006, PayPal® (EBay, Inc., San Jose, California) was hit by a
complex attack that used a combination of an e-mail phishing that asked
the users to click on a link leading to a URL on the real PayPal Web site.
The link to this URL utilized cross-site scripting to present the users with
some text (crafted to look official) informing them that their account is
disabled because of suspicions that it had been compromised and that
they would be redirected to a resolution center. Then the users were
indeed redirected but to a trap site in South Korea.
This trap site was basically a phishing site. The users were asked for
their PayPal login details, and even more sensitive information such as
Social Security number, bank account numbers, etc.
One of the most interesting facts about this attack is that on the initial
PayPal page the user is directed to is an SSL page; the valid 256-bit SSL
certificate to confirm it belongs to PayPal. By the time users are actually
redirected to the fake PayPal phishing site, they may be off guard because
they’ve already done what they have been taught: They think they have
verified that the original page is HTTPS, complete with its little lock icon
and a security certificate.
Microsoft Passport
In October 2001, a security researcher, Marc Slemko, conducted some
investigations into the integrated Passport™ (Microsoft Corporation, Red-
mond, Washington) system and its component services and brought one
vulnerability to light: using Hotmail’s HTML filtering and cross-site scripting
can expose the user’s Passport data.
In this case, an e-mail was sent to a Hotmail user that included a tag
starting with “<_img.” Hotmail thinks this is the start of an HTML tag and
treats the information inside as attributes but Internet Explorer (IE) doesn’t
recognize any tag starting with an invalid character, so it just continues
as if the tag isn’t there.
Part of the problem is that IE is performing what is called a “white
list” check for the tag. If the tag is not specifically considered to be valid,
then it is invalid by default. Hotmail, however, is performing what is called
a “black list” check. If the tag is not specifically considered to be invalid,
then it is valid by default.
This Hotmail issue is merely an easy way to get around the necessity
of sending some social engineering e-mails to get the user to click on the
link — it’s not actually a required part of the vulnerability demonstration.
We recall that since the user is doing this through a Hotmail account,
Passport has already been logged into and a Passport cookie has been
issued.
Once the HTML exploit page is loaded, it opens two frames. One of
these connects to a page in the Passport’s secure path to enable the
attacker to steal the Passport cookie. The second frame exploits an XSS
vulnerability in Passport: if you are already logged in, a page is returned
including the unencoded passed in information — in this case, executed
by JavaScript on the attacker’s server. This JavaScript then proceeds to
capture the user’s Passport cookie and sends the cookie off to a CGI
script that captures them.
Test Techniques
One of the difficulties in testing cross-site scripting is that the more
advanced efforts often involve encoding some of the telltale signs of cross-
site scripting exploits in any one of a number of formats. Table 13.1 gives
examples of texts that can represent the <script> tag in HTML.
If your application accepts UTF-8 characters, this becomes even more
complex because you have multiple ways to encode each character. If
this is the case for your application, it’s a strong argument for deleting
characters that are not explicitly safe and allowable.
<script> HTML
%3cscript%3e URL Encoded
%u003cscript%u003e Unicode %U Encoded
%%3cscript%%3e Double URL Encoded
\074cscript\076 C/Perl Octal Escape Characters
\x3cscript\x3e C/Perl Hex Escape Characters
Black-Box Testing
Basic Script Test
The best way to start testing for cross-site vulnerabilities is to test every
input field you can find with a simple test script:
& &
< <
> >
“ "
( (
) )
# #
If the message box displays “XSS Vulnerability Found,” the input field
you are testing has an XSS vulnerability. If it doesn’t display the phrase
but the HTML page returned displays incorrectly, the component may still
be vulnerable and should be further tested.
Encoding Test
Now for each visible variable, submit the following string:
11;!—“<XSS_Check>=&{()}
On the page that is returned, search for the string “<XSS_Check>.”
If you can find that test string in the returned page, it’s likely that
the component has an XSS vulnerability.
If it’s displayed literally (including the greater than or less than char-
acters at any point), there is a definite XSS vulnerability.
White-Box Testing
The steps for black-box testing are still needed, but if you are doing
white-box testing, you can follow the input string through the code to
Hidden Fields
Repeat the set of black-box tests on every hidden field, the ones that are
not normally editable. This may require the use of automation, a custom
tool, or one of the proxy servers available commercially. You need to be
able to edit HTTP requests between client and server.
Bibliography
Klein, A. DOM Based Cross Site Scripting or XSS of the Third Kind. Web Application
Security Consortium July 2005. Available from http://www.webappsec.org/
projects/articles/071105.shtml.
Chapter 14
Pseudonyms
DoS
DDoS
Description
A denial-of-service (DoS) attack is one in which an attacker uses multiple
techniques to deny legitimate users access to a system or resource. This
is generally done in one of two ways:
183
DoS attacks are extremely common because they are so simple to carry
out, and there is a wealth of ready-to-use tools available for script kiddies
to download.
Ping of Death
The stereotypical “ping of death” is based on the fact that Internet Control
Messaging Protocol (ICMP) echo messages are designed to be no larger
than 65,535 bytes. Because most of the information of interest in ICMP
echo packets is contained in the header, sometimes the data portion is
unchecked. If an ICMP echo packet is sent that is too large, some operating
systems (OSs) will crash.
Whereas a packet larger than 65,535 bytes is illegal, this limitation can
be worked around by using fragmentation packets that, when reassembled
on the receiving end, overflows the buffer on some systems. So it’s
basically a buffer overflow exploit. Because of the ease and prevalence
of this attack, most systems are no longer vulnerable.
Teardrop
This attack is also dependent on fragmentation. Fragmented packets are
sent but Instead of neatly lined-up fragmentation offsets, the offsets
overlap. If the operating system does not have a plan in place for this
eventuality, the system can crash, reboot, or lose stability. This is also an
easy attack to learn; few systems are vulnerable anymore. It is named for
the tool that exploits this vulnerability.
Ping Flooding
Ping flooding is an attack specifically aimed at denial of network resources.
Ping flooding uses up the bandwidth of the network so traf fic from
legitimate users can’t get through. It’s the electronic version of the rush-
hour traffic jam. The general rule is that if the attacker has a gr eater
bandwidth than the victim, the attacker will succeed in the DoS.
This attack works as follows: The attacker sends many large ping
packets as quickly as possible to the victim. This exhausts the victim’s
inbound bandwidth; if the person replies to the pings, the outbound
bandwidth may be consumed as well.
Smurf Attacks
A smurf attack is a specific variation on a ping flood attack. Instead of a
ping to a single system, a smurf attack uses repeated spoofed broadcast
ping messages to flood the system. All of these ping messages use the
spoofed IP address of the intended victim as their source address. If the
ping is actually broadcast to the network, most hosts on that IP network
will accept the ICMP echo request and reply to it with an echo reply per
recipient, which will have the effect of multiplying the traffic by the
number of hosts responding. On a multi-access broadcast network, poten-
tially hundreds of machines may respond to each packet.
This attack is also named after the attack program created to exploit
this vulnerability.
Amplification Attacks
This type of DoS attack uses both spoofing and broadcast addressing to
amplify a single stream of packets several hundredfold to flood the victim’s
bandwidth.
To carry out this attack, the attacker needs to find a network that both
allows communications to the network’s broadcast address and has a good
number of hosts active on the network. Because the amplification rate is
directly dependent on the number of active hosts, the more hosts the
better.
The attacker sends large ICMP echo request packets to the broadcast
address of the amplifier network with a spoofed source address of the
victim. The amplifier network then broadcasts these ICMP echo packets
to all the hosts on that network, and each of these systems will then send
corresponding ICMP echo replies to the spoofed source address of the
victim, flooding their network bandwidth.
This is also called a reflected attack. If the attack relies on ICMP packets,
it’s also called a smurf attack. If the attack relies on User Datagram Protocol
(UDP) packets, it’s called a fraggle attack.
SYN Flooding
In SYN flooding, the attacker attempts to exhaust the space in the Trans-
mission Control Protocol/Internet Protocol (TCP/IP) stack with spoofed
and only partially complete connections, so legitimate users are unable
to connect. TCP maintains the connections so it has to be able to track
them and their state somewhere; that place is the TCP/IP stack. But only
Anatomy of an Exploit
Ping of Death
An attacker uses one of the ICMP ping tools available to construct an IP
packet with a size larger than 65,535 bytes and sends it to the target of
choice. The header source IP is usually spoofed to help hide the source.
Teardrop
An attacker targets a network that seems vulnerable and uses the Teardrop
tool to set up the attack by sending several IP fragmentation packets that
are structured so that when the receiving system attempts to reassemble
them, they will overlap.
Ping Flooding
When an attacker thinks he has a vulnerable target, he tells his army of
bots to begin sending ICMP echo requests to the target IP address as
quickly as possible. The headers of the requests can be forged with random
bogus IP source addresses to resist any attempts to filter the requests by
source addresses.
Smurf
In a smurf attack, the attacker targets a vulnerable network and uses the
Smurf tool to craft ICMP echo requests where it has forged the source IP
address to match that of the target.
SYN Flooding
An attacker sends a continual series of TCP SYN packets to the target,
each one with a different forged source IP address to exhaust the target’s
resources during this continual flooding.
Real-World Examples
Because of the overwhelming prevalence of DDoS compared to purely
DoS attacks, both the following examples are DDoS.
Test Techniques
Testing for DoS attacks really has two major branches, and whether you
use one or the other (or both) will depend on the product you are testing
and what dependencies it has or services it offers to others.
Network DoS
Most network DoS attacks boil down to one of two situations.
Protocol Vulnerability
In many cases, the DoS is caused by the fact that a network device or
system is not able to deal with an exploit of a network protocol vulner-
ability. In these cases, fuzz testing is a good way to try to exercise the
protocols to determine the reaction of the system under test to protocol
fuzzing.
These are mostly network protocols and unless you are testing a system
that deals directly with that low a level in the Open Systems Interconnec-
tion (OSI) model, you are a little bit helpless and dependent on your OS
and network to handle these issues.
Lack of Limits
The other major factor is that limits on various types of transactions
are either nonexistent or too high for the system to handle. In the latter
case, it would pay if you can cause a DoS and then backtrack from it to
question the limits that are in place to prevent DoS.
There are several aspects of input that you can experiment with in
trying to trigger a DoS:
Circular References
Is there any way you can cause a circular reference to occur in your
system? If you can, you might be able to cause a DoS.
I had a recent experience with an e-mail system that treated notification
messages not in the same way it treated regular e-mail messages; there
were questions about whether or not a circular reference could be insti-
gated with a combination of two different types of system notification
messages. It turned out that it did not work, but it was an interesting
experiment.
Any service- or system-crashing issues may become a DoS. If you run
across a mysterious crash of your test system or a service on the system,
sometimes the tendency is to dismiss it as a fluke. Perhaps it is, but never
just shrug it off. Always keep looking for what might have caused it,
because some of these crashing issues are very real vulnerabilities that
may be exploitable as a DoS at some later date.
Bibliography
Gibson, S. The Strange Tale of the Denial of Service Attacks Against GRC.Com.
Gibson Research Corporation. September 17, 2005. A vailable from
http://www.grc.com/dos/grcdos.htm.
Chapter 15
Pseudonyms
Format string attacks
Description
The goal of a format string exploit is to take control of the execution of
a program by overwriting data. It is dependent on programming mistakes
or shortcuts made when using format functions such as printf().
If the software being tested is written in C, C++, or Perl, even in part,
there is a possibility that it may use one or more format functions. The
root cause of this vulnerability is that these languages allow functions to
accept any number of arguments by “popping” as many arguments as
they wish off the stack and trusting the early arguments to show how
many additional arguments are to be popped and what datatypes they
are. If this is combined with unfiltered user input as the format string,
the vulnerability is created.
193
The following are the basic ANSI C functions that may be vulnerable
to format string attacks:
The format string itself contains the format parameters, similar to how
inline formatting is done in HTML. The format parameters for printf() are:
Top of Stack
Address of the variable A
Bottom of Stack
%s expects a memory address and then will print the data at that
address until a null byte terminator is encountered to signal the
end of the string.
%n expects a memory address and will write the number of bytes
written so far into memory at that address.
Anatomy of an Exploit
Most exploits of format string vulnerabilities start with knowing that a
format string vulnerability exists. This can be discovered in multiple ways,
including personal experimentation and seeing it posted on one of the
many boards frequented by hackers. It’s also helpful to know that the
language the software is written in is one that has a risk for this vulner-
ability to exist (C, C++, and Perl, in this case).
Once the vulnerability is known, the attacker needs to carefully craft
a string to exploit the format string vulnerability. The exact string or strings
will depend on what the attacker wishes to accomplish.
In some cases, the attackers will be able to find the stack information
from others, but in some cases, they will start to systematically explore
by having the format string function output the contents of memory for
examination.
Once the attackers determine what they want to accomplish, they can
craft one or more strings to exploit the vulnerability. Now they can
combine this exploit with other code to create malicious software to
distribute or install.
Real-World Examples
Although considerable numbers of format string vulnerabilities have been
reported, few actual exploits are listed among the reports of real incidents.
But a very interesting toolkit that did use string format vulnerabilities in
some of its functionality was reported “in the wild” in January 2001.
The lprng software accepts user input that is later passed to syslog()
as the format string for a function call to snprintf(). This particular instance
of the format string vulnerability can allow users who have remote access
to the printer port to overwrite addresses in the printing service’s address
space. This can cause segmentation that will lead to denial of printing
services or can be used to execute an arbitrary code injected by other
methods into the memory stack of the printer service.
All the incidents were caused by the lack of a format specifier when
syslog() was called.
Test Techniques
Out of the list of formatting functions, sprintf and vsprintf are the functions
that deserve some special care and attention as they are the ones that
“print” formatted data to a buffer. The fix for this vulnerability is to always
use a format specifier to format data.
Black Box
In Black-Box testing, it becomes important to include some of the for-
matting parameters in all input fields. These should include the following,
but more can be used:
%x
%s
%n
Then watch all output and the program itself for unusual output or
behavior. You can also try testing with several %s parameters embedded
in the input string. If a format string vulnerability exists, the resulting
behavior would be likely to be an access violation error or another error
that would cause the application to crash.
White Box
White-Box testers have a relatively easy time finding these vulnerabilities.
The code base needs to be searched for any use of the C format string
functions, and each time they are used, there must be a format string in
place to insure that the data is correctly interpreted.
There are some additional functions that use formatted output, which
must also be scrutinized, and are fairly OS specific. These include functions
such as syslog().
Tools
There are a number of potentially useful free tools that can provide
additional checks of the C code. Although automated tools can add
significant value to test efforts, they do not take the place of security
reviews and dedicated security testing. They also have a tendency to
generate a large number of false positives and thus a great deal of noise.
Flawfinder
This is an open source tool that does security scans of C code. It can be
obtained from http://www.dwheeler.com/flawfinder/.
Pscan
This is an open source tool that scans C code for potentially dangerous
function calls. It can be obtained from http://www.striker.ottawa.on.ca/
%7Ealand/pscan/.
Smatch
This is an open source tool that scans C and C++ code for known bugs
and potential security defects but is mostly focused on checking the Linux
kernel code. It can be obtained from http://smatch.sourceforge.net/.
Splint
This is an open source code tool that scans C code for potential vulner-
abilities and dangerous programming practices and can be obtained from
http://splint.org/.
Bibliography
CERT® Advisory CA-2000-13: Two Input Validation Problems In FTPD. Released
July 7, 2000. Last updated November 21, 2000. Carnegie Mellon Software
Engineering Institute CER T ® Coordination Center. Available from
http://www.cert.org/advisories/CA-2000-13.html.
CERT® Advisory CA-2000-17: Input Validation Problem in rpc.statd. Released
August 18, 2000. Last updated September 6, 2000. Carnegie Mellon Software
Engineering Institute CER T ® Coordination Center. Available from
http://www.cert.org/advisories/CA-2000-17.html.
CERT® Advisory CA-2000-22 Input Validation Problems in LPRing. Released Decem-
ber 12, 2000. Last updated January 27, 2003. Carnegie Mellon Software
Engineering Institute CER T ® Coordination Center. Available from
http://www.cert.org/advisories/CA-2000-22.html.
CERT® Incident Note IN-2001-01: Widespread Compromises via “ramen” Toolkit.
January 18, 2001. Carnegie Mellon Software Engineering Institute CERT®
Coordination Center. Available from http://www.cert.org/incident_
notes/IN-2001-01.html.
Multiple Linux Vendor rpc.statd Remote Format String Vulnerability. July 16, 2000.
Security Focus. Available from http://www.securityfocus.com/bid/1480.
Multiple Vendor ftpd setproctitle() Format String Vulnerability. July 5, 2001. Security
Focus. Available from http://www.securityfocus.com/bid/1425.
scut/team teso. Exploiting Format String Vulnerabilities. March 24, 2001. Available
from http://julianor.tripod.com/teso-fs1-1.pdf.
Chapter 16
Pseudonyms
Integer manipulation bugs
Description
Integer overflows and underflows are made possible by the way numbers
are handled in computer memory. Each bit in computer memory has only
two possible values, 1 or 0, and different numbers of bytes (units of 8
bits) are used to store integers based on the size of the number to be
stored. If no negative numbers are needed, a signed datatype will often
be used. In a signed datatype, the value is always positive, and a larger
positive number can be stored in the same number of bytes than can be
stored using an unsigned datatype because the first bit is not reserved to
indicate whether the integer is positive or negative.
The ranges of some common C datatypes are shown in Table 16.1.
Integer math is handled with a method called two’s complement arith-
metic. This, along with the fact that computers are very literal, can cause
a security vulnerability. When told to add or subtract, they do so based
201
0111 7
0110 6
0101 5
0100 4
0011 3
0010 2
0001 1
0000 0
1111 –1
1110 –2
1101 –3
1100 –4
1011 –5
1010 –6
1001 –7
1000 –8
65,535 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 = 65,535
+1 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 =1
65 ,536
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 =0
Anatomy of an Exploit
Integer overflows are most useful as a way to set up for a stack overflow
if the attacker is able to create an integer overflow in a variable that is
later used in the dynamic allocation of memory. Because no widespread
exploits are in the wild, an attack is pretty much based on logic and
conjecture.
-32,767 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 = -32,767
-1 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 =1
-32,768
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 = 32,767
Real-World Examples
No widespread exploits have been reported as being based on an integer
overflow, but quite a few vulnerabilities have been reported and patched,
especially in the last few years. This is only smart because there will
certainly be attention paid to how to successfully exploit the known
vulnerability.
An example of one of these patched vulnerabilities is one reported in
early 2004 in Microsoft’s Internet Explorer 5.5 SP2. In this case, there is
vulnerability in the bitmap file processing functionality, which uses an
Test Techniques
Black Box
Black-box testing of integer overflows and underflows is very difficult.
All variables still need to be examined, and the tester should know or
discover what calculations are carried out with those variables and then
attempt to influence those results. Sometimes you will seemingly get no
response; sometimes you will get an error message that gives more clues
to the actual datatype being used. The ranges typically returned in some
of these error messages can often be translated directly into datatype range
values, thus revealing a potentially useful bit of data to the attackers but
also to the tester. It’s particularly useful, whenever one of these is encoun-
tered, to try to set the variable to a maximum or minimum value and
then try to increment the maximum or decrement the minimum.
Always try long strings in input fields and remember that “long” tends
to be a rather fluid description. I generally try a string slightly longer than
I would expect, then a string that is about 5 times as long, and then a
string perhaps 50 times as long. This is useful if a calculation is being
done based on the input length. If this succeeds, the program may crash.
Always try the largest and smallest allowable values in numeric fields
to see if there is a case in which the individual integers are correctly
checked but perhaps operations performed with them are not.
Always verify the data coming from other sources for the same flaws
as data being input directly into the program itself. All trust is misplaced.
Don’t forget applications programming interface (API) calls and meth-
ods of passing data other than the user interface (UI). Never trust what
is calling your functionality to do so correctly and with the correct data.
All trust is misplaced. Your program needs to be able to protect itself.
White Box
There are several places in a code where an integer underflow or overflow
can occur. These include:
Arithmetic operations
Conversions and casts
Copying and reading
Bibliography
CERT® Advisory CA-2002-25: Integer Overflow In XDR Library. Original Release
Date August 5, 2002. Last updated October 3, 2002. Available from http://
www.cert.org/advisories/CA-2002-25.html.
Howard, M. Reviewing Code for Integer Manipulation Vulnerabilities. April 28,
2003, Microsoft Corporation. Available from http://msdn.microsoft.com/
library/default.asp?url=/library/en-us/dncode/html/secure04102003.asp.
Symantic Security Response Newsletter. January–February 2004. Available from
http://www.ldeo.columbia.edu/ldeo/it/Symantec/News-Jan2004.
Chapter 17
Pseudonyms
MITM attacks
Eavesdropping attacks
Description
Man-in-the-middle (MITM) attacks are named for the attacker’s position
as quite literally the man in the middle. The attacker sits between two
other parties, and both of them believe they are talking to each other but,
instead, they are really talking to the man in the middle, the attacker. To
accomplish the classic version of this attack, the attacker must either be
located between the two communicating systems or must share a network
path with one of them.
When encrypted connections are set up, a secret key is generated
between the two parties and transmitted. This key is used to encrypt any
communications between the two parties from then on. Traffic between
these two parties is not readable by would-be attackers who may be
207
sniffing the network, because the key is sent securely and used to encrypt
the subsequent traffic.
In an MITM attack, the two parties trying to communicate securely are
tricked. Although the server thinks it is talking to the user, and the user
thinks it is talking to the server, they are both wrong; they are really
talking to the attacker. The original request to open a secure connection
was intercepted by the attacker, and the attacker is maintaining the
originally requested secure connection with the server and a separate
secure connection with the user.
Packets from the server are encrypted with the first key and sent to
the attacker, which the server actually thinks is the user. The attacker then
decrypts these packets with the first key and reencrypts them with the
second key. Then the attacker sends the newly encrypted packets to the
user, who believes these packets are actually being sent by the server. By
sitting in the middle and maintaining these two separate keys, the attacker
is able to sniff and even modify traffic between the server and the user
without either side being the wiser.
This process is illustrated in Figure 17.1.
Anatomy of an Exploit
The attacker is sitting on the same network as the server and the victim
but wants to intercept the traffic between the two. In preparing for the
attack, the attacker has routed the network traffic through itself so that
the attacker can see the traffic.
The user now tries to open a Secure Sockets Layer (SSL) conversation
with the server, but the attacker intercepts the traffic and responds as if
he were the server, issuing a key with which to encrypt the traffic between
itself and the user. The user responds with its key and a two-way SSL
conversation is now in place between the user and the attacker, but
because the attacker responded to a request made to the server, the user
thinks he is talking directly to the server.
At the same time, the attacker opens an SSL conversation with the
server itself as if it were actually the user. The server responds to the
request with a key with which to encrypt the data between the attacker
and the server. The attacker responds with its own key, and there is now
a two-way SSL conversation in place between the attacker and the server.
At this point, the server and the user think they are talking to each
other, but the attacker is actually sitting between them, holding a secure
connection to both of them. When data is sent, the attacker takes the
data, decodes it with the appropriate key and then reencodes it with the
other key and sends it on to the intended recipient. The attacker now
has the transmitted data as unencoded to use as it wishes.
Real-World Examples
An interesting variation of the MITM attack was reported in July 2006.
This attack targeted the users of CitiBank’s CitiBusiness functionality.
This attack was carried out by sending to Citibank customers an e-
mail that claimed to be from Citibank. The e-mail informed the victims
that someone attempted to log onto their account, and they need to
confirm their account information. The e-mail included a link to do so.
This is a fairly standard phishing email.
Now CitiBusiness customers are required to use one of the seldom-
supplied security tokens to access their account online. This is one of the
little fobs generating a password that changes frequently (every minute
perhaps). This is a much-touted way to improve security.
Once the victim clicks on the link in the e-mail, they are taken to a
very well-done spoof of the Citibusiness login page. Even its address
appears believable as it ends with Citibank.com. However, it is really a
Web site in Russia.
This spoofed Web site is set up to act as the MITM between the victim
and the real Citibusiness login site. When victims enter their username,
password, and token-generated key, the Russian server forwards that
information to the real Web site to validate it. If an error is generated by
the real Citibank Web site, the spoofed Web site also generates an error.
Now the Russian site is logged into the Citibusiness site with the victim’s
credentials and can do whatever it wants.
Test Techniques
Most testing of MITM attack vulnerabilities is begun by looking carefully
at all protocols in use in your system to determine what information they
exchange and how. In the clear? How is the remote server identified?
If your method of identification is to put out a call and trust whatever
system answers to be the correct one, you are most likely vulnerable to
an MITM attack.
Once you find a likely candidate to test, you can use one of the
session-hijacking and MITM tools available to see if you can demonstrate
the vulnerability. A good tool to try is Ettercap (http://ettercap.source-
forge.net/).
Bibliography
Lam, K., LeBlanc, D., and Smith, B. Theft on the Web: Prevent Session Hijacking.
Technet Magazine, Winter 2005. Available from http://www.microsoft.com/
technet/technetmag/issues/2005/01/SessionHijacking/default.aspx.
Chapter 18
Pseudonyms
Password cracking
Password guessing
Description
There are actually multiple password issues that are not uncommon across
many applications. For simplicity, I have combined most of them into this
single section on passwords rather than spread them out.
Probably the single most common root cause of password issues is
the human issue. Passwords are annoying, and it seems like there are far
too many of them to remember. There are frequent admonishments to
have strong passwords that are changed regularly and aren’t reused for
several months. There should be a different strong password for every
site that is used, as well, but how are we supposed to remember all these
passwords?
Despite knowing better, most people come up with a short list of
passwords that they find easy to remember and stick with those, reusing
them for multiple sites and not changing them often, if at all. This is even
211
despite the knowledge that these passwords may be the only defense
against the loss of personal data that is of great value.
These very facts of human behavior mean that the potential victims
make it easier for attackers, and this is one of the reasons why password
attacks are very common and surprisingly effective. The victims, in
essence, shoot themselves in the foot all too often with their password
behavior. This is not isolated to just personal passwords but sometimes
server or software administrator passwords.
Default Passwords
Many pieces of software are installed with either blank or default pass-
words with the assumption that the users will change these passwords as
soon as the software is installed. Except, even if the user’s guide, admin-
istrator’s guide, or online reminder tells the user to change the password
for security, a surprising number of users never bother to do so.
This can leave all the system’s security wide open, as has been shown
many times on many products. There are extensive lists available online
of the default account names and passwords for just about every piece
of major software that ships with defaults.
Windows registry
Configuration file
Authentication file
Custom file
Dictionary-Based Attacks
This is a version of a password attack that relies on an automated tool
that simply starts trying every word in whatever dictionary it uses as a
resource to find the victim’s password.
When it meets with success, the tool displays the password for the
attacker.
This type of password attack is very slow and uses a lot of system
resources to function. It’s also useless if the user’s password isn’t in the
dictionary.
Anatomy of an Exploit
Default Passwords
An attacker sends a packet to a target machine, which is directed to a
port used by the software they are targeting, to see if their potential victim
is running the target software. If they get the response they are expecting,
they know they might be able to attack this victim.
Once the attacker knows the target software is installed, he attempts to
connect to that software using the well-known default administrator password.
If the default password works, the attacker now has administrative
rights to that software.
Password Guessing
An attacker is attempting to log in to the network of the company he was
fired from with the username of his ex-boss. Because the attacker had
worked with the victim for awhile, he begins trying to guess at possible
passwords until he succeeds with the ex-boss’s wife’s name and the day
of their anniversary.
The attacker is now logged onto the network with the credentials of
his ex-boss.
Real-World Examples
Default Passwords
In 1995, it was reported that the IRIX system of Silicon Graphics, Inc.
(SGI) was being shipped with multiple accounts preconfigured with no
passwords to provide easy plug and play install and operations.
Test Techniques
Insecure Password Storage
The easiest way to detect plaintext password storage is to exercise your
system while you run monitoring software in the background to monitor
what is being created and stored on the local system. It’s important to
include install and uninstall on your system while running this same
monitoring software.
It’s also important to see what storage is being done on the server, if
applicable, to eliminate the possibility of insecure password storage on
the server itself.
Password Cracking
Attempting to brute-force crack the password of a user account by simply
entering a variety of different incorrect passwords will not test the security
of the password itself, but it will demonstrate whether there are any
mitigations in place like those that lockout the user after a certain number
of incorrect password entries.
Password cracking and guessing can also be made more difficult by
setting and enforcing password length and complexity rules.
Bibliography
CERT® Advisory CA-1993-12: Novell LOGIN.EXE Vulnerability. Original Release
Date September 16, 1993. Last updated September 19, 1997. Available from
http://www.cert.org/advisories/CA-1993-12.html.
CERT® Advisory CA-1995-15: SGI Ip Vulnerability. Original Release Date November
8, 1995. Last updated September 23, 1997. Available from http://www.
cert.org/advisories/CA-1995-15.html.
Chapter 19
Pseudonyms
Session theft
Connection hijacking
Description
Session hijacking is when an attacker takes over a TCP session between
two machines, quite often in midstream, and usually for the purposes of
either stealing information or disrupting or inhibiting the flow of infor-
mation. Because authentication only occurs at the start of a TCP session,
an attacker can use captured, brute-force, or a reverse-engineered session
ID to seize control of a legitimate user’s Web application session while
the session is still in progress.
A session is designed as a way to track the state between multiple
connections from the same server and is a series of interactions between
the two communication end points that occurs during the span of a single
connection. When a user logs in to an application, a session is created
on the server to maintain the state for other requests originating from the
same user.
217
Sessions are used to store parameters that are relevant to the user. The
session is kept alive on the server as long as the user is logged on to the
system. The session is destroyed when the user logs out from the system
or after a predefined period of inactivity. When the session is destroyed,
the user’s data should also be deleted from the allocated memory space.
A session ID is an identification string (usually a long, random, alpha-
numeric string) that is transmitted between the client and the server.
Session IDs are commonly stored in cookies, URLs, and hidden fields of
Web pages.
Sometimes cookies are set to expire (be deleted) upon closing of the
browser. These are termed session cookies or nonpersistent cookies. Cook-
ies that last beyond a user’s session (i.e., “Remember Me” option) are
termed persistent cookies. Persistent cookies are usually stored on the
user’s hard drive. Their location is determined according to the particular
operating system and browser.
There are several problems with session IDs. Many popular Web sites
use algorithms based on easily predictable variables, such as time or IP
address to generate the session IDs, causing them to be predictable. If
encryption is not used (typically, SSL), session IDs are transmitted in the
clear and are susceptible to eavesdropping.
Session hijacking involves an attacker using brute force captured or
reverse-engineered session IDs to seize control of a legitimate user’s
session while that session is still in progress. In most applications, after
successfully hijacking a session, the attacker gains complete access to all
of the user’s data and is permitted to perform operations instead of the
user whose session was hijacked.
Anatomy of an Exploit
In blind hijacking, the attacker injects such data as malicious commands
into intercepted communications between two hosts commands such as
“net.exe localgroup administrators /add EvilAttacker.” Called blind hijack-
ing because the attacker can only inject data into the communications
stream, he or she cannot see the response to that data (such as the
command completed successfully). Essentially, the blind hijacker is shoot-
ing data in the dark, but as you will see shortly, this method of hijacking
is still very effective.
In a session theft attack, the attacker neither intercepts nor injects data
into existing communication between two hosts. Instead, the attacker
creates new sessions or uses old ones. This type of session hijacking is
most common at the application level, especially Web applications.
Session hijacking at the network level is especially attractive to attack-
ers. They don’t need host access, as they do with host-level session
hijacking. Nor do they need to customize attacks on a per-application
basis, as they do at the application level. Network-level session-hijacking
attacks allow attackers to remotely take over sessions, usually undetected.
But successfully hijacking a session at the network level r equires an
attacker to overcome various obstacles.
Real-World Examples
In 2001, a vulnerability was reported in Sun’s NetDynamics application
server platform, where a user who authenticates with NetDynamics
receives a session id and a random unique identifier.
This session id and identifier remain active for up to 15 s after the
user logs in, and a subsequent user can make use of those credentials to
hijack the logged-in account.
Test Techniques
Most testing of session-hijacking vulnerabilities is begun by looking care-
fully at all protocols in use in your system and determine what information
they exchange and how. In the clear? How is the remote server identified?
Is authentication done only at the start of a session?
If your system authenticates your user only at the start of a session,
and after which the system on the other side of the connection is trusted,
your system is most likely vulnerable to a session-hijacking attack.
Once you have a good idea of what your system does, you can use
one of the session-hijacking and man-in-the-middle (MITM) tools available
to see if you can demonstrate the vulnerability. A good tool to try is
Ettercap (http://ettercap.sourceforge.net/).
Bibliography
Lam, K., LeBlanc, D., and Smith, B. Theft on the Web: Prevent Session Hijacking.
Technet Magazine, Winter 2005. Available from http://www.microsoft.com/
technet/technetmag/issues/2005/01/SessionHijacking/default.aspx.
Session Hijacking, Imperva Application Defense Center. Available from http://www.
imperva.com/application_defense_center/glossary/session_hijacking.html.
Chapter 20
Pseudonyms
IP address spoofing
IP spoofing
Description
This is an attack based on the creation of Internet Protocol (IP) packets
with a forged IP source address. This forging makes the packet appear
as if it was sent from a different machine. This technique is very useful
as part of certain other attacks, as a way of trying to disguise identity,
and as a way to defeat portions of network security like IP addr ess
authentication.
Carrying out an IP spoofing attack can be difficult, because it often
means the headers of thousands of packets must be modified, one packet
at a time. This can’t usually be done on a computer that’s running Microsoft
Windows.
To perform IP spoofing, the header of the packet must be modified.
This header contains the following (among other data):
Source IP
221
Destination IP
Checksum value
Order value
When packets are transmitted to the Internet, they will most likely
arrive at their destination out of order and must be reassembled using
the order sent value.
When trust relationships exist between machines, these spoofing attacks
can be especially effective. Some corporate networks make it a common
practice to have trust relationships between various internal systems, so that
a user can access other machines without a username or password as long
as they are connecting from another machine on the internal network.
Because of this connection from another system, they are assumed to have
been authenticated by that system. By spoofing a connection from another
machine in a trust relationship with the target, an attacker might be able
to access the target machine without authenticating.
Nonblind Spoofing
To perform this type of spoofing attack, the attacker needs to be on the
same subnet as the target. The attacker can then use a packet sniffer to
view the sequence and acknowledgment numbers, which means that the
attacker doesn’t have to worry about calculating them accurately and
correctly. The biggest threat of spoofing in this case is session hijacking.
Blind Spoofing
In this attack, the sequence and acknowledgment numbers are unreach-
able and unknown. To try to provide a basis for guessing or calculating
the sequence and acknowledgment numbers, several sample packets are
sent to the target machine to obtain sample sequence numbers. It was
once a common practice to use simple methods to generate these sequence
numbers, which also made them easy to guess and calculate. Now,
sequence numbers are typically the result of random number generation,
which makes it harder to predict the sequence.
Anatomy of an Exploit
Nonblind Attack
The attacker sets up a packet sniffer and collects the packet data from
the system they are targeting to see what the pattern of sequence and
acknowledgment numbers are. If a pattern can be detected, the attacker
can construct a packet that uses that pattern and spoofs the IP address
they want to attack.
Real-World Examples
The most famous use of an IP spoofing attack is probably that of Kevin
Mitnick’s attack against Tsutomu Shimomura in December 2004. It’s impor-
tant to note, first, that IP spoofing was a component of this attack but
not the sole vulnerability used.
The initial sign of this attack was some probes against various machines,
apparently to see if there might be an exploitable trust relationship
between these machines.
Then SYN flooding was used to make the first victim computer unable
to respond to requests, while the attacking machine first probed for specific
TCP behavior and sequencing. Then the spoofed IP address of the first
victim computer was used to issue a SYN request to the second victim
computer, and Mitnick eventually gained root access on the second victim
computer.
Test Techniques
IP spoofing really isn’t a solvable problem, but the use of encryption and
decryption should be tested as in some of the other attacks like man-in-
the-middle or session-hijacking.
Chapter 21
Pseudonyms
SQL insertion
Script injection
Description
The very first thing to point out is that this section is entitled “SQL
Injection,” but injection attacks are not limited to applications running
against a particular database server. MySQL, SQL Server, Oracle, etc., are
all potentially susceptible.
SQL injection vulnerabilities are common in Web applications that
access an SQL back end. The vulnerability has its roots in the use of
client-supplied data in SQL queries.
Successful SQL injection attacks can result in the attacker possibly
being able to:
225
Read registry keys, potentially including the SAM (if SQL Server is
running as the local system account) using the xp_r egread
extended stored procedure
Run other extended stored procedures
Run queries on linked servers
Create new custom extended stored procedures to run explicit
code with the SQL server process
Use the “bulk insert” statement to read any file on the server
Use bcp to create arbitrary text files on the server
Create OLE Automation applications that can do everything that
an ASP script can
Anatomy of an Exploit
Look for a Possible Vulnerability
The start of an SQL injection attack generally begins with the attacker
looking for vulnerability in a site. This could be just about anything that
accepts input: a search string, a form, ASP, JSP, CGI, or PHP pages. Note
that this can include hidden fields, not just those displayed through the
UI. Anything the attacker can see in the source is as vulnerable as what
is openly displayed; perhaps more so, because sometimes there is less
security on those fields that are hidden.
Once a possible vulnerability is found, the attack can begin in earnest.
or “syntax.” Sometimes the details of the error are hidden in the headers
or in comments that aren’t visible except in the source.
If an error page is returned that includes links, the attacker will search
the links to see of they contain more details of the error.
If a 302 Page Redirect is called, the attacker will try to capture the
page it is redirected from; this may have more error details in it that can’t
be easily read before the redirect occurs.
If a 500 Error Page is returned, the attacker knows that the injection
may have been successful as this is the default error page for most Web
servers. Though the attacker may not be able to determine much from
this page, it will spur him on to greater attempts to exploit a possible
weakness.
Real-World Examples
Arguably, the most serious and widely publicized SQL injection attack is
the one that was carried out on CardSystems in September 2004, where
263,000 credit card numbers were stolen and 40 million more numbers
were exposed.
Although the exact details of the attack are not available (or at least
not that I’ve been able to locate), the attack is acknowledged to be the
product of the exploit of an SQL injection vulnerability on the Web
application that allows the customers to access account information. The
attackers injected a script that would run every four days to extract records,
zip them, and then export them to an FTP site.
It is worth pointing out that the data that was exported had been kept
in an unencrypted form and in violation of regulatory rules for supposed
“research purposes.”
Test Techniques
Every parameter of every call must be tested separately to have a good
picture of the Web service’s/site’s SQL injection vulnerabilities. Table 21.1
shows the list of characters I recommend testing with.
Black-Box Testing
For black-box testing, you need to use a browser and perform parameter
tampering in any query or parameter you can locate on the site.
The basic process is to replace the argument in every parameter on
every script on the server with a test argument, one parameter at a time.
Leave all the other parameters with valid data intact. Submit this parameter
(or set of parameters) to the server, and then examine the returned page
for the signs of possible vulnerabilities listed in the earlier section titled
“Anatomy of the Exploit.”
White-Box Testing
Determine if the Web site is performing any type of input validation.
Strings tend to be more susceptible to parameter injection than other data
Required
Single quote/ [U+0027] SQL character used to escape strings.
Apostrophe Remember to test all fields, not just string
(‘) fields
• Use alone
• Use as the first character in otherwise valid
input
• Use in the middle of otherwise valid input
• Use as the last character in a maximum
length otherwise valid input
• Use in places specific formatting is required
after formatting requirements are met
Recommended
Double [U+0022] Used to encapsulate SQL query as a whole;
quotes (“) also test as its URL escaped equivalent (%22)
Semicolon (;) [U+003B] SQL command terminator; also test as its URL
escaped equivalent (%3B)
Dash/hyphen [U+002D] Use two as a SQL server single line comment
(-) indicator
Left single [U+2018] Often downgraded to the single-byte single
quote quote character
Right single [U+2019] Often downgraded to the single-byte single
quote quote character
Prime (′) [U+2032] Often downgraded to the single-byte single
quote character
Other Ideas
Percent sign [U+0025] SQL wildcard character; also test as its
(%) escaped equivalent (%25); this doesn’t so
much test for vulnerability as it does that the
character is properly escaped and doesn’t
cause unexpected results
Double left [U+201C) Often downgraded to the single-byte quote
quotes character
Double right [U+201D] Often downgraded to the single-byte quote
quotes character
Double prime [U+2033] Often downgraded to the single-byte quote
character
Soft hyphen [U+00AD] Often translated to the dash/hyphen
Bibliography
Friedl, S. SQL Injection Attacks by Example. January 2005. Available from http://
www.unixwiz.net/techtips/sql-injection.html.
SQL Injection Walkthrough. SecuriTeam, May 2002. Available from http://www.
securiteam.com/securityreviews/5DP0N1P76E.html.
Chapter 22
Fuzz Testing
Fuzz testing (also called fuzzing) is a test technique that attempts to find
security vulnerabilities by passing unexpected and malformed data to a
program’s entry points. Because a very large percentage of security vul-
nerabilities are due to input validation issues, where a program is unable
to deal with one or more pieces of unexpected input, fuzz testing can be
used to find a good number of these vulnerabilities.
Fuzz testing is actually so effective that there is supposition that
attackers are using fuzz-testing techniques to search for exploitable vul-
nerabilities. Blaster and Slammer are both said to have been based on
vulnerabilities discovered by fuzzing.
Fuzz testing is also a way to challenge any assumptions made about
how a program will behave. To create and carry out functional tests for
a program, assumptions are invariably made and often never challenged
to ensure that they are not masking vulnerabilities. Fuzz testing allows all
sorts of random data to be used with no regard for any preconceptions
or assumptions.
This can be a useful technique whenever you are dealing with input
during security testing.
Assumptions
At its most basic level, fuzz testing is the process of testing the assumptions
made about how a program should or will behave, and how dependent
your program is on the trusts it has in these assumptions.
233
Data length
Data type
Data order
Data timing
Data capacity
Source
Machine state
Success
Failure
Authentication
Authorization
Also, do not limit your list of assumptions to data input fields only.
Do not forget about:
RPC endpoints
ActiveX controls
Network ports
Files
Process Steps
This is the set of basic steps that are needed for a fuzz testing effort.
entry points have the highest priority based on the priority of the test
cases that test them.
Some of these entry points are as follows:
Network clients
Network servers
Protocol handlers
APIs
ActiveX controls
Remote procedure call (RPC) endpoints
Stored procedures
Windows messages
Choose Tactics
Some thought must be given to just what kinds of malformed data to
send to the targets determined in step 1. There are some categories that
can be mixed and matched to provide the correct level of testing for your
project:
Mutation
Mutation is the process of taking existing data and modifying it. This is
useful if you happen to have the existing data and a way to modify it.
Beware of attempting this if your data has validation like checksums or
digital signatures.
Generation
Generation creates new data, typically using tools. This is useful when
you have a tool to create the input that can be scripted. Beware of
attempting generation, when you do not have well-defined formats and
no tools in place to generate the data for you.
Run Tests
This is the all important step of actually running your tests. No matter
how well you have planned and designed, count on the fact that it will
take longer than you initially think it should, especially the first time or
two you attempt it. So it’s important to be alert for ways that you can
streamline the process or otherwise save time.
During testing, it’s very important to keep accurate and complete
records of all tests run, their actual input, and their results/output. Without
this information, especially with the randomly generated fuzzing cases,
vulnerabilities may be difficult to track down and reproduce.
Analyze Results
There are three basic types of real results in fuzz testing:
Then there’s the one result that you cannot really determine through
testing:
Fix Vulnerabilities
Now the process of fuzz testing returns to a standard test process of filing
the bug and getting it fixed. Note that you should never wait for an exploit
to appear in the wild before filing the bug and getting it fixed.
Repeat
The fuzz testing needs to be repeated, results reevaluated, and any new
vulnerability fixed until a clean set of tests is achieved.
Case Studies
1990: UNIX
In 1990 there was a study done by three people from the University of
Wisconsin–Madison, which was the first testing done on the subject of
fuzz testing. In this study, 88 utility programs on seven versions of UNIX
were tested on several hardware configurations. The rather simple set of
test cases that were run in this study was able to crash or hang between
25 and 33 percent of the utility programs on each system.
1995: UNIX
This study was repeated five years later with over 80 utility programs on
nine UNIX platforms, including three of the same platforms that were
tested in the 1990 study. The following additional areas of testing were
added:
Bibliography
Forrester, J.E. and Miller, B.P. An Empirical Study of the Robustness of Windows
NT Applications using Random Testing. 2000. University of Wisconsin-
Madison. Available from http://www.cs.wisc.edu/~bart/fuzz/fuzz-nt.html.
Fredriksen, L., Miller, B.S., and So, B. An Empirical Study of the Reliability of
UNIX Utilities. 1989. Miller, Fredriksen, and So. Available from ftp://ftp.cs.
wisc.edu/paradyn/technical_papers/fuzz.pdf.
Koski, D., Lee, C.P., Maganty, V., Miller, B.P., Murthy, R., Natarajan, A., and Steidl,
J. Fuzzing Revisited: A Re-examination of the Reliability of UNIX Utilities
and Services. October 1995. University of Wisconsin-Madison. Available
from ftp://ftp.cs.wisc.edu/paradyn/technical_papers/fuzz-revisited.pdf.
Chapter 23
Background: Cryptography
Crypto is a blanket term that has come to mean the combination of the
techniques of encryption, decryption, and cryptology. None of these are
new concepts; coded messages existed in the ancient world, and they
played a big role in recent wars, with the cracking of Enigma machine
encryption being one of the pivotal developments. These concepts have
just moved to the realm of computers.
In 1993, the U.S. government tried to protect the security of crypto-
graphic software that it uses by making it a crime to export any crypto-
graphic software with over 40-bit keys outside the United States without
a special munitions export license. After years of outcry and study, this
law was changed in 1996, and crypto developed outside the military was
no longer considered munitions, and thus no longer prohibited from
export.
One really important concept to understand about crypto is that it is
rarely, if ever, unbreakable — given an unlimited amount of time, com-
puting power, and incentive to break it.
Encryption
Encryption is typically used for the following purposes:
241
Authentication
This can be through encrypted passwords but also through the use of
digital signatures. A digital signature is a method of ensuring the source
of a message or file by processing it in such a way that the actual message
or file is tied to the person who signed it and is therefore much less likely
to have been spoofed. Most digital signatures employ a trusted third party.
Integrity
This applies to the integrity of both the system and the data, thus allowing
users to confirm that the system has not been breached and that the
system retains its expected completeness, consistency, and integrity.
Confidentiality
The most basic data security is the enforcement of confidentiality, pre-
venting the data from unauthorized viewing. By converting the message
to ciphertext, encryption allows the senders of messages to obscure the
original message so that the confidentiality of the message is assured. This
also applies to processes like the encryption of an entire hard drive to
ensure that if the network has been hacked, the data on the disk is still
secure from unauthorized viewing by someone on the outside. It would
also ensure its security even if an unauthorized person has physical access
to the storage media, such as a laptop or hard drive.
Crypto can also be used to insure the confidentiality of e-mail messages
being sent over the Internet and to keep those messages secure from
sniffing or interception.
Nonrepudiation
This is the defined as the ability of both parties in a transaction to prove
that the other party has, in fact, participated in that transaction. Thus,
neither party can effectively deny that they have exchanged messages
with the other party. This may apply to situations in which intellectual
property is discussed or shared, or terms of a transaction are agreed upon.
Nonrepudiation is generally considered to constitute undeniable proof of
delivery through the multiple ways the users and the transaction are bound
together. These can include the origin of data, the data sender, and time
of receipt. The use of encryption keys to encrypt and decrypt messages
can also be considered proof.
Methodology
To perform encryption, data is passed through an algorithm or a series
of mathematical operations that generate an alternate form of that data.
A cryptographic algorithm is the mathematical formula or function that is
used specifically for encryption and decryption. Because it’s a set proce-
dure and doesn’t change, it can be reversed so that the encrypted data
can be unencrypted and restored to its original readable form.
A very simple example of a basic cipher is the childhood decoder ring.
This ring has 26 letters of the alphabet, and users agree on how far to
rotate the ring to send each other secret messages. If the users agree to
a setting of +2, each letter in their original (plaintext) message is replaced
by the letter that occurs two characters later in the alphabet. Thus, a B
in the plaintext message would appear as a D in the ciphertext.
An algorithm is considered computationally secure if it cannot be
broken with available (current or future) resources. Strong cryptographic
algorithms can be made even stronger by publishing the algorithm and
allowing anyone and everyone to try to prove its insecurity. Sometimes
these take the form of distributed computing challenges. This is why open
source suits crypto development.
Key-Based Ciphers
A key is the means by which messages are encrypted or decrypted. Key-
based encryption is generally considered to be very secure, because even
if the attacker has the ciphertext (the encrypted form of the data) and the
algorithm itself, neither the plaintext (data to be secured) nor the key can
be determined from those two pieces of information.
One way to increase the security of an encryption is to increase the
length of the key. In crypto, key length is equal to the number of possible
options of keys available to decrypt a certain code. An example would
be that a 1-digit numeric key has 10 options: 0 through 9. A 2-digit numeric
key has 100 options: 0 through 99.
The length of the key has an exponential effect on the strength of the
encryption. An 8-bit key has 2^8 (256) possible outcomes. A 40-bit
encryption has 2^40 or 10^12 (1 trillion) possible keys for decrypting
ciphertext. Each time we increase the number of individual keys that
potential crackers have to try to brute-force crack the message that is
encrypted with that key.
Key-Based Algorithms
Symmetric (Single-Key) Cipher
In symmetric encryption, the same key is used for both encryption and
decryption and must be kept secret. To do this, both the sender and
receiver have to agree on the key to be used before making any data
transmissions. Symmetric algorithms tend to be very fast, so they are often
used to encrypt and decrypt large amounts of data.
Digital Encryption Standard (DES) is the most common symmetric
cipher. It was adopted in 1977 and has a 56-bit key. DES was proven
insecure in 1997 and cracked in 56 hr by a machine built in 1998. This
gave rise to Triple DES, a way of using DES on itself for greater security.
Typically, this would consist of a three-step encryption operation, i.e.,
encrypt the file with one key, decrypt it with another, and encrypt it again
with a third key.
Advanced Encryption Standard (AES) — originally called Rijndael —
was adopted by the National Institute of Standards and Technology (NIST)
in 2000 from entrants in a competition between numerous algorithms
developed in the crypto community. The cipher has a variable block
length and key length, usable with keys of 128, 192, or 256 bits to encrypt
blocks with a length of 128, 192, or 256 bits. Both block length and key
length can be extended very easily to multiples of 32 bits.
Asymmetric Encryption
Also known as public-key encryption, the key used to perform encryption
differs from that used to perform decryption. The key used to encrypt is
generally called the “public key” and the decryption key is the “private
key” or “secret key.” The cool thing about asymmetric ciphers is that they
can authenticate transactions across a public channel, providing a receipt
(“signing”) when the private key is used at the receiving end.
If copies of any keys are stored anywhere outside the main user’s
traditional storage location, they are considered to be in escrow. Some
tools, such as Pretty Good Privacy (PGP), put these in certificate authorities
(CA) for trust in the public keys. Its key certificate contains the public
key, user ID related to the key, date created, and, if desired, a list of
digital signatures on the key ring, signed by people who “attest to that
key’s veracity.” RSA (Rivest–Shamir–Adleman), released in 1977, is the
most common asymmetric cipher. It is now in the public domain, open
for anyone to use or improve.
Hash Cipher
In essence, a hash is a string of text that is generated by a message that
serves as a unique identifier of that message. The text of the message, as
well as date and time of submission, is put into the hash algorithm, which
spits out a string of text. This hash string is used to verify the document
integrity by placing the document through the hash function again to see
if the two hashes match. If the hashes are the same, there is a very high
probability that the message was transmitted intact.
MD5 is the most widely used hash algorithm, with a 128-bit fingerprint.
MD5 is also in the public domain.
SHA1 has a 160-bit output and is often used for digital signatures.
Encryption Tools
Here are some of the most widely used (and, generally, more secure)
encryption tools, though encryption tools are constantly evolving. With
greater open source development and use, crypto will probably only
continue to change and improve in the future. Open PGP and GPG lead
the way, with OpenSSH and OpenSSL running on OpenBSD, etc. Bugs
crop up occasionally, but developers in the open source community are
usually able to resolve them quickly.
PGP
PGP is probably the most famous encryption tool. It is based on the RSA
algorithm and is most commonly applied to e-mail transmissions. In fact,
according to Phil Zimmermann, creator of the PGP tool, over 90 percent
of e-mail encryption is done with PGP. PGP is available on a few sites
now as a commercial product, further developed by Network Solutions
(NAI) in the late 1990s, but they no longer support the product. PGP
freeware is available all over the world. Phil Zimmer man has been
attempting to regain rights to PGP so he can continue to evolve it for
future needs.
GPG
Gnu Privacy Guard (GPG) replaced PGP to some extent. Because of its
development outside the United States, it is a more widely available open
solution internationally. GPG is gaining in popularity, particularly after
NAI shut down the commercial support of PGP and with the rise of Linux.
S/KEY
The best way to secure a password, S/KEY is a true one-time pad-based
password scheme. Passwords are long, so that key length is long. To use
S/KEY the user must carry around a list of one-time passwords for each
password entry. The keys should never be stored online.
SSL
Developed by Netscape, the Secure Socket Layer (SSL) handshake protocol
authenticates servers and clients by using the RSA algorithm. OpenSSL is
a newer version available for open platforms.
Key Length
Keys can be cracked by brute force and the right hacker. Most current
data considers symmetric algorithm keys shorter than 128-bit keys to be
at risk for a brute force attack. So far, Triple DES and AES are yet to be
broken. This is because of their extraordinary key lengths.
As for asymmetric or public-key lengths, there are multiple recommen-
dations for 1280 through 2005 bits for individuals and 1536 for corporations
and 2048 for governments.
Programmer Error
Even with strong encryption algorithms, some software programs contain
other bugs that can make passwords, etc., easy to hack, which, in turn,
means that no matter how good the encryption is, the supposedly secure
information can be read.
User Error
Using encryption poorly may be worse than not using encryption at all.
Although this might be an overstatement, the point is that poorly imple-
mented encryption can give a false sense of security. If users know a file
is encrypted, they may disregard fundamental security practices for a file.
This is a security weakness because some information should never be
sent — encrypted or not.
Obscurity
The term “security by obscurity” is one that is often heard these days. It
usually refers to the practice of hiding important data, rather than securing
it in a known location.
An example of security by obscurity would be a letter, not locked in
a safe merely hidden in an undisclosed location within one physical area
of the country. Stronger security in this case would be locking the letter
in a safe, knowing the safe’s location, and providing design specifications
of that safe along with 100 safes of the same type to anyone who wants
to try to break in, but guarding it actively all the while.
Security by obscurity may work for keeping physical items safe from
the random burglar, but it will not work for data on a network.
Cryptanalysis
This is the study of breaking ciphers (uncovering codes and algorithms).
Assuming that an algorithm or product is breakable, cryptanalysis on it
can be conducted in a variety of ways, the most common being the brute
force method. Brute force means trying all keys until the end result
resembles the estimated plaintext. This can only realistically be done with
special hardware, or multiple machines running in parallel. Sometimes,
codes are deduced by using the ciphertext of several messages. The
deductions definitely have better results if some plaintext is available as
well. The 56-bit key in 1995 took one week and 120,000 processors to
break.
Chapter 24
Background: Firewalls
Firewalls are tools that can be used to improve the security of computers
connected to a network, such as a LAN or the Internet. A firewall separates
a computer from the Internet, inspecting your packets of data as they
arrive at either side of the firewall, both inbound to or outbound from
your computer, to determining whether each packet should be allowed
to pass or be blocked.
Firewalls act as guards at the computer’s entry points (which are called
ports) where the computer exchanges data with other devices on the
network. They ensure that packets attempting to enter the computer abide
by certain rules that have been established by the user of the computer.
Firewalls operate in two ways: by either denying or accepting all messages
based on a list of designated acceptable (white listed) or unacceptable
(blacklisted) sources, or by allowing or denying all messages based on a
list of designated acceptable (white listed) or unacceptable (blacklisted)
destination ports.
Although they sound complex, firewalls are relatively easy to install,
set up, and operate.
TCP/IP
TCP/IP is spoken and understood by all computers on the Internet, even
those using different operating systems. In fact, for a computer to com-
municate on the Internet, it has to use TCP/IP.
249
Packets
Firewalls read the IP addresses in the header of the packets that they
receive to determine the source of the message. That information will be
used as part of the determination of whether or not the message will be
allowed access.
Ports
The destination port number is also included the packet’s header infor-
mation. This is important for firewalls, because by reading the packet, the
firewall can tell what application the message is trying to run. Firewalls
can be configured to deny certain applications, which they determine by
reading the port number of the incoming header.
For example, FTP uses port #21, so computers running FTP will be
open to accepting FTP packets and will accept packets that indicate that
they are FTP packets by the inclusion of port #21 in their header. If the
recipient is not running FTP, it would not be open to receiving any info
addressed for port #21. The firewall should be configured to deny access
to any packets that are destined for that port number.
Some common TCP/IP ports are:
Port Scanners
Port scanners are used to find the services running on systems, such as
the ones mentioned earlier. Once the port scanner finds a service or an
application that is running, the attacker can then determine whether or
not that specific service is vulnerable or one they are targeting for attacks.
There are 65,535 virtual ports on a typical personal computer that can
be used to gain entry. The firewall has to keep an eye on each one of
these ports.
Types of Firewalls
Firewalls have a set of rules that determines if any one packet should be
allowed access. But different types of firewalls have different methods of
inspecting packets for acceptance or rejection.
Packet Filtering
Also known as a network layer firewall, this is the most common type of
firewall. When a packet filtering firewall receives a packet from the
Internet, it checks the information stored as the IP source address in the
header of the packet and compares it to a table of access control rules
to determine whether or not the packet is acceptable. These access control
rules are determined by the firewall administrator to say whether a packet
is acceptable or not. The rules can also state that certain actions must
take place when a particular criterion is met, including source or desti-
nation IP address or port number.
Packet filtering firewalls are fast, but they are fairly easy to get around.
One way to do so is via IP spoofing in which attackers use the IP address
of a trusted source as the source IP address in their packet and which
fools the firewall into thinking that the packets are actually from that
trusted source.
The other issue is that they still allow a direct connection between the
source and destination computers. Once an initial connection has been
approved by the firewall, the source computer is directly connected to
the destination computer, and all the computers that are connected are
vulnerable to potential attack.
Application-Level Proxy
This is a type of firewall that determines if a connection to a requested
application is permitted. Only connections for specified purposes, such
as Internet access or e-mail will be allowed. This allows administrators to
control what applications their systems’ computers will be used for.
An application-level proxy can be set up to only allow Web and e-
mail applications to gain access. It can also be programmed to stop all
packets with the destination port of 23 (Telnet). Any attempt by attackers
to telnet into the user’s computer will fail, because the application-level
firewall will recognize this telnet collection as a non-Web/e-mail applica-
tion and reject the information trying to enter the user’s computer.
This type of firewall is called an application-level proxy because, in
addition to screening incoming packets for the type of application it wants
to run on the user’s computer, it also serves as a proxy server. A proxy
can be thought of as a computer that sits between a computer and a Web
server, and acts as a middleman between the computer and the Web server.
The application-level proxy receives all communications requests from
the computers behind it (or inside the firewall). It then proxies the request;
it makes the requests on behalf of its constituent computer. What this
does is effectively hide the individual computers on the network behind
it. The targeted computers are protected from view because outside
sources never make direct contact with the computers; every communi-
cation is conducted through the proxy server.
Chapter 25
Background: OSI
Network Model
255
the router finds the address in its list, it sends the packet directly to the
destination node. If the router does not find the address in its list, it
forwards the packet onto another router to repeat the process.
The Physical Layer does not examine the binary information, nor does
it do any validation. It does participate in flow control and contention
resolution.
Some of the hardware devices that operate at this level are Ethernet
hubs, repeaters, modems, and wireless cards.
Chapter 26
Background: Proxy
Servers
261
SSL Proxy
These are also called HTTPS proxies and are designed to be able to
decrypt, apply policy, cache, and reencrypt SSL traffic. These are necessary
because HTTP proxies are not able to cache encrypted traffic, so there
was no benefit to be had for SSL applications using an HTTP proxy.
HTTPS proxies can monitor, control, and accelerate SSL traffic. They
can also screen for malware and apply content filtering to inhibit phishing,
spyware, and viruses that are hiding inside encrypted tunnels.
There are definite privacy concerns with having SSL proxies and the
sensitive data the HTTPS proxy may be capturing or revealing.
There is also a form of proxy that is also called an SSL proxy but
which really refers to a CGI Web proxy that is accessible via encrypted
SSL connections. SSL adds another level of security on top of the CGI
proxy system, lessening the chance of data interception.
Intercepting Proxy
These are proxies implemented to enforce acceptable network use policies
or to provide security, anti-malware, or caching services. A traditional Web
proxy is not transparent to the client application, which has to be con-
figured to use the proxy, but an intercepting proxy doesn’t require that
configuration.
When client applications require special configuration, users may reset
the client configurations to bypass the proxies if there are alternative
Open Proxy
An open proxy is one that will accept client connections from any IP
address and make connections to any Internet resource. Abuse of open
proxies is implicated in a significant portion of e-mail spam delivery.
Spammers will often install open proxies on systems they have com-
promised by means of viruses. Internet relay chat (IRC) abusers also
frequently use open proxies to cloak their identities.
Reverse Proxy
This is a proxy that is installed in the neighborhood of one or more Web
servers. All traffic that comes from the Internet to one of these Web servers
has to go through the reverse proxy server. These are installed for the
purposes of:
Split Proxy
A split proxy is a pair of proxies that are installed across two computers,
usually not in close physical proximity. This split install lets the two proxies
communicate with each other extremely efficiently, and this is ideal for
compressing data over a slow link such as wir eless or mobile data
connections. It also helps reduce issues associated with high latency (such
as with satellite Internet) where establishing a TCP connection is time
consuming.
Take the example of Web browsing: The user’s browser is pointed to
a local proxy, which then communicates with its other half at some remote
location. The remote server fetches the data, repackages it, and sends it
back to the user’s local proxy, which then unpacks the data and presents
it to the browser in the standard fashion.
Circumventor
A circumventor is a Web-based page that takes a site that is blocked and
circumvents the block through to an unblocked Web site so the user can
view the blocked Web page. A famous example is “elgoog” that allowed
users in China to use Google after it had been blocked there. Elgoog
differs from most circumventors in that it circumvents only one block.
The most common use of these is in schools where many blocking
programs block by site rather than by code. Students can access blocked
sites (messenger, games, chat rooms, porn, etc.) through a circumventor.
As fast as the filtering software blocks circumventors, others spring up.
Circumventors are also used by people who have been blocked from a
Web site.
The use of circumventors is usually fairly safe except that the circum-
ventor sites run by an untrusted third party can have hidden intentions
and risks, such as collecting personal information. As a result, users are
typically advised against running personal data such as credit card numbers
or passwords through a circumventor.
Anonymous
When a proxy server is used, all data sent to the service being used must
pass through the proxy server before being sent to the service, mostly in
unencrypted form. It is possible (and has been seen) that a malicious
proxy server can record everything sent to it, including unencrypted logins
and passwords.
By chaining proxies that do not reveal data about the original requestor,
it is possible to obfuscate activities from the eyes of the user’s destination.
But more traces will be left on the intermediate hops, which could be
used or offered up to trace the user’s activities. If the policies and
administrator of these other proxies are unknown, the user may fall victim
to a false sense of security just because those details are out of sight and
therefore out of mind.
Be careful when using proxy servers. Only use proxies of known
integrity (the owner is known and trusted, has a clear privacy policy,
etc.), and never use questionable proxies. If there is no choice but to use
unknown proxy servers, do not pass any private information (unless it is
properly encrypted) through the proxy.
More an inconvenience than a risk, proxy users may find themselves
being blocked from certain Web sites as numerous forums and Web sites
block IP addresses from proxies known to have spammed or trolled the
site.
Chapter 27
TCP
TCP is a Connection-Oriented Protocol that operates at the transport layer
of the Open System Interconnection (OSI) Model. It attempts to guarantee
delivery of packets by generating and comparing a sequence of numbers
to see what data has been sent and received. In cases where data loss
occurs, a resend can be requested. It can sense network delay patterns
and can throttle data to dynamically prevent bottlenecks. TCP also uses
a set of flags to manage the connection.
TCP delivers data as a series of packets that are individually numbered
with a sequence number and passes them to IP for delivery, where the
sequence numbers allow the packets to be reassembled at their destination.
TCP also allows packets whose sequence numbers are not acknowledged
267
TCP Flags
These are the most common flags used in the TCP Packet’s “Flags” field,
and their basic meaning is as follows:
Sequence Number
Acknowledgement Number
Options + Padding
Data
IP
IP is a protocol that takes place at the network layer of the OSI Model.
It is a connectionless protocol and is used to carry data, but because it
has no mechanism to assure data delivery, it is used along with a protocol
that sits on the transport layer such as TCP.
IP headers contain a 32-bit address that identify the sending and receiving
hosts, and routers use these addresses to select the appropriate path for
the packet. Because of the possibility of IP spoofing, the validity of the
source address should always be questioned, and another method of authen-
tication should be used to at least corroborate the IP header information.
Source Address
Destination Address
Options
Data
Source Address
Destination Address
Data
IPv4
Packet Fields
Addresses
Logical addresses appear as four sets of numbers that can be up to three
digits long and are separated by periods. IP addresses have an order, i.e.,
from left to right. These numbers have a minimum value of 0 and a
maximum value of 255, and leading zeros are not used.
The first section refers to a router, which is either the top level router
in the network or the top level router in this section of the network. All
addresses beginning with the same number are managed by the same
router (i.e., addresses XXXX.0.0.1 through XXXX.255.255.255 are all man-
aged by the same router). If you have a routed network, you must have
a minimum of one router, but more routers may exist on a larger network.
Fragmentation Variables
These are the fragmentation variables used in IP packets to give informa-
tion about the fragmentation.
IPv6
Packet Fields
Addresses
Iv6 addressing is designed to allow many more addresses than the address-
ing scheme of IPv4 by using hexadecimal numbers separated by colons.
An IPv6 address may look like this:
1844:3FFE:300:1:4389:EEDF:45AB:1029
IPv6 is still being developed and has some remaining privacy concerns
focused around certain items such as the address space in some cases
UDP
UDP stands for User Datagram Protocol and is faster than TCP, but less
reliable. It is often used when zero percent packet loss is not an important
factor. Because there is no handshake or sequence tracking, it’s a lot
easier to spoof UDP packets than TCP. This is often used in online games.
ICMP
ICMP stands for Internet Control Message Protocol. It’s basically a protocol
designed for testing and debugging and which runs on top of a Network
Protocol. It serves as a way to get information from a router or network
dynamically. Ping uses ICMP. Routers use ICMP to determine if a remote
host is reachable. If there is no path to a remote host, an ICMP packet
is generated to say so. It’s also used to determine the PMTU, and if a
router needs a smaller packet but the “no fragmentation” flag is set, it
can use ICMP to request smaller size packets from the host.
To prevent some of the vulnerabilities of ICMP from being exploited,
sometimes a decision is made to simply turn off all ICMP, but this has an
unfortunate side effect of allowing packets to be dropped without notice.
Most firewalls allow for selective dropping of ICMP messages as a better
way to limit abuse of items like Ping.
There is the possibility of ICMP Source Quench messages being gen-
erated when a router is bottlenecked and has to buffer too many packets.
This message tells the host to slow down the rate of transmission. This
isn’t often used though.
Traceroute is another tool that uses ICMP to map networks by sending
out packets with small TTL values and then watching for the ICMP timeout
messages.
ARP
ARP stands for Address Resolution Protocol, and it enables hosts to convert
a 32-bit IP address to a 48-bit Ethernet address (the MAC address). ARP
broadcasts an ARP packet to all hosts attached to an Ethernet network
that contains the desired destination IP address. Ideally all hosts without
the matching IP address ignore the packet, and only the one with the
RARP
This is Reverse ARP, and it allows a host to discover its IP address by
broadcasting its physical address, and the RARP server responds with an
IP address.
BOOTP
This is the Bootstrap Protocol, and it allows diskless network clients to
learn their IP addresses and the location of their boot files. BOOTP is
done at the application layer of the OSI model via UDP.
DHCP
DHCP stands for Dynamic Host Configuration Protocol. It’s an extension
of BOOTP, and provides a method to dynamically assign IP addresses
and configurations parameters to other IP hosts or clients in an IP network.
It allows a host to automatically allocate reusable IP addresses and
additional configuration parameters for client operations. DHCP allows
clients to obtain an IP address from the pool of reusable IP addresses for
a fixed length of time called a lease period. When the lease expires, the
DHCP server can either assign that same IP address to a different computer
in the network, or the host that had that IP prior to the lease expiration
can renew the lease for another period.
Chapter 28
Goals
Test planning itself is an often arduous task that seeks to achieve the
following goals:
275
Benefits of a TCO
Using the TCO process has multiple compelling benefits to an entire
product team, not merely to the testers. A few of these benefits are:
Read any specifications you may have, including those from prior
releases.
Talk to program managers and developers, if possible. Most of
them are very willing to discuss their area and give you a tour of
Functionality
Physical areas
Web pages
Server states
API methods
Toaster
Doneness dial
Start lever
Toast slots
Heat coils
Power cord
Outside casing
Notepad
Menu
Document pane
Window appearance
At this point, you are simply trying to define the big buckets around
which to organize the TCO itself.
Toaster
Doneness dial
On
Set at 1
Set at 2
Off
Start lever
Up
Down
Toast slots
Left
Right
Both
Notepad
Menu
File
New
Click
Shortcut (Ctrl + N)
Open
Save
Edit
Format
View
Help
Document pane
Window appearance
Notepad
Files
Opening
Formats
Sizes
Storage media
Storage location
Saving
Save
Save as
Documents
Creating
Editing
Printing
If you have a statement where you do not know the expected behavior,
this should be clearly marked and followed up to obtain the expected
behavior. If this was missing or unclear from the specification, the spec-
ification should be updated. If the developers need to provide the answer,
follow up needs to be done with them. This clarification is another valuable
benefit of writing TCOs.
Several important things to remember about these statements of behav-
ior are:
You will often have several statements for a single action. The first
of the two examples earlier may have several more statements that
indicate any other actions that occur when Submit is clicked. These
may verify things like the file date, the file icon, if a new document
is opened at the same time the file is created, etc.
The predictive statements of behavior should be binary — there
is only a yes or no answer — no gray area. The case either passes
or fails. That’s why each statement only tests one item, even if the
behavior preceding the “x happens” really causes more than one
event to occur. The granularity is built in, and the ambiguity level
is far less.
If, however, you have multiple statements that are related, you can
combine these into one scenario when the test pass is underway,
as long as each statement is verified individually for a true/false
or pass/fail result.
Data types
Permission levels
Document types
Protocol types
For example, for text input fields I may decide that all alpha strings
are equivalent and instead of calling out the exact string to input, I will
use something like this:
Note that the input is different but equivalent, but the expected result
is equivalent as well. In this case, I would have a separate statement of
behavior that handled failure cases such as a 0 char string or a 256+ char
string.
Exceptions in equivalency classes can be called out specifically or
made separate equivalency classes of their own. So the above list may
coexist in a TCO with a case that takes into account reserved words so
certain letter combinations are disallowed. In this case, I would call out
each specifically disallowed combination as a member of an equivalency
class because the result should be the same. Then write statements of
behavior around that equivalency class. Note that this is a greatly simplified
example, as are all examples in this section.
This process does serve to compact a TCO without sacrificing much
in the way of readability and usability. It has often been useful in pointing
out more clearly to developers where there is a disparity between what
the expected equivalencies are and what was actually coded.
This has also increased automateability of TCOs in the past for me
because a single case can be easily shown to have variations of it with
the same expected outcome, and the job of whomever has to write the
automation is simplified by having the variations all in one place.
Some other simple examples are:
Toaster
Types of bread
Wall outlets
Doneness settings
Countertop surfaces
Toaster positions/orientation
Nonbread items
Notepad
Types of files
General data sets
Alpha
Alphanumeric
Unicode
Extended characters
Fonts
Navigation methods
Look carefully at the pros and cons of using equivalency classes before
you decide whether to use them or not.
TCO Formats
As I mentioned, TCOs can be written and stored in just about any format,
but the real key is to let the TCO dictate the format instead of attempting
to cram the TCO into a format unsuited for it.
It is important to keep only one copy of a TCO for a given area and
release. If you have multiple copies of a TCO with different revisions,
etc., it will be an endless source of confusion. I highly recommend keeping
the TCO where it is viewable by anyone who wishes to review it, but
limit the number of people who can modify it.
Some formats are:
TCO Maintenance
The more up-to-date a TCO is, the more accurate all the information
derived from it will be — including the ability to hand it off to another
Test runs
New cases
Product changes
TCO to Scenario
To make running cases from a TCO easier, I mentioned that you can
string together individual test cases in a logical order to cr eate test
scenarios. In this type of situation, each statement of behavior from the
TCO becomes a validation point in the scenario.
An example of this would be the following set of predictive statements:
These could be combined into a scenario where the tester enters “xyz”
in field A, clicks submit and then verifies the file is created. The file
window is opened with the title of “xyz.doc” and the default template font.
The three cases remain three separate statements of behavior and are
said to pass/fail individually, but the tester isn’t running through the same
steps three separate times. It is simply a matter of expedience.
Additional Sources of
Information
Recommended Reading
Alberts, C. and Dorofee, A. Managing Information Security Risks. Addison-Wesley,
Boston, MA, 2002.
Chase, S.G. and Thompson, H.H. The Software Vulnerability Guide. Charles River
Media, Hingham, MA, 2005.
Erickson, J. Hacking: The Art of Exploitation. No Starch Press, San Francisco, CA,
2003.
Fadia, A. The Unofficial Guide to Ethical Hacking, 2nd ed. Thomson Course
Technology, Boston, MA, 2006.
Gallagher, T., Jeffries, B., and Landauer, L. Hunting Security Bugs, Microsoft Press,
Redmond, WA, 2006.
McGraw, G. Software Security: Building Security In. Pearson Education, Boston,
MA, 2006.
Swiderski, F. and Snyder, W. Threat Modeling. Microsoft Press, Redmond, WA, 2004.
287