Sunteți pe pagina 1din 32

AVOIDING THE

TOP 10
SOFTWARE
SECURITY
DESIGN FLAWS
Iván Arce, Kathleen Clark-Fisher, Neil Daswani, Jim DelGrosso, Danny Dhillon,
Christoph Kern, Tadayoshi Kohno, Carl Landwehr, Gary McGraw, Brook Schoenfield,
Margo Seltzer, Diomidis Spinellis, Izar Tarandach, and Jacob West

read on
CONTENTS

Introduction...................................................................................................................................................... 5
Mission Statement........................................................................................................................................... 6
Preamble............................................................................................................................................................ 7
Earn or Give, but Never Assume, Trust.................................................................................................... 9
Use an Authentication Mechanism that Cannot be Bypassed or Tampered With..................... 11
Authorize after You Authenticate............................................................................................................ 13
Strictly Separate Data and Control Instructions, and Never Process Control Instructions
Received from Untrusted Sources............................................................................................................ 14
Define an Approach that Ensures all Data are Explicitly Validated.............................................. 16
Use Cryptography Correctly...................................................................................................................... 19
Identify Sensitive Data and How They Should Be Handled............................................................... 21
Always Consider the Users.........................................................................................................................22
Understand How Integrating External Components Changes Your Attack Surface................25
Be Flexible When Considering Future Changes to Objects and Actors .........................................28
Get Involved..................................................................................................................................................... 31

2014 2
IEEE Computer Society Center for Secure Design Participants
Iván Arce, Sadosky Foundation
Neil Daswani, Twitter
Jim DelGrosso, Cigital
Danny Dhillon, RSA
Christoph Kern, Google
Tadayoshi Kohno, University of Washington
Carl Landwehr, George Washington University
Gary McGraw, Cigital
Brook Schoenfield, McAfee, Part of Intel Security Group
Margo Seltzer, Harvard University
Diomidis Spinellis, Athens University of Economics and Business
Izar Tarandach, EMC
Jacob West, HP

Staff
Kathleen Clark-Fisher, Manager, New Initiative Development
Jennie Zhu-Mai, Designer

2014 3
Public Access Encouraged
Because the authors, contributors, and publisher are eager to engage the broader community in
open discussion, analysis, and debate regarding a vital issue of common interest, this document
is distributed under a Creative Commons BY-SA license. The full legal language of the BY-SA
license is available here: http://creativecommons.org/licenses/by-sa/3.0/legalcode.

Under this license, you are free to both share (copy and redistribute the material in any medium
or format) and adapt (remix, transform, and build upon the material for any purpose) the
content of this document, as long as you comply with the following terms:

Attribution — You must give appropriate credit, provide a link to the license, and indicate if
changes were made. You may use any reasonable citation format, but the attribution may not
suggest that the authors or publisher has a relationship with you or endorses you or your use.

“ShareAlike” — If you remix, transform, or build upon the material, you must distribute your
contributions under the same BY-SA license as the original. That means you may not add any
restrictions beyond those stated in the license, or apply legal terms or technological measures
that legally restrict others from doing anything the license permits.

Please note that no warranties are given regarding the content of this document.  Derogatory
use of the content of this license to portray the authors, contributors, or publisher in a
negative light may cancel the license under Section 4(a). This license may not give you all of the
permissions necessary for a specific intended use.

About the IEEE Computer Society


The IEEE Computer Society is the world’s leading computing membership organization and
the trusted information and career-development source for a global workforce of technology
leaders. The Computer Society provides a wide range of forums for top minds to come together,
including technical conferences, publications, and a comprehensive digital library, unique
training webinars, professional training, and the TechLeader Training Partner Program to help
organizations increase their staff’s technical knowledge and expertise. To find out more about
the community for technology leaders, visit http://www.computer.org.

Published by the IEEE Computer Society.

2014 4
INTRODUCTION
Most software that has been built and released typically
comes with a set of defects—implementation bugs and de-
sign flaws. To date, there has been a larger focus on find-
ing implementation bugs rather than on identifying flaws.

In 2014, the IEEE Computer Society, the leading association


for computing professionals, launched a cybersecurity ini-
tiative with the aim of expanding and escalating its ongo-
ing involvement in the field of cybersecurity. The first step
for the initiative was to launch the IEEE Computer Society
Center for Secure Design. The Center intends to shift some
of the focus in security from finding bugs to identifying
common design flaws in the hope that software architects
can learn from others’ mistakes. To achieve this goal, the
Center brought people together from different organiza-
tions at a workshop in early 2014.

At the workshop, participants discussed the types of flaws


they either identified in their own internal design reviews,
or that were available from external data. They arrived
at a list they felt were the top security design flaws. Many
of the flaws that made the list have been well known for
decades, but continue to persist. In this document is the
result of that discussion—and how to avoid the top 10
security flaws.

2014 5
MISSION STATEMENT
The IEEE Computer Society’s Center for Secure Design (CSD) will gather software
security expertise from industry, academia, and government. The CSD provides
guidance on:

• Recognizing software system designs that are likely vulnerable to compromise.


• Designing and building software systems with strong, identifiable security
properties.
The CSD is part of the IEEE Computer Society’s larger cybersecurity initiative,
launched in 2014.

2014 6
PREAMBLE
The goal of a secure design is to enable in a fielded system with major con-
a system that supports and enforces sequences. A bug is an implemen-
the necessary authentication, autho- tation-level software problem. Bugs
rization, confidentiality, data integ- may exist in code but never be exe-
rity, accountability, availability, and cuted. A flaw, by contrast, is a prob-
non-repudiation requirements, even lem at a deeper level. Flaws are often
when the system is under attack. much more subtle than simply an off-
by-one error in an array reference or
While a system may always have
use of an incorrect system call. A flaw
implementation defects or “bugs,” we
might be instantiated in software
have found that the security of many
code, but it is the result of a mistake
systems is breached due to design
or oversight at the design level. For
flaws or “flaws.” We believe that if
example, a number of classic flaws
organizations design secure systems,
exist in error-handling and recovery
which avoid such flaws, they can
systems that fail in an insecure or
significantly reduce the number and
inefficient fashion.
impact of security breaches.
In this document, a group of software
While bugs and flaws are both differ-
security professionals have contrib-
ent types of defects, we believe there
uted both real-world data and ex-
has been quite a bit more focus on
pertise to identify some of the most
common bug types than there has
significant design flaws that have led
been on secure design and the avoid-
to security breaches over the past
ance of flaws. Before we discuss our
several years. The list of issues pre-
contribution in this document, we
sented here is focused entirely on the
briefly discuss the differences be-
most widely and frequently occurring
tween bugs and flaws.
design flaws as compiled from data
Both bugs and flaws are types of provided by the member organiza-
defects. A defect may lie dormant in tions of the IEEE Computer Society
software for years only to surface Center for Secure Design (CSD).

2014 7
2014 8
EARN OR G
EARN OR GIVE,
BUT NEVER ASSUME, TRUST
Software systems comprising more than just a automobiles, pacemakers, gaming systems, or
single monolithic component rely on the compo- home appliances. Even calls into your APIs from
sition and cooperation of two or more software business partners could be considered client
tiers or components to successfully accomplish software in some sense.
their purpose. These designs often depend on
When untrusted clients send data to your sys-
the correct functioning of the existing parts.
tem or perform a computation on its behalf, the
They will be inherently insecure if any of those
data sent must be assumed to be compromised
parts are run in a potentially hostile environ-
until proven otherwise. In some cases you may
ment, such as a user’s desktop computer, an un-
be able to guarantee that the client is, indeed,
managed device, or a runtime or sandbox that
who it attests it is, or that the business logic it
can be tampered with by an attacker.
contains has not been altered or circumvented,
Offloading security functions from server to or that external factors have not influenced
client exposes those functions to a much less the integrity of the computations it performed.
trustworthy environment, which is one of the But these situations are not the rule, and these
most common causes of security failures predi- underlying assumptions can change when new
cated on misplaced trust. vulnerabilities are discovered. It is safer in the
long run to design a software system under the
Designs that place authorization, access control,
assumption that components running on any
enforcement of security policy, or embedded
platform whose integrity can’t be attested are
sensitive data in client software thinking that
inherently not trustable, and are therefore un-
it won’t be discovered, modified, or exposed
suitable for performing security sensitive tasks.
by clever users or malicious attackers are in-
herently weak. Such designs will often lead to If, nonetheless, security operations must be off-
compromises. loaded to components running on an untrusted
platform, the design should impose extreme
Classic examples of software where trust is
caution on how the computation and its output
misplaced include a web browser or a thick-­
are treated.
client application, but there are many more
examples of client software. They include appli- Common weaknesses related to client trust
cations running on a mobile device, or embed- reside in various parts of the system, but
ded software that might be found in modern tend to share a sensibility. A designer might

2014 9
Make sure all data received from
an untrusted client are properly
validated before processing.

(incorrectly) assume that server APIs will al- consulted if the system requires a client com-
ways be called in the same order every time. ponent with a level of protection that cannot be
He or she might believe that the user interface trivially compromised.
is always able to restrict what the user is able
If IP or sensitive material must be stored or sent
to send to the server. He could try to build the
to the client, the system should be designed
business logic solely on the client side, or at-
to be able to cope with potential compromise.
tempt to actually store a secret in the client.
For instance, the same shared secret or other
And, of course, a designer can run into danger
cryptographic material shouldn’t be used on all
by thinking that any intellectual property (IP)
the clients. Make the validity of what is offload-
sent to the client can be protected through tech-
ed to the client limited in time, set expiration
nical means.
dates for data stored in the client, watermark
Though security-aware development strategies IP, and double-check client computations that
cannot eliminate all these problems (or even are security sensitive. On a related note, design
resolve conflicts in goals for the software being your system to work in a limited fashion even
developed), there are useful ways to minimize when one or many clients have been completely
the potential risks. For example, some orga- compromised.
nizations will claim a real business need to
Finally, make sure all data received from an
store intellectual property or other sensitive
untrusted client are properly validated before
material on the client. The first consideration
processing. Follow the guidance described in the
is to confirm that sensitive material really does
“Define an Approach that Ensures All Data Are
need to be stored on the client. When it truly is
Explicitly Validated” section.
necessary to do so, various binary protection
mechanisms can delay the leaking of sensitive When designing your systems, be sure to con-
material. Possible techniques to consider in- sider the context where code will be executed,
clude obfuscation or anti-debugging (although where data will go, and where data entering
the strength of these protections vary widely, your system comes from. Failing to consider
so designers should understand the level of these things will expose you to vulnerabilities
protection actually achieved with each tool or associated with trusting components that have
technique). Subject matter experts should be not earned that trust.

2014 10
USE AN AU
USE AN AUTHENTICATION
MECHANISM THAT CANNOT BE
BYPASSED OR TAMPERED WITH
Authentication is the act of validating an en- authentication mechanism, but allows a user to
tity’s identity. One goal of a secure design is to access the service by navigating directly to an
prevent an entity (user, attacker, or in general a “obscure” URL (such as a URL that is not direct-
“principal”) from gaining access to a system or ly linked to in a user interface, or that is simply
service without first authenticating. Once a user otherwise “unknown” because a developer has
has been authenticated, a securely designed sys- not widely published it) within the service with-
tem should also prevent that user from chang- out also requiring an authentication credential,
ing identity without re-authentication. is vulnerable to authentication bypass.
Authentication techniques require one or more The use of authentication techniques that
factors such as: something you know (e.g., a don’t fall into the category of something you
password), something you are (e.g., biometrics know, something you are, or something you
such as fingerprints), or something you have have may also allow users to access a system
(e.g., a smartphone). Multi-factor (sometimes or service they shouldn’t. System designers
referred to as N-factor) authentication refers should beware of authentication techniques
to the technique of requiring multiple distinct that depend on assumptions about sole pos-
factors to prove your identity. Authentication session of resources that may actually be
via a cookie stored on a browser client may be shared. For example, authentication mech-
sufficient for some resources; stronger forms anisms that identify a user by their IP ad-
of authentication (e.g., a two-factor method) dress wouldn’t be useful if the addresses were
should be used for more sensitive functions, shared among different users at different
such as resetting a password. times; for instance, via an address-sharing/
configuration protocol such as DHCP.
In general, a system should consider the
strength of the authentication a user has Even when IP addresses are tied to particular
provided before taking action. Note also that devices, authentication based on device ad-
authentication encompasses more than just dresses is not a substitute for user authenti-
human-computer interaction; often, in large cation, as IP addresses can be spoofed and are
distributed systems, machines (and/or pro- not necessarily associated with specific users
grams running on those machines) authenticate for a long time. As another concrete illustra-
themselves to other machines. tion, authentication mechanisms that rely on
a computer’s MAC address, which can easily be
The ability to bypass an authentication mech-
changed or spoofed, can result in unauthorized
anism can result in an unauthorized entity
access if the device assumed to be identified
having access to a system or service that it
with that individual is lost or stolen.
shouldn’t. For example, a system that has an

2014 11
Typically, the act of authentication results in the their existing password again to confirm their
creation of a token, capability (as often referred transaction request, even though the user may
to in operating systems literature), or ticket already be authenticated.
representing a principal that is used throughout
The design of a system’s re-authentication
the system or service. If such tokens (or creden-
scheme, and when and how often to ask a user
tials) are deterministically derived from easy-
to re-enter their password, needs to be mind-
to-obtain information, such as a user name,
ful of not only security, but also usability and
then it becomes possible to forge identities,
convenience. Asking users to frequently re-enter
allowing users to impersonate other users.
their password can be damaging to security, as
Credentials must not be easy to forge. Upon it trains people’s muscle memory to enter their
successful authentication, the user may be pro- password every time they see a prompt and sets
vided with an authentication credential, token, them up as easy phishing targets.
or ticket, which can be provided back to the
By far the most common authentication mech-
system so that the user does not need to be re-­
anism remains the password. Using passwords
authenticated for every request or transaction
requires that the system or service have a
made via the system. At the same time, if it is
mechanism to associate a given password with
possible for an attacker to forge the authentica-
a particular user. If this information is not prop-
tion credential, token, or ticket, the attacker can
erly stored, it may be possible for agents other
bypass the authentication mechanism. System
than the user to obtain access to them. Storing
designers can reuse time-tested authentication
such information securely is non-trivial, and
mechanisms such as Kerberos instead of build-
the reader is referred to the use of an applied
ing a new one. Alternatively, system designers
cryptography expert as noted in the “Using
are encouraged to use cryptography correctly
Cryptography Correctly” section for guidance.
(see the corresponding “Using Cryptography
Just as it is advisable to reuse tried and tested
Correctly” section later in this document) in
cryptographic algorithms, it is also advisable to
constructing authentication credentials, tokens,
re-use already built and tested password man-
and tickets.
agement systems instead of building new ones.
If an authentication system does not limit the
It’s preferable to have a single method, compo-
lifetime of an authentication interaction, then
nent, or system responsible for authenticating
it may inadvertently grant access to a user to
users. Such a single mechanism can serve as a
whom it should not. For example, imagine a user
logical “choke point” that cannot be bypassed.
who logs into a public terminal and then walks
Much as in code reuse, once a single mechanism
away without logging out (which should termi-
has been determined to be correct, it makes
nate the session). A second user using the public
sense to leverage it for all authentication.
terminal might now be able to use the system
or service as the first user. A properly designed To summarize, authentication mechanisms are
authentication system may automatically log critical to secure designs. They can be suscep-
the user out after a period of inactivity. tible to various forms of tampering and may
potentially be bypassed if not designed correct-
Authentication system designs should automati-
ly. We recommend that a single authentication
cally provide a mechanism requiring re-authen-
mechanism leverage one or more factors as per
tication after a period of inactivity or prior to
an application’s requirements, that it serve as a
critical operations. As an example, upon receiv-
“choke point” to avoid potential bypass, and that
ing a transaction request to conduct certain
authentication credentials have limited life-
sensitive actions such as changing a password,
times, be unforgeable, and be stored so that if
or transferring funds to another financial insti-
the stored form is stolen, they cannot easily be
tution, a system could ask the user to re-enter
used by the thief to pose as legitimate users.

2014 12
AUTHORIZ
AUTHORIZE AFTER
YOU AUTHENTICATE
While it is extremely important to assess a us- by authenticated users exercising out-of-date
er’s identity prior to allowing them to use some authorizations.
systems or conduct certain actions, knowing the
For particularly sensitive operations, authoriza-
user’s identity may not be sufficient before de-
tion may need to invoke authentication. Although
ciding to allow or disallow the user to perform
authorization begins only after authentication
certain actions. For instance, once an automatic
has occurred, this requirement is not circular.
teller machine (ATM) authenticates a user via
Authentication is not binary—­users may be re-
something they have (a debit card), and some-
quired to present minimal (such as a password) or
thing they know (a PIN), that does not necessar-
more substantial (e.g. biometric or token-based)
ily mean that user is allowed to withdraw an
evidence of their identity, and authentication in
arbitrary amount of cash from their account.
most systems is not continuous—­a user may
Most users may be authorized to withdraw up
authenticate, but walk away from the device or
to a certain limit per day, or to conduct certain
hand it to someone else. Hence authorization of a
actions (view balance) but not others (transfer
specially sensitive operation (for example, trans-
funds outside the bank) from the ATM.
ferring a sum of money larger than a designated
Authorization should be conducted as an explic- threshhold) may require a re-authentication or
it check, and as necessary even after an initial a higher level of authentication. Some policies re-
authentication has been completed. Authoriza- quire two people to authorize critical transactions
tion depends not only on the privileges associ- (“two-person rule”). In such cases, it is important
ated with an authenticated user, but also on the to assure that the two individuals are indeed
context of the request. The time of the request distinct; authentication by password is insufficient
and the location of the requesting user may for this purpose.
both need to be taken into account.
Finally, just as a common infrastructure (e.g.,
Sometimes a user’s authorization for a system system library or back end) should be responsi-
or service needs to be revoked, for example, ble for authenticating users, so too should com-
when an employee leaves a company. If the mon infrastructure be re-used for conducting
authorization mechanism fails to allow for such authorization checks.
revocation, the system is vulnerable to abuse

2014 13
STRICTLY S
STRICTLY SEPARATE DATA
AND CONTROL INSTRUCTIONS,
AND NEVER PROCESS CONTROL
INSTRUCTIONS RECEIVED
FROM UNTRUSTED SOURCES
Co-mingling data and control instructions in combining untrusted data with trusted control
a single entity, especially a string, can lead to instructions, injection vulnerabilities arise if
injection vulnerabilities. Lack of strict sepa- the untrusted data are insufficiently validated
ration between data and code often leads to or escaped. In that situation, an attacker may
untrusted data controlling the execution flow be able to supply data crafted such that when
of a software system. This is a general prob- the resulting expression is processed, parts of
lem that manifests itself at several abstraction the data are parsed and interpreted as control
layers, from low-level machine instructions and (rather than uninterpreted data, as intend-
hardware support to high-level virtual machine ed). Experience has shown that use of injec-
interpreters and application programming tion-prone APIs incurs significant risk that in-
interfaces (APIs) that consume domain-specific jection vulnerabilities will indeed be introduced.
language expressions. Examples of such vulnerabilities include SQL
query injection, cross-site JavaScript injection,
“At lower layers, lack of strict segregation be-
and shell command injection.
tween data and control instructions can mani-
fest itself in memory-corruption vulnerabilities, At lower levels, software platforms can utilize
which in turn may permit attacker-controlled hardware capabilities to enforce separation of
modifications of control flow or direct execution code and data. For example, memory access
of attacker-controlled data as machine or byte- permissions can be used to mark memory that
code instructions.” contains only data as non-executable and to
mark memory where code is stored as execut-
At higher levels, co-mingling of control and data
able, but immutable, at runtime. Modern oper-
often occurs in the context of runtime inter-
ating systems take advantage of such hardware
pretation of both domain-specific and general-­
features to implement security mechanisms
purpose programming languages. In many lan-
that harden the entire software stack against
guages, control instructions and data are often
multiple forms of attack. Software designs that
segregated using in-band syntactic constructs,
ignore the principle of strict separation between
such as quoting and escaping. If software as-
data and code, or that blur the line that dis-
sembles a string in a parseable language by
tinguishes one from the other, are inherently

2014 14
less secure because they undermine or directly therefore tempting. It is also very dangerous.
invalidate low-level security mechanisms. If attackers can influence even part of a string
that is evaluated and that substring is not ap-
When designing languages, compilers, virtual
propriately validated or encoded, they can often
machines, parsers and related pieces of infra-
execute arbitrary code as a result.
structure, consider control-flow integrity and
segregation of control and potentially untrusted Query languages. Ensuring that appropriate
data as important design goals. validation or escaping is consistently applied in
all code that interfaces with the query API is a
When designing APIs (both general-purpose or
difficult and error-prone process; implementing
public interfaces as well as those that are do-
that functionality repeatedly increases the risk
main- or application-specific), avoid exposing
of injection vulnerabilities. Use or develop an
methods or endpoints that consume strings in
API that mediates between application code and
languages that embed both control and data.
raw query-language based interfaces (such as
Prefer instead to expose, for example, methods
SQL, LDAP) and exposes a safer API. Avoid code
or endpoints that consume structured types
that constructs queries based on ad-hoc string
that impose strict segregation between data
concatenation of fixed query stanzas with po-
and control information.
tentially untrusted data.
When designing applications that rely on exist-
Exposed reflection. Many programming lan-
ing APIs, avoid APIs that mingle data and con-
guages provide facilities that allow programs
trol information in their parameters, especially
to reflectively inspect and manipulate objects,
when those parameters are strings. If there is
as well as to invoke methods on objects. Use
no choice in underlying APIs (for example, if the
of reflection can be very powerful, and often
use of a relational database requires interfacing
permits the implementation of complex features
through a SQL query API), it is often desirable
using minimal code. For example, implementa-
to encapsulate the injection-prone interface
tions of object serializers and deserializers used
and expose its functionality to application code
to marshal and unmarshal in-memory objects
through a higher-level API that enforces strict
into and from a serialized form for persistence
segregation between control statements and
or network transfer can often be implemented
potentially untrusted data.
very effectively using reflection.
A design that relies on the ability to transform
However, as with eval, use of reflection can be
data into code should take special care to vali-
a risky design choice. Unless inputs processed
date the data as fully as possible and to strictly
with reflection are very carefully controlled,
constrain the set of computations that can be
bugs can arise that may permit the attacker to
performed using data as an input language.
execute arbitrary code in the receiving process.
Specific areas of concern include the eval func-
It is often preferable to consider alternative,
tion, query languages, and exposed reflection.
safer designs. For example, consider a design
Eval. Many interpreted languages (such as Py- based on code-generation: a code-generated,
thon, Ruby, and JavaScript) have an eval func- reflection-free object serializer/deserializer is
tion that consumes a string consisting of syntax restricted to behaviors allowed by the explicitly
in that language and invokes the language’s generated code. This code is in turn generated
interpreter on the string. Use of a language’s at build/compile-time, where the code-genera-
eval facility can permit the implementation of tion process cannot be influenced by malicious
very powerful features with little code, and is inputs.

2014 15
DEFINE AN
DEFINE AN APPROACH
THAT ENSURES ALL DATA
ARE EXPLICITLY VALIDATED
Software systems and components commonly • It is desirable for web applications to utilize a
make assumptions about data they operate on. mechanism (such as a request filter or inter-
It is important to explicitly ensure that such as- ceptor facility provided by the underlying web
sumptions hold: vulnerabilities frequently arise application framework) to centrally intercept
from implicit assumptions about data, which all incoming requests, and to apply basic in-
can be exploited if an attacker can subvert and put validation to all request parameters.
invalidate these assumptions. • Implementations of communication proto-
cols might centrally validate all fields of all
As such, it is important to design software sys-
received protocol messages before any actu-
tems to ensure that comprehensive data valida-
al processing takes place.
tion actually takes place and that all assump-
tions about data have been validated when they • Systems consuming complex data formats
are used. (such as XML documents, image file for-
mats, or word processing file formats) might
It is furthermore desirable to design software to perform parsing, syntactic validation, and
make it feasible for a security reviewer to effec- semantic validation of input files in a dedi-
tively and efficiently reason about and verify cated validation module whose output is a
the correctness and comprehensiveness of data validated internal object representation of
validation. Designing for verifiability should the input document. Parsers and validators
take into account that code typically evolves must themselves be designed to robustly
over time, resulting in the risk that gaps in data cope with potentially malicious or mal-
validation are introduced in later stages of the formed inputs.
software life-cycle.
Transform data into a canonical form, before
Design or use centralized validation mecha- performing actual syntactic or semantic vali-
nisms to ensure that all data entering a system dation. This ensures that validation cannot be
(from the outside) or major component (from bypassed by supplying inputs that are encoded
another component of the same system) are in a transport encoding, or in a possibly invalid
appropriately validated. For example: non-canonical form.

2014 16
Use common libraries of validation primitives, between affiliated organizations, and which
such as predicates that recognize well-formed does not perform the same level of data
email addresses, URLs, and so forth. This en- validation as the web front end, based on the
sures that all validation of different instances possibly invalid assumption that such files
of the same type of data applies consistent are “trusted”).
validation semantics. Consistent use of com- • It permits local reasoning about the cor-
mon validation predicates can also increase the rectness of a component; since assumptions
fidelity of static analysis. Validation should be are explicitly checked and stated, a human
based on a whitelisting approach, rather than reviewer or static analysis tool can truly as-
blacklisting. sume the assumptions actually hold, without
having to consider all (possibly very com-
Input validation requirements are often
plex) data flows into the component.
state-dependent. For instance, in a stateful pro-
tocol, the set of valid values of a particular pro- Use implementation-language-level types to
tocol message field (and hence the corresponding capture assumptions about data validity. For
validation requirements) may depend on the pro- example, an application that receives as an input
tocol’s state. In such scenarios, it can be benefi- a date and time in string representation should
cial to design the protocol implementation’s input validate that this input indeed consists of a well-
validation component to be itself state-aware. formed string representation of a date and time
(for example, in ISO 8601 format). It is desirable
Explicitly re-validate assumptions “nearby”
to implement validation by parsing the input
code that relies on them. For example, the entry
into a typed representation (such as a “date
points of a web application’s business-logic layer
and time” type provided in many programming
should explicitly re-state, and check as precon-
language’s standard libraries), and to use that
ditions, all assumptions that it relies on. Liberal
typed representation (and not the original input
use of precondition checks in the entry points
string) throughout the program. Downstream
of software modules and components is highly
components are then relieved from having to
recommended. Such precondition checks should
consider the possibility that a provided value
never fail during execution of the deployed
(such as a date) is syntactically invalid, and can
application, assuming the higher layers of the
focus on only checking additional preconditions
application have correctly validated external
that are not supported by the type’s contract
inputs. And as such, it is unnecessary for the
(e.g., that a date is not in the future).
business-logic layer to produce friendly error
messages should such a precondition fail. Nev- Various problems arise from failure to address
ertheless, re-validation of data supplied to the this security design principle.
business-logic layer provides two benefits:
• Injection vulnerabilities can arise if un-
• It protects against vulnerabilities that arise trusted data are used without validation in
from insufficient input validation in a high- certain contexts, such as APIs and platform
er layer (since the developer of the higher features that process and interpret strings
layer may not have a full understanding of with certain semantics. For example:
all the requirements and assumptions of the • Using an externally controlled string as a
lower layer), or from additional data-flows component of a file path can lead to path
that were not considered during the initial traversal vulnerabilities, unless the appli-
security design (e.g., a data-load job that cation validates that the input represents
calls the business layer with data read from a single path component (and, in particu-
a file format used to exchange information lar, does not contain path separators).

2014 17
Typically, security vulnerabilities
in this category are highly domain-
and application-specific.

• If an externally controlled string is used safe languages such as C, failing to care-


in a context in a HTML document where fully validate external inputs can result in
it will be interpreted as a URL, a Cross- memory corruption vulnerabilities such as
Site Scripting (XSS) vulnerability can buffer overflows, unbounded memory reads,
arise unless it has been validated that null-terminated string issues, and so on.
the string represents a well-formed URL • Accepting inputs from untrusted sources
with a benign scheme (such as http:/ without enforcement of an upper bound on
https:, and, in particular, not javascript:, data size can result in resource exhaustion.
vbscript:, data:, or others). • In general, aside from memory corruption
• It is generally preferable to perform data and resource exhaustion issues, data that
validation relevant to the prevention of are not validated cause security issues
injection vulnerabilities in the implemen- primarily when they are used in a way that
tation of the API that is subject to injection influences control flow. Data that are simply
vulnerabilities, or in a wrapper API in case being copied around (e.g., received from an
the underlying API cannot be modified. See external input, then stored in a database,
also “Strictly Separate Data and Control and later displayed in UI) are generally
Instructions, and Never Process Control In- harmless. Problems arise if the application
structions Received from Untrusted Sources” inspects the data and makes control flow de-
section. cisions based on the data’s value. This most
• Attempting to validate data that are not immediately applies to data that are used
in canonical form can allow validation to in contexts where they are interpreted as
be bypassed. For example, it is difficult to instructions or control, leading to injection
validate that an input string represents a vulnerabilities as discussed earlier.
single path component (free of path separa-
tor characters) unless the input has been More generally however, control-flow depen-
fully decoded (with respect to transport dencies on untrusted, non-validated data
encodings) and has been validated to be in a can lead to state corruption vulnerabilities,
canonical character encoding—otherwise, or execution of state transitions that the
it might be possible for an attacker to sneak programmer did not intend or consider. Typi-
a path separator past the input validation cally, security vulnerabilities in this category
by representing it in an encoded form (for are highly domain- and application-specific,
example, %-encoding commonly used in web and hence are difficult to reason about and
applications), or in the form of a non-ca- detect by general-purpose tools. Careful,
nonical character encoding (for example, a state-dependent validation of inputs can go
non-canonical UTF-8 encoding). a long way toward mitigating this risk.
• In applications implemented in non-memory

2014 18
USE CRYPT
CORRECTLY
USE CRYPTOGRAPHY CORRECTLY
Cryptography is one of the most important tools information to attackers. Standard algo-
for building secure systems. Through the proper rithms and libraries are preferable.
use of cryptography, one can ensure the confi- • Misuse of libraries and algorithms. Even
dentiality of data, protect data from unautho- when using strong libraries, do not assume
rized modification, and authenticate the source that just using the libraries will be suffi-
of data. Cryptography can also enable many oth- cient. There have been numerous instances
er security goals as well. Cryptography, however, in which standard libraries were used, but
is not a panacea. Getting cryptography right is the developers using the libraries made
extremely hard. We list common pitfalls. incorrect assumptions about how to use
the library routines. In other situations,
• Rolling your own cryptographic algorithms
developers don’t choose the right algorithm
or implementations. Designing a cryp-
or use the algorithm incorrectly. For exam-
tographic algorithm (including protocols and
ple, an encryption scheme may protect the
modes) requires significant and rare mathe-
confidentiality of data, but may not pro-
matical skills and training, and even trained
tect against malicious modifications to the
mathematicians sometimes produce algo-
data. As another example, if an algorithm
rithms that have subtle problems. There are
requires an initialization vector (IV), then
also numerous subtleties with implementing
choosing an IV with certain properties may
cryptographic algorithms. For example, the
be required for the algorithm to work se-
order of operations involved when exponen-
curely. Understanding the nuances of algo-
tiating a number—something common in
rithm and library usage is a core skill for
cryptographic operations—can leak secret
applied cryptographers.

2014 19
Cryptographic algorithms
often don’t interact nicely.

• Poor key management. When everything interact nicely. Best practices indicate get-
else is done correctly, the security of the ting it “right” once and reusing the compo-
cryptographic system still hinges on the pro- nent elsewhere.
tection of the cryptographic keys. Key man- • Failure to allow for algorithm adaptation
agement mistakes are common, and include and evolution. For more on this, please see
hard-coding keys into software (often ob- “Design for changes in the security proper-
served in embedded devices and application ties of components beyond your control” in
software), failure to allow for the revocation the “Be Flexible When Considering Future
and/or rotation of keys, use of cryptographic Changes to Objects and Actors” section.
keys that are weak (such as keys that are
Cryptography is so hard to get right that it
too short or that are predictable), and weak
always makes sense to work with an expert if
key distribution mechanisms.
you can. Note that expertise in applied cryptog-
• Randomness that is not random. Confusion raphy is not the same as being a mathemati-
between statistical randomness and cryp- cian and having a mathematical understanding
tographic randomness is common. Cryp- of cryptography. At the highest level, make use
tographic operations require random num- of proven algorithms and libraries, but realize
bers that have strong security properties. In that just the use of such things does not guar-
addition to obtaining numbers with strong antee security—it is easy to accidentally misuse
cryptographic randomness properties, care these things. Have a cryptography expert work
must be taken not to re-use the random with your designers to provide an API abstrac-
numbers. tion around a strong library, so that your devel-
• Failure to centralize cryptography. Numer- opers are not making decisions on algorithms
ous situations have been observed in which and cipher modes, and so that if you need to
different teams within an organization each change algorithms behind that abstraction
implemented their own cryptographic rou- layer, you can.
tines. Cryptographic algorithms often don’t

2014 20
IDENTIFY SENSITIVE
DATA AND HOW THEY
SHOULD BE HANDLED
Data are critical to organizations and to users. same. For some data, confidentiality is critical.
One of the first tasks that systems designers Examples include financial records and corpo-
must do is identify sensitive data and determine rate intellectual property. For data on which
how to protect it appropriately. Many deployed business continuity or life depends (for example,
systems over the years have failed to protect medical data), availability is critical. In other
data appropriately. This can happen when de- cases, integrity is most important. Spoofing or
signers fail to identify data as sensitive, or when substituting data to cause a system to misbe-
designers do not identify all the ways in which have intentionally are examples of failures to
data could be manipulated or exposed. ensure data integrity. Do not conflate confiden-
tiality alone with data protection.
Data sensitivity is context-sensitive. It depends
on many factors, including regulation (which is Technical data sensitivity controls that a de-
often mandatory), company policy, contractu- signer might consider include access control
al obligations, and user expectation. Note that mechanisms (including file protection mecha-
sensitive data are not always user-generated nisms, memory protection mechanisms, and
input. Rather, they include data computed from database protection mechanisms), cryptogra-
scratch, data coming from external sensors (for phy to preserve data confidentiality or integrity,
example, geolocation and accelerometer data and redundancy and backups to preserve data
on mobile devices), cryptographic material, and availability.
Personally Identifiable Information (PII). Creat-
Data sets do not exist only at rest, but in tran-
ing a policy that explicitly identifies different
sit between components within a single system
levels of classification is the first step in han-
and between organizations. As data sets tran-
dling data appropriately.
sit between systems, they may cross multiple
It is important to factor all relevant consid- trust boundaries. Identifying these boundaries
erations into the design of a data sensitivity and rectifying them with data protection poli-
policy. For example, there are numerous reg- cies is an essential design activity. Trust is just
ulations that system designers must consider, as tricky as data sensitivity, and the notion of
ultimately creating a unified approach that con- trust enclaves is likely to dominate security
sistently addresses them all. A number of exam- conversations in the next decade.
ples may help to flesh this out: various jurisdic-
Policy requirements and data sensitivity can
tions impose regulations on how personal data
change over time as the business climate
should be handled (such as medical records); the
evolves, as regulatory regimes change, as sys-
EU Data Protection Directive differs from the
tems become increasingly interconnected, and
regulations in the United States; and PCI com-
as new data sources are incorporated into a
pliance issues, though not regulatory, directly
system. Regularly revisiting and revising data
affect data protection requirements.
protection policies and their design implications
Not all data protection requirements are the is essential.

2014 21
ALWAYS CO
ALWAYS CONSIDER THE USERS
Almost every software system in existence Usability and user experience considerations
today interacts in one way or another with are often the most important factors ensuring
human beings. The users of a software system that software systems operate in a secure man-
range from those in charge of fielding, config- ner. Designing systems that can be configured
uring, and maintaining it operationally to those and used in a secure manner with easy-to-use,
who actually use it for its intended purpose, the intuitive interfaces and sufficiently expressive,
system’s end users. but not excessive, security controls is crucial.
The security stance of a software system is However, it is dangerous to assume that every
inextricably linked to what its users do with it. It intended user of the system will be interested
is therefore very important that all security-re- in security—or will even be well-meaning. The
lated mechanisms are designed in a manner challenge to designers and architects lies in
that makes it easy to deploy, configure, use, and creating designs that facilitate secure configu-
update the system securely. Remember, secu- ration and use by those interested in doing so,
rity is not a feature that can simply be added designs that motivate and incentivize secure
to a software system, but rather a property use among those not particularly interested in
emerging from how the system was built and is software security, and designs that prevent or
operated. mitigate abuse from those who intend to weak-
en or compromise the system.
The way each user interacts with software is
dictated not only by the design and implemen- Failing to address this design principle can lead
tation decisions of its creators but also by the to a number of problems:
cognitive abilities and cultural background of
its users. Consequently, it is important that • Privilege escalation may result from a fail-
software designers and architects consider how ure to implement an authorization model
the physical abilities, cultural biases, habits, that is sufficiently tied to the authenticated
and idiosyncrasies of the intended users of the entity (user) in all cases. Escalation failures
system will impact its overall security stance. It may also occur when higher-privileged func-
is also a truism that during the life of any mod- tions are not protected by the authorization
erately useful system, a few users will discover model and where assumptions about inac-
capabilities that are outside the intentions of cessibility are incorrect.
the system’s designers and builders. Some of • A particular failure of appropriate autho-
those capabilities may very well have significant rization can allow a breach of the intended
security implications. authorization and isolation between users

2014 22
such that one user may access another us- • Failure to consider the needs of program-
er’s data. mers who must code to an API will cause the
• When designers don’t “remember the user” intended automation patterns to be missed.
in their software design, inadvertent disclo- Programmers are a class of users who also
sures by the user may take place. If it is diffi- require that the interface they consume be
cult to understand the authorization model, intuitive enough to guide them to correct
or difficult to understand the configuration usage patterns. Because a misunderstand-
for visibility of data, then the user’s data are ing of an API occurs within the program
likely to be unintentionally disclosed. that uses it, problems may not be readily
• Default configurations that are “open” (that apparent (appearing perhaps only obliquely,
is, default configurations that allow access within log files of the ongoing activity), and
to the system or data while the system is the debugging of the problem difficult; this
being configured or on the first run) assume failure can be one of the most difficult to
that the first user is sophisticated enough find and fix. Additionally, if the API must be
to understand that other protections must changed, many if not all consumers of the
be in place while the system is configured. API may be forced into further changes, thus
Assumptions about the sophistication or spreading the original failure throughout
security knowledge of users are bound to be the ecosystem.
incorrect some percentage of the time. This • Failure to consider the possibility of “collat-
is particularly true at the startup and ini- eral damage” that can occur from included
tialization of the system. or embedded software or data in the user
• If the security configuration is difficult or interface may cause an inadvertent or un-
non-intuitive, the result will be an inability intentional leaks of personal data. Consider
to configure the product to conform to the the capture of a bystander in a personal
required security policy. photo taken in a public place. Even if that
passerby is not a user of software, the by-
• Designers sometimes fail to account for the
stander’s privacy may be compromised if
fact that authenticated and properly autho-
that image is posted online later.
rized users can also be attackers! This design
error is a failure to distrust the user, result- • Failure to consider the user’s data during
ing in authorized users having opportunities setup, use, and revocation/termination may
to misuse the system. cause unintended data to be gathered and
stored against the users’ wishes, or may hold
• When security is too hard to set up for a
onto data that should have been removed
large population of the system’s users, it will
completely after the user has stopped using
never be configured, or it will not be config-
the service and closed his or her account.
ured properly. This is especially dangerous
For example, when a user decides to stop
where the system’s defaults are “open” or
using the system, is the private data easy for
insecure. For example, if there are too many
the user to destroy?
clicks required for the user to get from the
main page or screen to a security control • Failure to consider the many different class-
panel, users are unlikely to persist through es of users (blind users, language proficien-
the labyrinth of clicks. cy, children, people with different mental

2014 23
capabilities, etc.) will exclude those classes of results in order to understand the impact of the
users from the software -- or, alternatively, changes (for example, on social networks, good
make the software too difficult to use effec- interfaces allow users to see their privacy-set-
tively. Most importantly, when designing the tings changes from the perspective of other
security of the system, failure to consider users).
how security is set up and used from the
On the other hand, it might be preferable not to
perspective of users with different capabil-
give the user a choice at all; or example if a de-
ities and understandings typically causes
fault secure choice does not have any material
those users to set up and make inappropri-
disadvantage over any other; if the choice is in
ate use of the software’s security.
a domain that the user is unlikely to be able to
Stepping back, our biggest recommendation is reason about; or if one user’s choice may sig-
the following: Always consider the users, and nificantly affect the system’s or the other user’s
any other stakeholders, in the design and eval- state, including security.
uation of systems. There are numerous factors
to consider, and there are often trade-offs; for Designers must also consider the implications
example, improving the system with respect to of user fatigue (for example, the implications
one user value (such as privacy or usability) can of having a user click “OK” every time an appli-
negatively affect another user value (like ease of cation needs a specific permission) and try to
accessing the relevant information). design a system that avoids user fatigue while
also providing the desired level of security and
In addition to the general recommendations privacy to the user.
given above, there are numerous artifacts de-
signers can consider in order to address specific The field of user-focused security is rich with
problems mentioned earlier. The decision wheth- tensions. As a trivial example, so-called “se-
er to implement these specific recommendations cure” password selection strategies are also well
will, however, depend on the system in question. known to lead to passwords that are hard for
For example, in some cases we recommend not users to remember. A more complex example
putting security-relevant decisions in the hands of these inherent tensions would be the need
of all users, as they may not possess the knowl- to make security simple enough for typical
edge or context to evaluate those decisions. users while also giving sophisticated or admin-
Similarly, because users may not know how to istrative users the control that they require.
explore or choose between a variety of options, We encourage designers to also consider other
we recommend making the easiest and most resources on designing security systems with
common usage scenario also secure—a notion stakeholders in mind.
often referred to as “secure by default.” When By fully considering all the relevant stakehold-
users do desire to change security settings, we ers, designers have the opportunity to create
suggest making it as easy as possible for them systems that are both secure and usable, sys-
to find the relevant settings. tems that will see adoption, and systems that
Often there is value in allowing users to test dif- will be compatible with the values of users and
ferent security and privacy settings and see the other people impacted by them.

2014 24
UNDERSTA
UNDERSTAND HOW
INTEGRATING EXTERNAL
COMPONENTS CHANGES
YOUR ATTACK SURFACE
It is unlikely that you will develop a new system These components may be included as binaries,
without using external pieces of software. In fact, libraries, and source code, or they may exist
when adding functionality to an existing system, simply as APIs.
developers often make use of existing compo-
It is a common adage of software security that
nents to provide some or all of that new function-
whenever possible, functionality should be
ality. In this context, external components refer
achieved by the reuse of tried-and-true pieces
to software “not written here,” such as:
of previously tested and validated software,
• Software procured as off-the-shelf compo- instead of developing from scratch every time.
nents, platforms, and applications The important distinction is that the software
• Third-party open source or proprietary being newly included has actually been tried
libraries as well as tested and found to stand up to your
current standards of software security. The
• Widgets and gadgets added or loaded at run-
decision to use-rather-than-build means that
time as part of a web project
the software as a whole inherits the security
• Access to some functionality provided by the
weaknesses, security limitations, maintenance
component that you plan to take advantage
responsibility, and the threat model of whatever
of (such as accessing a web service that pro-
you are including. This inheritance can amount
vides federated authentication)
to a deficit of security, which must be solved,
• Software developed by a different team mitigated, or accounted for when the system is
within your organization finished. The system’s “threat model” is a repre-
• Software that your team developed at a pre- sentation of the security posture of the system
vious point in time (perhaps at a time when when all possible threats are taken into consid-
the security stance was not as mature as it eration, their mitigations established, and the
is now) vulnerabilities identified.

2014 25
Make sure you allocate time in your software • Library making outbound requests to the
development methodology to consider the secu- maker’s site or to some partner of theirs
rity impact on your system when including an • Library receiving inbound requests from
external component: some external source
• A single external component including other
• How does the external component change
components, causing multiple levels of inclu-
the threat model of the entire system? Does
sion (“recursion”)
it add to the attack surface? Does it modify
entry points in the system that had already • Including pieces of functionality that offer
been considered in its own threat model? unknown interfaces into the system—for ex-
ample, a CLI for configuration of an included
• Were new features, capabilities, or interfaces
daemon, a panel or admin mode for a Web
added even though you are not using them?
component, a hardcoded set of credentials
Can those unused features be disabled?
for an authentication/authorization module,
• Does the external component being included
a debugging interface or backdoor, or the
also include other external components with
like.
their own security weaknesses?
• Have you obtained the external component At a minimum, consider the following:
from a known, trusted source? • Isolate external components as much as
• Does the external component provide secu- your required functionality permits; use
rity documentation that may help you better containers, sandboxes, and drop privileges
understand its threat model and the securi- before entering uncontrolled code.
ty implications of its configuration? • When possible, configure external compo-
You must assume that incoming external nents to enable only the functionality you
components are not to be trusted until appro- intend to use.
priate security controls have been applied, in • If you include functionality that you do not
order to align the component’s attack surface intend to use, you must consider how that
and security policy with ones that meet your included functionality changes your secu-
requirements. rity posture (attack surface, inherited debt,
threats, etc.), and therefore increases the
Examples of potential security issues with
security you must implement to account for
third-party components include the following:
the change.
• Loading a library with known vulnerabilities • If you cannot configure the security prop-
(CWE, CVE, etc.) erties of the component to align with your
• Including a library with extra features that security goals, find another library, or docu-
entail security risks ment that you are accepting the risk and in-
• Reusing a library—yours or a third form relevant stakeholders of your decision.
party’s—­that no longer meets current soft- • Likewise, if the element to be included can-
ware security standards not realize your security objectives, find a
• Using a third-party service and hoping different element, or document that you
thereby to pass responsibility of security to are accepting the risk and inform relevant
that service stakeholders of your decision.
• Configuration mistakes in the security of a • Validate the provenance and integrity
library—e.g, secure defaults of the external component by means of

2014 26
cryptographically trusted hashes and sig- component such as a Web server, under-
natures, code signing artifacts, and ver- stand its defaults concerning admin modes,
ification of the downloaded source. If no ports where the processes will be listening,
integrity mechanism is available, consider and assumptions concerning how it interfac-
maintaining a local mirror of the library’s es with the operating system and with your
source. Understand the risk of dynamically own software.
including components such as JavaScript • Document everything. If you change a de-
from external sources. If the external host is fault, make sure that there is documentation
compromised you may be including attack- as to why the decision was made to change
er-controlled JavaScript. it. If you include an external component, cre-
• Identify and follow sources that track or ate documentation around the process used
publish security-related information regard- to choose the component, the provenance
ing the external components you consume: of the component, the verification it went
bug repositories, security-focused mailing through, and most importantly any securi-
lists, CVE databases, and so forth. ty-relevant assumption made about it. This
• Make sure that the development team mem- will make it easier to move forward when
bers charged with responding to security versions change, or when you consider the
events are aware of all external components use of an alternative external component.
used so those can be included in their threat When changing the build defaults of exter-
intelligence collection efforts. nal components, configuration options for
• Maintain an up-to-date list of consumed ex- deployment, or source code, automate the
ternal components and at a pre-established procedure using your version control system
cadence verify that it matches the versions or a patch file (numerous tools, including
included in your product, as well as that make, sed, and patch, are available for this
those are the latest known-secure versions task depending on your environment). Then
available for each external component. include the automated procedure in your
build workflow—bring in the pristine com-
• Maintain a healthy distrust of external
ponent, apply your modifications, and use it
components:
for your build. The automation will help to
• Whenever possible, authenticate the data-
maintain consistency between builds, and
flow between your system and external
some tools include calling modes or execut-
components.
ables that validate their own configurations;
• Consider all data coming from an external leverage those into your process as well to
component to be tainted, until proven valid know when your modifications need adjust-
(see “Define an approach that ensures all ment due to a version change in the external
data are explicitly validated” for additional component or some other similar event.
information).
• Design for flexibility. Sometimes an external
• Be sure to understand and verify the default component becomes too risky, or its devel-
configuration of the external component. opment is abandoned, or the functionality
For example, if you are including an external it offers is surpassed by another external
crypto library, understand what values are component. For those cases, you will want to
used by default unless you change them; for design your system so that external compo-
example, sources of entropy, algorithms, and nents can be easily replaced.
key lengths. When consuming an external

2014 27
BE FLEXIBL
BE FLEXIBLE WHEN
CONSIDERING FUTURE CHANGES
TO OBJECTS AND ACTORS
Software security must be designed for change, decisions need to take place. The addition of
rather than being fragile, brittle, and static. continuous integration processes creates a re-
During the design and development processes, quirement for security flexibility, as changes to
the goal is to meet a set of functional and secu- systems are pushed automatically and at ever
rity requirements. However, software, the en- shorter periodicity.
vironments running software, and threats and
Meanwhile, entropy increases in every way pos-
attacks against software all change over time.
sible. Threats change over time. Embedded com-
Even when security is considered during design,
ponents (that is, components that are not easily
or a framework being used was built correctly
reachable) will inevitably be found to be vulner-
to permit runtime changes in a controlled and
able to attacks, researchers will discover new
secure manner, designers still need to consider
ways to break into systems, and proprietary
the security implications of future changes to
code will reveal itself to contain vulnerabili-
objects and actors.
ties. Any deployed system can eventually come
Designers need to understand how change influ- under attack and potentially be compromised.
ences security considerations under many cir- And, because threats change over time, even a
cumstances. There will be changes at runtime, deployed system that has resisted attacks for a
in the form of configuration changes, enabling long time may eventually succumb to an attack
and disabling of features, and sometimes dy- and be compromised.
namic loading of objects. The need for security
Like threats, the environment and conditions
consideration will appear during testing, since
under which the system exists will also change.
all possible variations of states will need to be
It is a different proposition to maintain secu-
verified to guarantee that they uphold the se-
rity for a system with 10 users than 10 million
curity posture of the system (among, of course,
users —not at all a simple matter of linear scale.
other tested behavior). There will be changes
A system that works well in a given configura-
at deployment when permissions, access con-
tion might find itself exposed to new threats
trol and other security-related activities and
by virtue of changes to that environment; for

2014 28
example, the addition of a mobile interface to a and local users and password storage were suf-
legacy system. ficient, tomorrow the system may be changed to
make use of an alternate identity management
For these reasons, secure design keeps flexibility
solution. In that case, the migration of previous
in mind.
users (and/or the correct coexistence of the
Design for secure updates. It is easier to up- local and remote users) would need to happen
grade small pieces of a system than huge blobs. in a way that does not compromise security; for
Doing so ensures that the security implications example, there should be consideration of user
of the upgrade are well understood and con- ID collisions such as when a remote and a local
trolled. For example, a database engine upgrade user have the same username.
may involve new access control defaults or re-
Design with the ability to isolate or toggle func-
writes of the controls such that previously tight
tionality. It should be possible to turn off com-
permissions loosen, or create new default users
promised parts of the system, or to turn on per-
that need to be disabled. If the update happens
formance-affecting mitigations, should the need
with the same change operation performed on
arise. Not every vulnerability identified can be
the web server, the amount of change and ad-
readily mitigated within a safe time period, and
justment to a dynamic, already-configured sys-
mission-critical systems cannot simply be taken
tem may be overwhelming to track and assure.
offline until their vulnerabilities are addressed.
Have the system being upgraded verify the For example, in certain environments a stateful
integrity and provenance of upgrade packages; firewall may impact performance overall, and
make use of code signing and signed mani- so it is turned off – until a vulnerability that
fests to ensure that the system only consumes may be stopped by turning it on is identified, in
patches and updates of trusted origin. This is a which case it becomes worthwhile to bear the
non-trivial design consideration, as there are performance cost by turning the firewall on
many details in process and implementation until a proper patch can be developed, tested,
that may break if poorly thought out before- and applied.
hand. Finally, consider the maintenance burden
Design for changes to objects intended to be
placed on administrative personnel. As com-
kept secret. History has shown us that secrets
plexity increases, there is an increasing likeli-
such as encryption keys and passwords get
hood of making mistakes.
compromised. Keeping secrets safe is a hard
Design for security properties changing over problem, and one should be prepared to have
time; for example, when code is updated. If the secrets replaced at any time and at all levels of
system ran in a small environment yesterday, the system. This includes several aspects:

2014 29
And because threats change over
time, even a deployed system that
has resisted attacks for a long time
may eventually succumb to an
attack and be compromised.

• A secure way for users to change their own time, as when an Open Source project is aban-
passwords, including disallowing the change doned and its code not actively maintained, or
until the old password has been successfully when its license changes, forcing users to aban-
presented by the user. don it.
• Carefully considering any kind of “password In these cases it is important to design “agility,”
recovery” mechanism. It is better to give the the capability to change layers and algorithms
forgetful user a way to reset their password as needed, into the system. Good examples
after verification via a parallel mechanism include Java’s capability to change crypto
(like email) than to provide the password in providers without recompilation of classes, and
clear text, which can be subverted or com- Apache’s capability of specifying a list of ciphers
promised in any number of ways. it is willing to negotiate with a client. Many
• A secure and efficient way to replace certif- hours of development and much grief over
icates, SSH keys, and other keys or authen- security flaws have been avoided due to these
tication material that systems use, provid- capabilities. Good design allows for intermediate
ing clear and explicit logs of those events layers of abstraction between code and import-
(without including the secrets in any form!) ed external APIs, so that developers can change
in a forensically verifiable way (for example, components providing needed functionality
external log servers and checksums). without changing much of the code.
• Understanding how the key change affects
data stored at rest. For example, if data are Design for changes to entitlements. Systems are
encrypted on a file system or in a database sometimes designed in which support staffers
and an administrator needs to change the have privileged access to certain parts of the
encryption key, is it better to decrypt all data system in order to perform their job. However,
using the current key and re-encrypt that the support staff’s access to various system
data with the new key, or to maintain ver- components likely changes over time. Individu-
sions of encrypted data and encryption keys? als leave the organization, job functions change,
they go on extended leaves or sabbaticals,
Design for changes in the security properties of system functionality changes, and so on. The
components beyond your control. Tech marches system must have a way to revoke access to ar-
on. A cipher that was considered secure yester- eas when a user no longer has a need to access
day may be found to be less secure today, either them. This revocation of access should be part
by the discovery of an active attack against it of an existing auditing mechanism in which ac-
or by improvements in hardware and software cess to critical system components is regularly
able to defeat that security control. In the same reviewed to confirm that those individuals with
way, an external component’s security proper- access still require that level of access.
ties or related characteristics may change over

2014 30
GET INVOLV
GET INVOLVED
As stated in the mission statement, the IEEE Computer Society Center for Secure Design
will provide guidance on:

• Recognizing software system designs that are likely vulnerable to compromise.


• Designing and building software systems with strong, identifiable security properties.
This document is just one of the practical artifacts that the Center for Secure Design
will deliver.
Interested in keeping up with Center for Secure De-
sign activities? Follow @ieeecsd on Twitter, catch up
with us via cybersecurity.ieee.org, or contact Kathy
Clark-Fisher, Manager, New Initiative Development
(kclark-fisher@computer.org).

About IEEE Computer Society


IEEE Computer Society is the world’s leading computing membership organization and
the trusted information and career-development source for a global workforce of tech-
nology leaders. The Computer Society provides a wide range of forums for top minds
to come together, including technical conferences, publications, and a comprehensive
digital library, unique training webinars, professional training, and the TechLeader
Training Partner Program to help organizations increase their staff’s technical knowl-
edge and expertise. To find out more about the community for technology leaders, visit
http://www.computer.org.

2014 31

S-ar putea să vă placă și