Home > Articles

This chapter is from the book

Design and Architecture

Now, with our security requirements and specifications document, it’s finally time to start considering the architecture and design of our application—or for our purposes here, the security aspects of the design. If you’ve been following our advice on collecting requirements, you’re likely to find that many of the security details in the design will essentially “write themselves.” Okay, that’s an exaggeration, but at least many of the architectural security decisions should be made easier from a good collection of security requirements.

These decisions will also be heavily driven by the expectations for security tiers introduced earlier in this chapter—in particular, we’re faced with architectural decisions of where to place specific security mechanisms for each security tier. If “tier 1” is your target, the decisions are likely to be quite simple; you can accomplish most of tier 1 within an application’s presentation layer, especially server-side, with a relatively small amount of back-end coding being required.

On the other hand, if your target is tier 2 or 3, you’ll want to give careful consideration to the security mechanisms you employ, and where they should be placed within your application. Building (essentially) intrusion detection functionality into an application is generally best suited for the business logic layer of an application, but there will still be some security functionality in other areas of the application, from the presentation layer through the data layer.

The important thing is to consider the architectural ramifications carefully, and then implement consistently throughout the application. Mixing and matching architectural components for convenience or familiarity is not a recipe for success.

So it’s on to considering the design or architecture of our application. We’re big believers in prescriptive guidance of positive practices, rather than (just) reviewing a design for flaws. So we’ll start there.

Prescriptive Design Practices

Perhaps the most important prescriptive practice to follow in designing secure applications is relying on common well-tested infrastructure and reusing already vetted design patterns, but that presents a “chicken and egg” sort of dilemma. By that we mean repeatedly using a set of design components that have proven themselves to be secure. Additionally, it’s useful to use design checklists that verify certain positive compliance aspects of design components. Let’s consider these things in some detail.

But first, let’s briefly take a look at the origins of these practices. Our secure designs should be built on top of sound architectural principles, such as those described by Saltzer and Schroeder in the 1970s.

From there, we should look at various security aspects of our design for construction soundness and turn those into checklists that can then be reused in later projects or verified and validated in the current project. Ideal targets for such checklists should include the following set of focus points:

  • Identification and authentication

    Things to look for in a strong “I & A” mechanism include con–forming to corporate standards for username and password—minimum length, acceptable character sets, and so on—but extend well beyond that. Software designers should also ensure that all sensitive information is adequately protected while at rest as well as while in transit. They should also ensure appropriate credentials management practices, that is, that all passwords are securely hashed and salted, and then stored into a repository. The credential repository itself should conform to any standardized architecture that is in place. Login credentials should also never be exposed in the URL field of a web browser, via a GET method; they should instead be embedded in the HTTP request body as a POST parameter. For that matter, it is entirely possible that your enterprise already has a standardized identification and authentication, or identity management, architecture, and you’ll need to make use of that. That is all well and good, but the preceding criteria should still be considered carefully.

  • Key management

    Although the topic of key management is substantial, private and symmetric keys, used by an application, require specific handling and have to be adequately protected according to the IT/IS guidelines. The most frequent solutions here are the use of key stores, file permissions, or specialized hardware tokens for highly protected systems.

  • Access control

    This one is more problematic to find through a simple checklist process per se, but there are still some things that can be verified. The basic principle to doing access control inside an application is to ask the question of whether a user, an entity, or a process should have access to the data or function it is requesting. That is, all data and function calls should in fact be designed as requests that can be authoritatively answered.

    As such, the thing to look for at a design level is a centralized access control mechanism that enforces policy. The policy itself will be set—perhaps dynamically—elsewhere, but internally, there needs to be a means of answering the question of whether a request should be permitted.

    What makes this problematic is that every access needs to follow this requesting methodology. We’ll discuss this in more detail in Chapter 5, “Testing Activities.”

  • Boundaries

    Every application of even moderate complexity has numerous boundary layers. They can be between components, servers, classes, modules, and so on, but at a design level we generally have a bird’s eye view of all of them—at least if we’re doing it right. From a security standpoint, boundary layers offer a positive opportunity to verify good practices like input validation and access control.

    Most risk assessment methodologies implicitly map out boundary layers in their threat modeling process by defining security zones (aka trust boundaries). Each zone is then studied for the risks it poses.

    Looking at an application’s boundary layers is similar, but generally offers a slightly more data-centric perspective on things.

  • Network connections

    Network connections, including both physical and VPN, are essentially a single boundary between components, but we list them separately here because they offer different types and levels of security controls. For one thing, in most enterprises, the networks themselves are operated by the IT organization. And further, network-level security controls tend to be outside the direct scope of the application itself, but nonetheless can be useful at independently enforcing some policies.

    For example, a network layer between an application server and a database can enforce permitting only SQL network traffic between the two components. Although the network can’t often do much more than that, it does provide us with some useful controls that help us enforce some of Saltzer and Schroeder’s design principles—namely, compartmentalization, graceful failure, and least privilege in this case.

  • Component interconnections

    These are simply another form of boundary layer, but much like the network boundaries, separate application components can offer up different types of opportunities for security controls.

  • Event logging

    Event logging is a big topic for application developers, and it is one that is almost always not well understood or adequately implemented. The key point that most developers don’t get is that the customer for event logging should be the IT security or incident response team. As such, it’s vital to consider their use cases with regard to event logging. More often than not, application event logging mostly contains debugging information. Although that information is useful for debugging purposes, it’s not all that’s typically needed when responding to security incidents. In addition, the security team often needs more business specific logging in order to determine the “who, what, where, when, and how” sorts of things they need to do.

    From a design checklist standpoint, you should be verifying that the security team has provided their log use cases and that those use cases will be incorporated into the application’s design. For details and examples of such use cases, see the discussion in Chapter 6.

  • Session management

    Most modern platforms and application servers these days provide more than adequate tools for building robust session management into applications running on them, but mistakes can still happen. We’ll discuss this further in Chapter 4, “Implementation Activities,” but for now, let’s ensure that the available infrastructure for doing session management will be used for our application.

  • Protection of sensitive data

    Enterprise applications carry all sorts of sensitive data these days, and it’s up to the developers to ensure that the sensitive data is being properly protected. As with protecting any secret, it’s vital to consider sensitive data at rest and in transit, because each state carries with it a different set of protection mechanisms that should be considered.

  • Data validation

    Any time our application has to make use of an external service—command-line interface, LDAP directory, SQL database, XML query engine, and so on—we have to ensure that the data being sent to the service is safe, after we’ve mutually authenticated those components, of course. There are several key concepts in that sentence. First off, we can’t assume that a service we’re calling is going to adequately protect itself. Second, we have to ensure that the intent of our service request is immutable from change due to whatever data we’re sending to the service.

    Essentially, we have to do proper input validation for the current module and output encoding of what will be sent to the service before making the call, and we have to do it in the context of understanding what the next service call is intended to do. That’s a pretty tall order, because encoding for a database call will be different from the one for LDAP query, for instance.

As you might imagine, the earlier list is by no means a comprehensive one, but it does represent a pretty common list of application aspects. For each of these common problems, we should put together a checklist of issues to ensure that we have properly addressed them in our own designs. Plus, since this list of things is pretty common, we can use it as a basis for some design patterns that we’ll be making repeated use of.

Now, some of the elements in the list aren’t necessarily discrete application components—say, for example, protecting sensitive data—but they are all things we should address as we consider the security aspects of our design.

It’s also worth giving careful thought to the feasibility of security aspects of a design. It is a common mistake to overengineer a design and basically attempt to protect everything all the time. The problems with this approach are numerous. For one thing, we’re likely to end up with a solution that is too costly for the problem we’re trying to solve. It might also be too complicated to be successful, or building it that way might simply take far more time than we have available. For that matter, it is also common to underengineer a design due to tight timelines, budgets, and so on. The key is to find the right balance, as in so many things.

So we have to make compromises, but we have to be able to do so in a principled, businesslike, and repeatable sort of way. That is, we have to have sound justification for the design decisions we make or don’t make. That’s where a risk management methodology comes in.

Risk management is one of McGraw’s three pillars of software security,4 and it helps us make decisions with confidence. Without a sound way of considering business risks, we’re inevitably going to make the wrong decisions by accepting risks we don’t understand. That’s a big gamble to subject the business to.

We’ll discuss threat modeling shortly, but one method that can be useful is to consider an application’s most likely threat profiles. Think of these as use cases, but from a security perspective: What are the most likely avenues of attack your application absolutely must be able to defend itself against?

For example, we often refer to the “coffee shop attack” when discussing web application security. That is, consider an attacker on an open Wi-Fi network (say, in a coffee shop) using a network sniffing tool to eavesdrop on all the network traffic traversing the Wi-Fi. Now, consider one of your application’s users using your application in that same coffee shop. Can your application withstand that level of scrutiny, or does it hemorrhage vital data such as user credentials, session tokens, or sensitive user data?

Similarly, when a mobile application is designed for a smartphone or tablet computer, the most likely risk a user faces is from data left behind on a lost or stolen device. If your application is on that lost/stolen device, what information could an attacker find on the device using forensic tools? Does your mobile application store sensitive data locally on the mobile device?

In designing your security mechanism, keeping a handful of these threat profiles in mind is a healthy thing to do. Of course, the threat profiles need to be specific to your application’s architecture, but it’s generally not too difficult to find data on attacks against similar architectures.

Implementation Considerations

There are many aspects of design that directly overlap with implementation. One aspect, in particular, is in designing where to place various security implementations in an application’s design. For example, the next chapter discusses input validation extensively. If we were to implement input validation without any regard for our application’s design, we would be quite likely to end up with a functioning but unmaintainable mountain of junk.

The reason for this is that it is entirely feasible to build input validation code at just about any layer of abstraction within an application. Further, if input validation is implemented “on the fly,” there is a tendency to include such things as regular expressions throughout the code base. This is what can easily result in code that is basically impossible to maintain over time.

So, despite the fact that something like input validation—which essentially does nothing to enhance the functional features of an application—is generally viewed as an implementation detail, it is important to design it carefully into one’s security architecture. In the case of input validation code, it should be centralized in implementation and features, as appropriate. If there are multiple distinct functional layers in an application (for example, Web UI, XML processing, LDAP access, and so on), validation can be centralized on a per-layer basis—but never scattered around randomly. The same thing goes for access control, which would be quite impossible to slap on after the fact, if it was not properly designed into the product from its conception. And in each of these cases, care should be taken to retain control on the server side of the application, regardless of what validation or access control might be done on the client.

These design considerations can have an enormous impact as well. Again citing the case of input validation, if we implement our input validation at the application’s presentation layer, it will largely preclude us from being able to implement tier 2 or tier 3 security features into the application, simply because of the lack of features available to us in the presentation layer.

We’ll discuss detailed examples of this in the next chapter, but for now, let’s at least be entirely cognizant that our design decisions need to have a firm footing in the reality of our intended implementations.

Design Review Practices

The common denominator in all development methodologies is to start with a clear understanding of the proposed design of the product. Although we’ve seen design documents span an enormous spectrum of detail, there is simply no substitute to really knowing and understanding the product’s design before proceeding.

Irrespective of your development methodology, you should have a fundamental description of the application and its components. A diagram visualizing all the components is a good starting point (see Figure 3.1). It should include all the physical as well as logical components of the application, at a bare minimum.

Figure 3.1

Figure 3.1 Diagram of a typical enterprise application design, top view.

Other useful things to include in design documentation include the following:

  • Components

    Each component of an application should be described, at least at a top level. What is it called? What is its primary functionality? What security requirements does it have? Who should access it?

  • Data elements

    What data does the application handle? What are the sensitivities of the data? Who should be allowed to view the data? Who should be allowed to alter the data?

  • Data interfaces

    How will data be exchanged through the various components of the application? What network protocols will be used? What format(s) will the data be exchanged in?

  • Bootstrap process

    How is the overall system instantiated? What security assumptions are made during the bootstrapping? How do the application’s components mutually authenticate?

  • Shutdown process

    On shutdown, what is done with system resources, such as open files, temporary file space, and encryption keys? What residue is left behind and what is cleaned up?

  • Logging process

    This is the process and components for event logging, to include debugging and security logs.

  • Failure process

    This includes processes for handling system failures, from relatively simple to catastrophic.

  • Update/patch process

    This consists of the processes for installing component updates, at various levels and components within the application.

The preceding description is highly simplistic, but at the same time it can seem pretty daunting. If you really take the time to do each of these steps in detail, threat modeling a typical application can be an enormously time-consuming process, which can be time and cost prohibitive for many enterprises. As such, this outline is intended merely to give you an overview of what is involved in the threat modeling process. What’s important from our standpoint is how to put any of this into practice.

We’ve had success at breaking down this threat modeling approach into a more simple process, based on the work of many people in the software security field today.

After you have a clear picture of how the application will work, it’s useful to break the design into individual operational security zones, particularly for a distributed application with multiple servers and one or more clients.

Next, for each zone and each element in each zone, articulate (preferably in a table format) each of the following: who, what, how, impact, and mitigation.

  • Who?

    Who can access the zone or element? Not just the registered, authorized users, but who could access the item in general. If it is (say) an application on a mobile device, consider the legitimate user, a user accessing a lost or stolen device, and so on. Try to be reasonably comprehensive in this step. What you’re doing is articulating the threat agents.

  • What?

    What can each threat agent do to potentially harm the system? Can the threat agents steal a hard drive from a server? Access a table in a SQL database? Masquerade as a legitimate user and get to sensitive data inside the application? And so forth.

  • How?

    How can the threat agents carry out each of the things in the what list?

  • Impact?

    If the attack is successful, what is its impact on the business? What are the direct costs as well as the indirect costs? In what ways is the business’s reputation tarnished?

  • Mitigation?

    For any given attack, what mitigation options are available? How much would they cost (in “low,” “medium,” and “high” terms if more quantifiable data are not available)?

Assuming you’ve assembled the right team of design reviewers, it’s quite likely this approach will result in some useful and meaningful discussions about the application’s design.

You should try to consider as many aspects of the application’s design as feasible. These reviews can vary from taking a few hours to taking many days, depending on an application’s complexity, and how much detailed analysis is expected.

So it needn’t be so difficult to do. And we’ve certainly found the payoffs to justify the time spent. You might find Cigital’s approach to be pretty similar in many ways to the threat modeling process we’ve just described.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020