<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wiki.owasp.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Shane+Argo</id>
		<title>OWASP - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.owasp.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Shane+Argo"/>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php/Special:Contributions/Shane_Argo"/>
		<updated>2026-05-30T18:24:23Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.27.2</generator>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Choosing_and_Using_Security_Questions_Cheat_Sheet&amp;diff=156007</id>
		<title>Choosing and Using Security Questions Cheat Sheet</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Choosing_and_Using_Security_Questions_Cheat_Sheet&amp;diff=156007"/>
				<updated>2013-07-25T10:01:15Z</updated>
		
		<summary type="html">&lt;p&gt;Shane Argo: Fixed spelling error.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction  =&lt;br /&gt;
&lt;br /&gt;
This cheat sheet provides some best practice for developers to follow when choosing and using security questions to implement a &amp;amp;quot;forgot password&amp;amp;quot; web application feature.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
= The Problem =&lt;br /&gt;
&lt;br /&gt;
There is no industry standard either for providing guidance to users or developers when using or implementing a Forgot Password feature. The result is that developers generally pick a set of dubious questions and implement them insecurely. They do so, not only at the risk to their users, but also--because of potential liability issues--at the risk to their organization. Ideally, passwords would be dead, or at least less important in the sense that they make up only one of several multi-factor authentication mechanisms, but the truth is that we probably are stuck with passwords just like we are stuck with Cobol. So with that in mind, what can we do to make the Forgot Password solution as palatable as possible?&lt;br /&gt;
&lt;br /&gt;
= Choosing Security Questions and/or Identity Data =&lt;br /&gt;
&lt;br /&gt;
Most of us can instantly spot a bad &amp;amp;quot;security question&amp;amp;quot; when we see one. You know the ones we mean. Ones like &amp;quot;What is your favorite color?&amp;quot; are obviously bad. But as the [[http://goodsecurityquestions.com/ Good Security Questions]] web site rightly points out,&lt;br /&gt;
&amp;amp;quot;there really are NO GOOD security questions; only fair or bad questions&amp;amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The reason that most organizations allow users to reset their own forgotten passwords is not because of security, but rather to reduce their own costs by reducing their volume of calls to their help desks. It's the classic convenience vs. security trade-off, and in this case, convenience (both to the organization in terms of reduced costs and to the user in terms of simpler, self-service) almost always wins out.&lt;br /&gt;
&lt;br /&gt;
So given that the business aspect of lower cost generally wins out, what can we do to at least raise the bar a bit?&lt;br /&gt;
&lt;br /&gt;
Here are some suggestions. Note that we intentionally avoid recommending specific security questions. To do so likely would be counterproductive because many developers would simply use those questions without much thinking and adversaries would immediately start harvesting that data from various social networks.&lt;br /&gt;
&lt;br /&gt;
== Desired Characteristics ==&lt;br /&gt;
&lt;br /&gt;
Any security questions or identity information presented to users to reset forgotten passwords should ideally have the following four characteristics:&lt;br /&gt;
&lt;br /&gt;
# '''Memorable''': If users can't remember their answers to their security questions, you have achieved nothing.&lt;br /&gt;
# '''Consistent''': The user's answers should not change over time. For instance, asking &amp;quot;What is the name of your significant other?&amp;quot; may have a different answer 5 years from now.&lt;br /&gt;
# '''Nearly universal''': The security questions should apply to a wide an audience of possible.&lt;br /&gt;
# '''Safe''': The answers to security questions should not be something that is easily guessed, or research (e.g., something that is matter of public record).&lt;br /&gt;
&lt;br /&gt;
== Steps  ==&lt;br /&gt;
&lt;br /&gt;
=== Step 1) Decide on Identity Data vs Canned Questions vs. User-Created Questions ===&lt;br /&gt;
&lt;br /&gt;
Generally, a single HTML form should be used to collect all of the inputs to be used for later password resets. &lt;br /&gt;
&lt;br /&gt;
If your organization has a business relationship with users, you probably have collected some sort of additional information from your users when they registered with your web site. Such information includes, but is not limited to:&lt;br /&gt;
&lt;br /&gt;
* email address&lt;br /&gt;
* last name&lt;br /&gt;
* date of birth&lt;br /&gt;
* account number&lt;br /&gt;
* customer number&lt;br /&gt;
* last 4 of social security number&lt;br /&gt;
* zip code for address on file&lt;br /&gt;
* street number for address on file&lt;br /&gt;
&lt;br /&gt;
For enhanced security, you may wish to consider asking the user for their email address first and then send an email that takes them to a private page that requests the other 2 (or more) identity factors. That way the email itself isn’t that useful because they still have to answer a bunch of ‘secret’ questions after they get to the landing page.&lt;br /&gt;
&lt;br /&gt;
On the other hand, if you host a web site that targets the general public, such as social networking sites, free email sites, news sites, photo sharing sites, etc., then you likely to not have this identity information and will need to use some sort of the ubiquitous &amp;quot;security questions&amp;quot;. However, also be sure that you collect some means to send the password reset information to some out-of-band side-channel, such as a (different) email address, an SMS texting number, etc.&lt;br /&gt;
&lt;br /&gt;
Believe it or not, there is a certain merit to allow your users to select from a set of several &amp;quot;canned&amp;quot; questions. We generally ask users to fill out the security questions as part of completing their initial user profile and often that is the very time that the user is in a hurry; they just wish to register and get about using your site. If we ask users to create their own question(s) instead, they then generally do so under some amount of duress, and thus may be more likely to come up with extremely poor questions.&lt;br /&gt;
&lt;br /&gt;
However, there is also some strong rationale to requiring users to create their own question(s), or at least one such question. The prevailing legal opinion seems to be if we provide some sort of reasonable guidance to users in creating their own questions and then insist on them doing so, at least some of the potential liabilities are transferred from our organizations to the users. In such cases, if user accounts get hacked because of their weak security questions (e.g., &amp;quot;What is my favorite ice cream flavor?&amp;quot;, etc.) then the thought is that they only have themselves to blame and thus our organizations are less likely to get sued.&lt;br /&gt;
&lt;br /&gt;
Since OWASP recommends in the [[Forgot Password Cheat Sheet]] that multiple security questions should be posed to the user and successfully answered before allowing a password reset, a good practice might be to require the user to select 1 or 2 questions from a set of canned questions as well as to create (a different) one of their own and then require they answer one of their selected canned questions as well as their own question.&lt;br /&gt;
&lt;br /&gt;
=== Step 2) Review Any Canned Questions with Your Legal Department or Privacy Officer ===&lt;br /&gt;
&lt;br /&gt;
While most developers would generally first review any potential questions with whatever relevant business unit, it may not occur to them to review the questions with their legal department or chief privacy officer. However, this is advisable because their may be applicable laws or regulatory / compliance issues to which the questions must adhere. For example, in the telecommunications industry, the FCC's Customer Proprietary Network Information (CPNI) regulations prohibit asking customers security questions that involve &amp;quot;personal information&amp;quot;, so questions such as &amp;quot;In what city were you born?&amp;quot; are generally not allowed.&lt;br /&gt;
&lt;br /&gt;
=== Step 3) Insist on a Minimal Length for the Answers ===&lt;br /&gt;
&lt;br /&gt;
Even if you pose decent security questions, because users generally dislike putting a whole lot of forethought into answering the questions, they often will just answer with something short. Answering with a short expletive is not uncommon, nor is answering with something like &amp;quot;xxx&amp;quot; or &amp;quot;1234&amp;quot;.  If you tell the user that they ''should'' answer with a phrase or sentence and tell them that there is some minimal length to an acceptable answer (say 10 or 12 characters), you generally will get answers that are somewhat more resistant to guessing.&lt;br /&gt;
&lt;br /&gt;
=== Step 4) Consider How To Securely Store the Questions and Answers ===&lt;br /&gt;
&lt;br /&gt;
There are two aspects to this...storing the questions and storing the answers. Obviously, the questions must be presented to the user, so the options there are store them as plaintext or as reversible ciphertext. The answers technically do not need to be ever viewed by any human so they could be stored using a secure cryptographic hash (although in principle, I am aware of some help desks that utilize the both the questions and answers for password reset and they insist on being able to ''read'' the answers rather than having to type them in; YMMV). Either way, we would always recommend at least encrypting the answers rather than storing them as plaintext. This is especially true for answers to the &amp;quot;create your own question&amp;quot; type as users will sometimes pose a question that potentially has a sensitive answer (e.g., &amp;quot;What is my bank account # that I share with my wife?&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
So the main question is whether or not you should store the questions as plaintext or reversible ciphertext. Admittedly, we are a bit biased, but for the &amp;quot;create your own question&amp;quot; types at least, we recommend that such questions be encrypted.  This is because if they are encrypted, it makes it much less likely that your company will be sued if you have some bored, rogue DBAs pursuing the DB where the security questions and answers are stored in an attempt to amuse themselves and stumble upon something sensitive or perhaps embarrassing.&lt;br /&gt;
&lt;br /&gt;
In addition, if you explain to your customers that you are encrypting their questions and hashing their answers, they might feel safer about asking some questions that while potentially embarrassing, might be a bit more secure. (Use your imagination. Do we need to spell it out for you? Really???)&lt;br /&gt;
&lt;br /&gt;
=== Step 5) Periodically Have Your Users Review their Questions ===&lt;br /&gt;
&lt;br /&gt;
Many companies often ask their users to update their user profiles to make sure contact information such as email addresses, street address, etc. is still up-to-date. Use that opportunity to have your users review their security questions. (Hopefully, at that time, they will be in a bit less of a rush, and may use the opportunity to select better questions.)  If you had chosen to encrypt rather than hash their answers, you can also display their corresponding security answers at that time.&lt;br /&gt;
&lt;br /&gt;
If you keep statistics on how many times the respective questions has been posed to someone as part of a Forgot Password flow (recommended), it would be advisable to also display that information. (For instance, if against your advice, they created a question such as &amp;quot;What is my favorite hobby?&amp;quot; and see that it had been presented 113 times and they think they might have only reset their password 5 times, it would probably be advisable to change that security question and probably their password as well.)&lt;br /&gt;
&lt;br /&gt;
=== Step 6) Authenticate Requests to Change Questions ===&lt;br /&gt;
&lt;br /&gt;
Many web sites properly authenticate change password requests simply by requesting the current password along with the desired new password. If the user cannot provide the correct current password, the request to change the password is ignored. The same authentication control should be in place when changing security questions. The user should be required to provide the correct password along with their new security questions &amp;amp; answers. If the user cannot provide the correct password, then the request to change the security questions should be ignored. This control prevents both Cross-Site Request Forgery attacks, as well as changes made by attackers who have taken control over a users workstation or authenticated application session.&lt;br /&gt;
&lt;br /&gt;
= Using Security Questions =&lt;br /&gt;
&lt;br /&gt;
Requiring users to answer security questions is most frequently done under two quite different scenarios:&lt;br /&gt;
* As a means for users to reset forgotten passwords. (See [[Forgot Password Cheat Sheet]].)&lt;br /&gt;
* As an additional means of corroborating evidence used for authentication.&lt;br /&gt;
&lt;br /&gt;
If at anytime you intend for your users to answer security questions for both of these scenarios, it is ''strongly'' recommended that you use two different sets of questions / answers.&lt;br /&gt;
&lt;br /&gt;
It should noted that using a security question / answer in addition to using passwords does '''''not''''' give you multi-factor authentication because both of these fall under the category of &amp;quot;what you know&amp;quot;. Hence they are two of the ''same'' factor, which is not multi-factor. Furthermore, it should be noted that while passwords are a very weak form of authentication, answering security questions are generally is a much weaker form. This is because when we have users create passwords, we generally test the candidate password against some password complexity rules (e.g., minimal length &amp;amp;gt; 10 characters; must have at least one alphabetic, one numeric, and one special character; etc.); we usually do no such thing for security answers (except for perhaps some minimal length requirement). Thus good passwords generally will have much more entropy than answers to security questions, often by several orders of magnitude.&lt;br /&gt;
&lt;br /&gt;
=== Security Questions Used To Reset Forgotten Passwords ===&lt;br /&gt;
&lt;br /&gt;
The [[Forgot Password Cheat Sheet]] already details pretty much everything that you need to know as a developer when ''collecting'' answers to security questions. However, it provides no guidance about how to assist the user in selecting security questions (if chosen from a list of candidate questions) or writing their own security questions / answers. Indeed, the [[Forgot Password Cheat Sheet]] makes the assumption that one can actually use additional ''identity'' data as the security questions / answers.  However, often this is not the case as the user has never (or won't) volunteer it or is it prohibited for compliance reasons with certain regulations (e.g., as in the case of telecommunications companies and [[http://en.wikipedia.org/wiki/Customer_proprietary_network_information CPNI]] data).&lt;br /&gt;
&lt;br /&gt;
Therefore, at least some development teams will be faced with collecting more generic security questions and answers from their users. If you must do this as a developer, it is good practice to:&lt;br /&gt;
* briefly describe the importance of selecting a good security question / answer.&lt;br /&gt;
* provide some guidance, along with some examples, of what constitutes bad vs. fair security questions.&lt;br /&gt;
&lt;br /&gt;
You may wish to refer your users to the [[http://goodsecurityquestions.com/ Good Security Questions]] web site for the latter.&lt;br /&gt;
&lt;br /&gt;
Furthermore, since adversaries will try the &amp;quot;forgot password&amp;quot; reset flow to reset a user's password (especially if they have compromised the side-channel, such as user's email account or their mobile device where they receive SMS text messages), is a good practice to minimize unintended and unauthorized information disclosure of the security questions. This may mean that you require the user to answer one security question before displaying any subsequent questions to be answered. In this manner, it does not allow an adversary an opportunity to research all the questions at once. Note however that this is contrary to the advice given on the [[Forgot Password Cheat Sheet]] and it may also be perceived as not being user-friendly by your sponsoring business unit, so again YMMV.&lt;br /&gt;
&lt;br /&gt;
Lastly, you should consider whether or not you should treat the security questions that a user will type in as a &amp;quot;password&amp;quot; type or simply as regular &amp;quot;text&amp;quot; input. The former can prevent shoulder-surfing attacks, but also cause more typos, so there is a trade-off. Perhaps the best advice is to give the user a choice; hide the text by treating it as &amp;quot;password&amp;quot; input type by default, but all the user to check a box that would display their security answers as clear text when checked.&lt;br /&gt;
&lt;br /&gt;
=== Security Questions As An Additional Means Of Authenticating ===&lt;br /&gt;
&lt;br /&gt;
First, it bears repeating again...if passwords are considered weak authentication, than using security questions are even less so. Furthermore, they are no substitute for true multi-factor authentication, or stronger forms of authentication such as authentication using one-time passwords or involving side-channel communications. In a word, very little is gained by using security questions in this context.  But, if you must...keep these things in mind:&lt;br /&gt;
&lt;br /&gt;
* Display the security question(s) on a separate page only ''after'' your users have successfully authenticated with their usernames / passwords (rather than only after they have entered their username). In this manner, you at least do not allow an adversary to view and research the security questions unless they also know the user's current password.&lt;br /&gt;
* If you also use security questions to reset a user's password, then you should use a ''different'' set of security questions for an additional means of authenticating.&lt;br /&gt;
* Security questions used for actual authentication purposes should regularly expire much like passwords. Periodically make the user choose new security questions and answers.&lt;br /&gt;
* If you use answers to security questions as a ''subsequent'' authentication mechanism (say to enter a more sensitive area of your web site), make sure that you keep the session idle time out very low...say less than 5 minutes or so, or that you also require the user to first re-authenticate with their password and then immediately after answer the security question(s).&lt;br /&gt;
&lt;br /&gt;
= Related Articles =&lt;br /&gt;
[[Forgot Password Cheat Sheet]]&amp;lt;br/&amp;gt;&lt;br /&gt;
[[http://goodsecurityquestions.com/ Good Security Questions web site]]&lt;br /&gt;
&lt;br /&gt;
= Authors and Primary Editors  =&lt;br /&gt;
&lt;br /&gt;
Kevin Wall - kevin.w.wall[at]gmail com&lt;br /&gt;
&lt;br /&gt;
= Other Cheatsheets =&lt;br /&gt;
{{Cheatsheet_Navigation}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Cheatsheets]]&lt;/div&gt;</summary>
		<author><name>Shane Argo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Attack_Surface_Analysis_Cheat_Sheet&amp;diff=156006</id>
		<title>Attack Surface Analysis Cheat Sheet</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Attack_Surface_Analysis_Cheat_Sheet&amp;diff=156006"/>
				<updated>2013-07-25T08:03:02Z</updated>
		
		<summary type="html">&lt;p&gt;Shane Argo: Fixed spelling error.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= What is Attack Surface Analysis and Why is it Important? =&lt;br /&gt;
&lt;br /&gt;
This article describes a simple and pragmatic way of doing Attack Surface Analysis and managing an application's Attack Surface. It is targeted to be used by developers to understand and manage application security risks as they design and change an application, as well as by application security specialists doing a security risk assessment. The focus here is on protecting an application from external attack - it does not take into account attacks on the users or operators of the system (e.g. malware injection, social engineering attacks), and there is less focus on insider threats, although the principles remain the same. The internal attack surface is likely to be different to the external attack surface and some users may have a lot of access.&lt;br /&gt;
&lt;br /&gt;
Attack Surface Analysis is about mapping out what parts of a system need to be reviewed and tested for security vulnerabilities. The point of Attack Surface Analysis is to understand the risk areas in an application, to make developers and security specialists aware of what parts of the application are open to attack, to find ways of minimizing this, and to notice when and how the Attack Surface changes and what this means from a risk perspective.&lt;br /&gt;
&lt;br /&gt;
Attack Surface Analysis is usually done by security architects and pen testers. But developers should understand and monitor the Attack Surface as they design and build and change a system.&lt;br /&gt;
&lt;br /&gt;
Attack Surface Analysis helps you to:&lt;br /&gt;
# identify what functions and what parts of the system you need to review/test for security vulnerabilities&lt;br /&gt;
# identify high risk areas of code that require defense-in-depth protection - what parts of the system that you need to defend&lt;br /&gt;
# identify when you have changed the attack surface and need to do some kind of threat assessment&lt;br /&gt;
&lt;br /&gt;
= Defining the Attack Surface of an Application =&lt;br /&gt;
&lt;br /&gt;
The Attack Surface describes all of the different points where an attacker could get into a system, and where they could get data out.&lt;br /&gt;
&lt;br /&gt;
The Attack Surface of an application is:&lt;br /&gt;
# the sum of all paths for data/commands into and out of the application, and &lt;br /&gt;
# the code that protects these paths (including resource connection and authentication, authorization, activity logging, data validation and encoding), and &lt;br /&gt;
# all valuable data used in the application, including secrets and keys, intellectual property, critical business data, personal data and PII, and &lt;br /&gt;
# the code that protects these data (including encryption and checksums, access auditing, and data integrity and operational security controls).&lt;br /&gt;
&lt;br /&gt;
You overlay this model with the different types of users - roles, privilege levels - that can access the system (whether authorized or not). Complexity increases with the number of different types of users. But it is important to focus especially on the two extremes: unauthenticated, anonymous users and highly privileged admin users (e.g. database administrators, system administrators). &lt;br /&gt;
&lt;br /&gt;
Group each type of attack point into buckets based on risk (external-facing or internal-facing), purpose, implementation, design and technology. You can then count the number of attack points of each type, then choose some cases for each type, and focus your review/assessment on those cases.&lt;br /&gt;
&lt;br /&gt;
With this approach, you don't need to understand every endpoint in order to understand the Attack Surface and the potential risk profile of a system. Instead, you can count the different general type of endpoints and the number of points of each type. With this you can budget what it will take to assess risk at scale, and you can tell when the risk profile of an application has significantly changed.&lt;br /&gt;
&lt;br /&gt;
= Identifying and Mapping the Attack Surface =&lt;br /&gt;
&lt;br /&gt;
You can start building a baseline description of the Attack Surface in a picture and notes. Spend a few hours reviewing design and architecture documents from an attacker's perspective. Read through the source code and identify different points of entry/exit:&lt;br /&gt;
* User interface (UI) forms and fields&lt;br /&gt;
* HTTP headers and cookies&lt;br /&gt;
* APIs&lt;br /&gt;
* Files&lt;br /&gt;
* Databases&lt;br /&gt;
* Other local storage&lt;br /&gt;
* Email or other kinds of messages&lt;br /&gt;
* Run-time arguments&lt;br /&gt;
* …. [your points of entry/exit]&lt;br /&gt;
&lt;br /&gt;
The total number of different attack points can easily add up into the thousands or more. To make this manageable, break the model into different types based on function, design and technology:&lt;br /&gt;
* Login/authentication entry points&lt;br /&gt;
* Admin interfaces&lt;br /&gt;
* Inquiries and search functions&lt;br /&gt;
* Data entry (CRUD) forms&lt;br /&gt;
* Business workflows&lt;br /&gt;
* Transactional interfaces/APIs&lt;br /&gt;
* Operational command and monitoring interfaces/APIs&lt;br /&gt;
* Interfaces with other applications/systems&lt;br /&gt;
* ... [your types]&lt;br /&gt;
&lt;br /&gt;
You also need to identify the valuable data (e.g. confidential, sensitive, regulated) in the application, by interviewing developers and users of the system, and again by reviewing the source code. &lt;br /&gt;
&lt;br /&gt;
You can also build up a picture of the Attack Surface by scanning the application. For web apps you can use a tool like the [[OWASP_Zed_Attack_Proxy_Project]] or [http://arachni-scanner.com/ Arachni] or [http://code.google.com/p/skipfish/ Skipfish] or [http://w3af.sourceforge.net/ w3af] or one of the many commercial dynamic testing and vulnerability scanning tools or services to crawl your app and map the parts of the application that are accessible over the web.  Some web application firewalls (WAFs) may also be able to export a model of the appliaction's entry points.&lt;br /&gt;
&lt;br /&gt;
Validate and fill in your understanding of the Attack Surface by walking through some of the main use cases in the system: signing up and creating a user profile, logging in, searching for an item, placing an order, changing an order, and so on. Follow the flow of control and data through the system, see how information is validated and where it is stored, what resources are touched and what other systems are involved. There is a recursive relationship between Attack Surface Analysis and [[Application Threat Modeling]]: changes to the Attack Surface should trigger threat modeling, and threat modeling helps you to understand the Attack Surface of the application.&lt;br /&gt;
&lt;br /&gt;
The Attack Surface model may be rough and incomplete to start, especially if you haven’t done any security work on the application before. Fill in the holes as you dig deeper in a security analysis, or as you work more with the application and realize that your understanding of the Attack Surface has improved.&lt;br /&gt;
&lt;br /&gt;
= Measuring and Assessing the Attack Surface =&lt;br /&gt;
&lt;br /&gt;
Once you have a map of the Attack Surface, identify the high risk areas. Focus on remote entry points – interfaces with outside systems and to the Internet – and especially where the system allows anonymous, public access. &lt;br /&gt;
* Network-facing, especially internet-facing code&lt;br /&gt;
* Web forms&lt;br /&gt;
* Files from outside of the network&lt;br /&gt;
* Backwards compatible interfaces with other systems – old protocols, sometimes old code and libraries, hard to maintain and test multiple versions&lt;br /&gt;
* Custom APIs – protocols etc – likely to have mistakes in design and implementation&lt;br /&gt;
* Security code: anything to do with cryptography, authentication, authorization (access control) and session management&lt;br /&gt;
&lt;br /&gt;
These are often where you are most exposed to attack. Then understand what compensating controls you have in place, operational controls like network firewalls and application firewalls, and intrusion detection or prevention systems to help protect your application.&lt;br /&gt;
&lt;br /&gt;
Michael Howard at Microsoft and other researchers have developed a method for measuring the Attack Surface of an application, and to track changes to the Attack Surface over time, called the [http://www.cs.cmu.edu/~wing/publications/Howard-Wing03.pdf Relative Attack Surface Quotient (RSQ)]. Using this method you calculate an overall attack surface score for the system, and measure this score as changes are made to the system and to how it is deployed. Researchers at Carnegie Mellon built on this work to develop a formal way to calculate an [http://www.cs.cmu.edu/~pratyus/tse10.pdf Attack Surface Metric] for large systems like SAP. They calculate the Attack Surface as the sum of all entry and exit points, channels (the different ways that clients or external systems connect to the system, including TCP/UDP ports, RPC end points, named pipes...) and untrusted data elements. Then they apply a damage potential/effort ratio to these Attack Surface elements to identify high-risk areas.&lt;br /&gt;
&lt;br /&gt;
Note that deploying multiple versions of an application, or leaving old, backup and unused code increases the Attack Surface. Source code control and robust change management/configurations practices should be used to ensure the actual deployed Attack Surface matches the theoretical one as closely as possible.&lt;br /&gt;
&lt;br /&gt;
= Managing the Attack Surface =&lt;br /&gt;
&lt;br /&gt;
Once you have a baseline understanding of the Attack Surface, you can use it to incrementally identify and manage risks going forward as you make changes to the application. Ask yourself:&lt;br /&gt;
* What has changed? &lt;br /&gt;
* What are you doing different? (technology, new approach, ….)&lt;br /&gt;
* What holes could you have opened?&lt;br /&gt;
&lt;br /&gt;
The first web page that you create opens up the system’s Attack Surface significantly and introduces all kinds of new risks. If you add another field to that page, or another web page like it, while technically you have made the Attack Surface bigger, you haven’t increased the risk profile of the application in a meaningful way. Each of these incremental changes is more of the same, unless you follow a new design or use a new framework.&lt;br /&gt;
&lt;br /&gt;
If you add another web page that follows the same design and using the same technology as existing web pages, it's easy to understand how much security testing and review it needs. If you add a new web services API or file that can be uploaded from the Internet, each of these changes have a different risk profile again - see if if the change fits in an existing bucket, see if the existing controls and protections apply. If you're adding something that doesn't fall into an existing bucket, this means that you have to go through a more thorough risk assessment to understand what kind of security holes you may open and what protections you need to put in place. &lt;br /&gt;
&lt;br /&gt;
Changes to session management, authentication and password management directly affect the Attack Surface and need to be reviewed. So do changes to authorization and access control logic, especially adding or changing role definitions, adding admin users or admin functions with high privileges. Similarly for changes to the code that handles encryption and secrets. Fundamental changes to how data validation is done. And major architectural changes to layering and trust relationships, or fundamental changes in technical architecture – swapping out your web server or database platform, or changing the run-time operating system. &lt;br /&gt;
&lt;br /&gt;
As you add new user types or roles or privilege levels, you do the same kind of analysis and risk assessment. Overlay the type of access across the data and functions and look for problems and inconsistencies. It's important to understand the access model for the application, whether it is positive (access is deny by default) or negative (access is allow by default). In a positive access model, any mistakes in defining what data or functions are permitted to a new user type or role are easy to see. In a negative access model,you have to be much more careful to ensure that a user does not get access to data/functions that they should not be permitted to.&lt;br /&gt;
&lt;br /&gt;
This kind of threat or risk assessment can be done periodically, or as a part of design work in serial / phased / spiral / waterfall development projects, or continuously and incrementally in Agile / iterative development.&lt;br /&gt;
&lt;br /&gt;
Normally, an application's Attack Surface will increase over time as you add more interfaces and user types and integrate with other systems. You also want to look for ways to reduce the size of the Attack Surface when you can by simplifying the model (reducing the number of user levels for example or not storing confidential data that you don't absolutely have to), turning off features and interfaces that aren't being used, by introducing operational controls such as a Web Application Firewall (WAF) and real-time application-specific attack detection.&lt;br /&gt;
&lt;br /&gt;
= Related Articles =&lt;br /&gt;
&lt;br /&gt;
OWASP CLASP Identifying the Attack Surface: [[Identify attack surface]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
OWASP Principles Minimize Attack Surface area: [[Minimize attack surface area]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Mitigate Security Risks by Minimizing the Code You Expose to Untrusted Users, Michael Howard http://msdn.microsoft.com/en-us/magazine/cc163882.aspx&lt;br /&gt;
&lt;br /&gt;
= Authors and Primary Editors =&lt;br /&gt;
&lt;br /&gt;
Jim Bird - jimbird[at]shaw.ca&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Jim Manico - jim[at]owasp.org&lt;br /&gt;
&lt;br /&gt;
= Other Cheatsheets =&lt;br /&gt;
{{Cheatsheet_Navigation}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Cheatsheets]]&lt;/div&gt;</summary>
		<author><name>Shane Argo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Talk:HTTP_Strict_Transport_Security&amp;diff=149911</id>
		<title>Talk:HTTP Strict Transport Security</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Talk:HTTP_Strict_Transport_Security&amp;diff=149911"/>
				<updated>2013-04-16T08:36:32Z</updated>
		
		<summary type="html">&lt;p&gt;Shane Argo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I would like to make a change to this page, but would like to check it's okay first.  The IIS solution currently proposed on this page technically doesn't follow the spec, as [http://tools.ietf.org/html/draft-ietf-websec-strict-transport-sec-14#section-7.2 Section 7.2] specifies that the header must not be send over non-secure connections. I have written [http://hstsiis.codeplex.com/ an open source IIS module] which implements HSTS as per the specification which I would like to reference it here, but I am concerned that it may be interpreted as advertising or some other unacceptable update. I have read the [http://en.wikipedia.org/wiki/Wikipedia:Tutorial_%28Keep_in_mind%29 Wikipedia editing guidelines] referenced from the [https://www.owasp.org/index.php/Help:Editing Help:Editing] page and this change appears to be acceptable. --[[User:Shane Argo|Shane Argo]] 02:21, 3 April 2013 (UTC)&lt;br /&gt;
&lt;br /&gt;
Update re: open source HSTS IIS module after receiving approval from Michael Coates via email. --[[User:Shane Argo|Shane Argo]] 08:36, 16 April 2013 (UTC)&lt;/div&gt;</summary>
		<author><name>Shane Argo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=HTTP_Strict_Transport_Security&amp;diff=149910</id>
		<title>HTTP Strict Transport Security</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=HTTP_Strict_Transport_Security&amp;diff=149910"/>
				<updated>2013-04-16T08:35:26Z</updated>
		
		<summary type="html">&lt;p&gt;Shane Argo: Change made re: implementation in IIS after seeking approval from the original page author Michael Coates.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
HTTP Strict Transport Security (HSTS) is an opt-in security enhancement that is specified by a web application through the use of a special response header. Once a supported browser receives this header that browser will prevent any communications from being sent over HTTP to the specified domain and will instead send all communications over HTTPS. It also prevents HTTPS click through prompts on browsers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Examples  ==&lt;br /&gt;
&lt;br /&gt;
Example of the HTTP strict transport security header &lt;br /&gt;
&lt;br /&gt;
  Strict-Transport-Security: max-age=60000&lt;br /&gt;
&lt;br /&gt;
If all subdomains are HTTPS to then the following header is applicable:&lt;br /&gt;
&lt;br /&gt;
  Strict-Transport-Security: max-age=60000; includeSubDomains&lt;br /&gt;
&lt;br /&gt;
== Browser Support ==&lt;br /&gt;
&lt;br /&gt;
{| width=&amp;quot;400&amp;quot; cellspacing=&amp;quot;1&amp;quot; cellpadding=&amp;quot;1&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| '''Browser'''&amp;lt;br&amp;gt;&lt;br /&gt;
| '''Support Introduced'''&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Internet Explorer &amp;lt;br&amp;gt;&lt;br /&gt;
| no support as of IE 10 (tested on 2013-01-01)&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Firefox&amp;lt;br&amp;gt;&lt;br /&gt;
| 4&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Opera&amp;lt;br&amp;gt;&lt;br /&gt;
| 12&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Safari&amp;lt;br&amp;gt;&lt;br /&gt;
| ??&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Chrome&amp;lt;br&amp;gt;&lt;br /&gt;
| 4.0.211.0&amp;lt;br&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Server Side ==&lt;br /&gt;
&lt;br /&gt;
The web server side needs to inject the HSTS header. &lt;br /&gt;
&lt;br /&gt;
For HTTP sites on the same domain it is [http://tools.ietf.org/html/draft-ietf-websec-strict-transport-sec#section-6.1 not recommended] to add a HSTS header but to do a permanent redirect (301 status code) to the HTTPS site.&lt;br /&gt;
 &lt;br /&gt;
An Apache HTTPd example that will permanently redirect a URL to the identical URL with a HTTPS scheme, is as follows:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;VirtualHost *:80&amp;gt;&lt;br /&gt;
        ServerAlias *&lt;br /&gt;
        RewriteEngine On&lt;br /&gt;
        RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [redirect=301]&lt;br /&gt;
 &amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the HTTPS site configuration the following is needed to add the header as [http://tools.ietf.org/html/draft-ietf-websec-strict-transport-sec#section-6.1 recommended by the standard]:&lt;br /&gt;
        Header set Strict-Transport-Security &amp;quot;max-age=16070400; includeSubDomains&amp;quot;&lt;br /&gt;
&lt;br /&gt;
The following links show how to do set response headers in other web servers:&lt;br /&gt;
* [http://wiki.nginx.org/HttpHeadersModule NGINX]&lt;br /&gt;
* [http://redmine.lighttpd.net/wiki/lighttpd/Docs:ModSetEnv#Options Lighttpd]&lt;br /&gt;
* [http://httpd.apache.org/docs/2.2/mod/mod_headers.html HTTPd]&lt;br /&gt;
&lt;br /&gt;
==== IIS ====&lt;br /&gt;
Whilst [http://technet.microsoft.com/en-us/library/cc753133(WS.10).aspx custom headers] can be configured in IIS without any extensions, it is not possible to restrict these headers to secure transport channels [http://tools.ietf.org/html/rfc6797#section-7.2 as per the HSTS specification]. HSTS has been implemented as per the specification as an [http://hstsiis.codeplex.com/ open source IIS module].&lt;br /&gt;
&lt;br /&gt;
== Threats ==&lt;br /&gt;
&lt;br /&gt;
HSTS addresses the following threats:&lt;br /&gt;
* User bookmarks or manually types http://example.com and is subject to a man-in-the-middle attacker&lt;br /&gt;
** HSTS automatically upgrades HTTP requests to HTTPS for the target domain&lt;br /&gt;
* Web application that is intended to be purely HTTPS inadvertently contains HTTP links or serves content over HTTP&lt;br /&gt;
** HSTS automatically upgrades HTTP requests to HTTPS for the target domain&lt;br /&gt;
* A man-in-the-middle attacker attempts to intercept traffic from a victim user using an invalid certificate and hopes the user will accept the bad certificate&lt;br /&gt;
** HSTS does not allow a user to override the invalid certificate message&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
[http://dev.chromium.org/sts Chromium Projects/HSTS]&lt;br /&gt;
&lt;br /&gt;
[http://tools.ietf.org/html/draft-ietf-websec-strict-transport-sec HSTS Spec]&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security Wikipedia]&lt;br /&gt;
&lt;br /&gt;
[https://developer.mozilla.org/en/Security/HTTP_Strict_Transport_Security Mozilla Developer Network]&lt;br /&gt;
&lt;br /&gt;
[https://www.owasp.org/index.php/Transport_Layer_Protection_Cheat_Sheet OWASP TLS Protection Cheat Sheet]&lt;br /&gt;
&lt;br /&gt;
[https://developer.mozilla.org/en/Security/HTTP_Strict_Transport_Security Firefox STS Support]&lt;br /&gt;
&lt;br /&gt;
[http://lists.w3.org/Archives/Public/public-webapps/2009JulSep/1148.html Google Chrome STS Support]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Control|Control]]&lt;/div&gt;</summary>
		<author><name>Shane Argo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Talk:HTTP_Strict_Transport_Security&amp;diff=149086</id>
		<title>Talk:HTTP Strict Transport Security</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Talk:HTTP_Strict_Transport_Security&amp;diff=149086"/>
				<updated>2013-04-03T02:21:08Z</updated>
		
		<summary type="html">&lt;p&gt;Shane Argo: Created page with &amp;quot;I would like to make a change to this page, but would like to check it's okay first.  The IIS solution currently proposed on this page technically doesn't follow the spec, as ...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I would like to make a change to this page, but would like to check it's okay first.  The IIS solution currently proposed on this page technically doesn't follow the spec, as [http://tools.ietf.org/html/draft-ietf-websec-strict-transport-sec-14#section-7.2 Section 7.2] specifies that the header must not be send over non-secure connections. I have written [http://hstsiis.codeplex.com/ an open source IIS module] which implements HSTS as per the specification which I would like to reference it here, but I am concerned that it may be interpreted as advertising or some other unacceptable update. I have read the [http://en.wikipedia.org/wiki/Wikipedia:Tutorial_%28Keep_in_mind%29 Wikipedia editing guidelines] referenced from the [https://www.owasp.org/index.php/Help:Editing Help:Editing] page and this change appears to be acceptable. --[[User:Shane Argo|Shane Argo]] 02:21, 3 April 2013 (UTC)&lt;/div&gt;</summary>
		<author><name>Shane Argo</name></author>	</entry>

	</feed>