<?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=Izar</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=Izar"/>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php/Special:Contributions/Izar"/>
		<updated>2026-04-25T08:13:29Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.27.2</generator>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=OWASP_PyTM&amp;diff=254286</id>
		<title>OWASP PyTM</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=OWASP_PyTM&amp;diff=254286"/>
				<updated>2019-08-28T19:15:19Z</updated>
		
		<summary type="html">&lt;p&gt;Izar: /* Licensing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;width:100%;height:160px;border:0,margin:0;overflow: hidden;&amp;quot;&amp;gt;[[File:OWASP_Project_Header.jpg|link=]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;padding: 0;margin:0;margin-top:10px;text-align:left;&amp;quot; |-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot;  style=&amp;quot;border-right: 1px dotted gray;padding-right:25px;&amp;quot; |&lt;br /&gt;
&lt;br /&gt;
==Project About==&lt;br /&gt;
{{Template:Project_About&lt;br /&gt;
  | project_name=PyTM&lt;br /&gt;
  | project_description=A Pythonic framework for threat-modeling-from-code&lt;br /&gt;
  | project_license=MIT License&lt;br /&gt;
  | leader_name1=Izar Tarandach&lt;br /&gt;
  | leader_name2= Matthew J. Coles&lt;br /&gt;
  | contributor_name1=Rohit Shambhuni&lt;br /&gt;
  | contributor_name2=Nick Ozmore&lt;br /&gt;
  | contributor_name3=Pooja Ahvad&lt;br /&gt;
  | presentation_link=https://www.youtube.com/watch?v=VbW-X0j35gw AppSecCali 2019 - Threat Model Every Story: Practical Continuous Threat Modeling Work for Your Team -&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==OWASP PyTM==&lt;br /&gt;
PyTM is an effort to enable developers to create and maintain threat models in a way that is natural for them, using a familiar OO syntax (Python, but should be generic enough to enable any developer with minimal OO experience to use it) to describe a system in terms of its elements and their attributes, in a way that can be easily shared, version-controlled and collaborated on.&lt;br /&gt;
&lt;br /&gt;
That description is a self-enclosed Python script that when run generates diagrams (DFDs and sequence), threats (based on a library of rules) and reports (joining diagrams and threats).&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;&lt;br /&gt;
	This is where you need to add your more robust project description. A project description should outline the purpose of the project, how it is used, and the value it provides to application security. Ideally, project descriptions should be written in such a way that there is no question what value the project provides to the software security community. This section will be seen and used in various places within the Projects Portal. Poorly written project descriptions therefore detract from a project’s visibility, so project leaders should ensure that the description is meaningful.  &lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Licensing==&lt;br /&gt;
&lt;br /&gt;
This program is free software: you can redistribute it and/or modify it under the terms of the [https://opensource.org/licenses/MIT MIT License] as published by the Massachusetts Institute of Technology.  OWASP PyTM and any contributions are Copyright &amp;amp;copy; by the Project Leader(s).&lt;br /&gt;
&lt;br /&gt;
==Roadmap==&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;&lt;br /&gt;
As of &amp;lt;strong&amp;gt;November, 2013, the highest priorities for the next 6 months&amp;lt;/strong&amp;gt; are:&lt;br /&gt;
&amp;lt;strong&amp;gt;&lt;br /&gt;
* Complete the first draft of the Tool Project Template&lt;br /&gt;
* Get other people to review the Tool Project Template and provide feedback&lt;br /&gt;
* Incorporate feedback into changes in the Tool Project Template&lt;br /&gt;
* Finalize the Tool Project template and have it reviewed to be promoted from an Incubator Project to a Lab Project&lt;br /&gt;
&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Subsequent Releases will add&lt;br /&gt;
&amp;lt;strong&amp;gt;&lt;br /&gt;
* Internationalization Support&lt;br /&gt;
* Additional Unit Tests&lt;br /&gt;
* Automated Regression tests&lt;br /&gt;
&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting Involved==&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;&lt;br /&gt;
Involvement in the development and promotion of &amp;lt;strong&amp;gt;Tool Project Template&amp;lt;/strong&amp;gt; is actively encouraged!&lt;br /&gt;
You do not have to be a security expert or a programmer to contribute.&lt;br /&gt;
Some of the ways you can help are as follows:&lt;br /&gt;
&lt;br /&gt;
| valign=&amp;quot;top&amp;quot;  style=&amp;quot;padding-left:25px;width:200px;border-right: 1px dotted gray;padding-right:25px;&amp;quot; |&lt;br /&gt;
&lt;br /&gt;
== Project Resources ==&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;&lt;br /&gt;
	This is where you can link to the key locations for project files, including setup programs, the source code repository, online documentation, a Wiki Home Page, threaded discussions about the project, and Issue Tracking system, etc. &lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[https://github.com/SamanthaGroves Installation Package]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/SamanthaGroves Source Code]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/SamanthaGroves What's New (Revision History)]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/SamanthaGroves Documentation]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/SamanthaGroves Wiki Home Page]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/SamanthaGroves Issue Tracker]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/SamanthaGroves Slide Presentation]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/SamanthaGroves Video]&lt;br /&gt;
&lt;br /&gt;
== Project Leader ==&lt;br /&gt;
Izar Tarandach&lt;br /&gt;
&lt;br /&gt;
Matthew J. Coles&lt;br /&gt;
&lt;br /&gt;
== Related Projects ==&lt;br /&gt;
* [[OWASP_Threat_Dragon]]&lt;br /&gt;
* [[OWASP_Automated_Threats_to_Web_Applications]]&lt;br /&gt;
&lt;br /&gt;
==Classifications==&lt;br /&gt;
&lt;br /&gt;
   {| width=&amp;quot;200&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
   |-&lt;br /&gt;
   | colspan=&amp;quot;2&amp;quot; align=&amp;quot;center&amp;quot;  | [[File:Project_Type_Files_TOOL.jpg|link=https://www.owasp.org/index.php/Category:OWASP_Tool]]&lt;br /&gt;
   |-&lt;br /&gt;
   | align=&amp;quot;center&amp;quot; valign=&amp;quot;top&amp;quot; width=&amp;quot;50%&amp;quot; rowspan=&amp;quot;2&amp;quot;| [[File:Owasp-incubator-trans-85.png|link=https://www.owasp.org/index.php/OWASP_Project_Stages#tab=Incubator_Projects|Incubator Project]]&lt;br /&gt;
   |-&lt;br /&gt;
   | align=&amp;quot;center&amp;quot; valign=&amp;quot;top&amp;quot; width=&amp;quot;50%&amp;quot;| [[File:Owasp-defenders-small.png|link=Defenders]]&lt;br /&gt;
   |-&lt;br /&gt;
   | colspan=&amp;quot;2&amp;quot; align=&amp;quot;center&amp;quot;  | [[File:MIT_License_Icon.png|85px|link=https://opensource.org/licenses/MIT|MIT License]]&lt;br /&gt;
   |}&lt;br /&gt;
|}&lt;br /&gt;
 &lt;br /&gt;
__NOTOC__ &amp;lt;headertabs /&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Project]]  [[Category:OWASP_Builders]] [[Category:OWASP_Defenders]]  [[Category:OWASP_Tool]]&lt;/div&gt;</summary>
		<author><name>Izar</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=OWASP_PyTM&amp;diff=254285</id>
		<title>OWASP PyTM</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=OWASP_PyTM&amp;diff=254285"/>
				<updated>2019-08-28T19:14:55Z</updated>
		
		<summary type="html">&lt;p&gt;Izar: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;width:100%;height:160px;border:0,margin:0;overflow: hidden;&amp;quot;&amp;gt;[[File:OWASP_Project_Header.jpg|link=]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;padding: 0;margin:0;margin-top:10px;text-align:left;&amp;quot; |-&lt;br /&gt;
| valign=&amp;quot;top&amp;quot;  style=&amp;quot;border-right: 1px dotted gray;padding-right:25px;&amp;quot; |&lt;br /&gt;
&lt;br /&gt;
==Project About==&lt;br /&gt;
{{Template:Project_About&lt;br /&gt;
  | project_name=PyTM&lt;br /&gt;
  | project_description=A Pythonic framework for threat-modeling-from-code&lt;br /&gt;
  | project_license=MIT License&lt;br /&gt;
  | leader_name1=Izar Tarandach&lt;br /&gt;
  | leader_name2= Matthew J. Coles&lt;br /&gt;
  | contributor_name1=Rohit Shambhuni&lt;br /&gt;
  | contributor_name2=Nick Ozmore&lt;br /&gt;
  | contributor_name3=Pooja Ahvad&lt;br /&gt;
  | presentation_link=https://www.youtube.com/watch?v=VbW-X0j35gw AppSecCali 2019 - Threat Model Every Story: Practical Continuous Threat Modeling Work for Your Team -&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==OWASP PyTM==&lt;br /&gt;
PyTM is an effort to enable developers to create and maintain threat models in a way that is natural for them, using a familiar OO syntax (Python, but should be generic enough to enable any developer with minimal OO experience to use it) to describe a system in terms of its elements and their attributes, in a way that can be easily shared, version-controlled and collaborated on.&lt;br /&gt;
&lt;br /&gt;
That description is a self-enclosed Python script that when run generates diagrams (DFDs and sequence), threats (based on a library of rules) and reports (joining diagrams and threats).&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;&lt;br /&gt;
	This is where you need to add your more robust project description. A project description should outline the purpose of the project, how it is used, and the value it provides to application security. Ideally, project descriptions should be written in such a way that there is no question what value the project provides to the software security community. This section will be seen and used in various places within the Projects Portal. Poorly written project descriptions therefore detract from a project’s visibility, so project leaders should ensure that the description is meaningful.  &lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Licensing==&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;&lt;br /&gt;
A project must be licensed under a community friendly or open source license.  For more information on OWASP recommended licenses, please see [https://www.owasp.org/index.php/OWASP_Licenses OWASP Licenses]. While OWASP does not promote any particular license over another, the vast majority of projects have chosen a Creative Commons license variant for documentation projects, or a GNU General Public License variant for tools and code projects.  This example assumes that you want to use the AGPL 3.0 license.&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This program is free software: you can redistribute it and/or modify it under the terms of the [https://opensource.org/licenses/MIT MIT License] as published by the Massachusetts Institute of Technology.  OWASP PyTM and any contributions are Copyright &amp;amp;copy; by the Project Leader(s).  &lt;br /&gt;
&lt;br /&gt;
==Roadmap==&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;&lt;br /&gt;
As of &amp;lt;strong&amp;gt;November, 2013, the highest priorities for the next 6 months&amp;lt;/strong&amp;gt; are:&lt;br /&gt;
&amp;lt;strong&amp;gt;&lt;br /&gt;
* Complete the first draft of the Tool Project Template&lt;br /&gt;
* Get other people to review the Tool Project Template and provide feedback&lt;br /&gt;
* Incorporate feedback into changes in the Tool Project Template&lt;br /&gt;
* Finalize the Tool Project template and have it reviewed to be promoted from an Incubator Project to a Lab Project&lt;br /&gt;
&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Subsequent Releases will add&lt;br /&gt;
&amp;lt;strong&amp;gt;&lt;br /&gt;
* Internationalization Support&lt;br /&gt;
* Additional Unit Tests&lt;br /&gt;
* Automated Regression tests&lt;br /&gt;
&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Getting Involved==&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;&lt;br /&gt;
Involvement in the development and promotion of &amp;lt;strong&amp;gt;Tool Project Template&amp;lt;/strong&amp;gt; is actively encouraged!&lt;br /&gt;
You do not have to be a security expert or a programmer to contribute.&lt;br /&gt;
Some of the ways you can help are as follows:&lt;br /&gt;
&lt;br /&gt;
| valign=&amp;quot;top&amp;quot;  style=&amp;quot;padding-left:25px;width:200px;border-right: 1px dotted gray;padding-right:25px;&amp;quot; |&lt;br /&gt;
&lt;br /&gt;
== Project Resources ==&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;&lt;br /&gt;
	This is where you can link to the key locations for project files, including setup programs, the source code repository, online documentation, a Wiki Home Page, threaded discussions about the project, and Issue Tracking system, etc. &lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[https://github.com/SamanthaGroves Installation Package]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/SamanthaGroves Source Code]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/SamanthaGroves What's New (Revision History)]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/SamanthaGroves Documentation]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/SamanthaGroves Wiki Home Page]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/SamanthaGroves Issue Tracker]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/SamanthaGroves Slide Presentation]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/SamanthaGroves Video]&lt;br /&gt;
&lt;br /&gt;
== Project Leader ==&lt;br /&gt;
Izar Tarandach&lt;br /&gt;
&lt;br /&gt;
Matthew J. Coles&lt;br /&gt;
&lt;br /&gt;
== Related Projects ==&lt;br /&gt;
* [[OWASP_Threat_Dragon]]&lt;br /&gt;
* [[OWASP_Automated_Threats_to_Web_Applications]]&lt;br /&gt;
&lt;br /&gt;
==Classifications==&lt;br /&gt;
&lt;br /&gt;
   {| width=&amp;quot;200&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
   |-&lt;br /&gt;
   | colspan=&amp;quot;2&amp;quot; align=&amp;quot;center&amp;quot;  | [[File:Project_Type_Files_TOOL.jpg|link=https://www.owasp.org/index.php/Category:OWASP_Tool]]&lt;br /&gt;
   |-&lt;br /&gt;
   | align=&amp;quot;center&amp;quot; valign=&amp;quot;top&amp;quot; width=&amp;quot;50%&amp;quot; rowspan=&amp;quot;2&amp;quot;| [[File:Owasp-incubator-trans-85.png|link=https://www.owasp.org/index.php/OWASP_Project_Stages#tab=Incubator_Projects|Incubator Project]]&lt;br /&gt;
   |-&lt;br /&gt;
   | align=&amp;quot;center&amp;quot; valign=&amp;quot;top&amp;quot; width=&amp;quot;50%&amp;quot;| [[File:Owasp-defenders-small.png|link=Defenders]]&lt;br /&gt;
   |-&lt;br /&gt;
   | colspan=&amp;quot;2&amp;quot; align=&amp;quot;center&amp;quot;  | [[File:MIT_License_Icon.png|85px|link=https://opensource.org/licenses/MIT|MIT License]]&lt;br /&gt;
   |}&lt;br /&gt;
|}&lt;br /&gt;
 &lt;br /&gt;
__NOTOC__ &amp;lt;headertabs /&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Project]]  [[Category:OWASP_Builders]] [[Category:OWASP_Defenders]]  [[Category:OWASP_Tool]]&lt;/div&gt;</summary>
		<author><name>Izar</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=User:Izar&amp;diff=253422</id>
		<title>User:Izar</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=User:Izar&amp;diff=253422"/>
				<updated>2019-07-30T13:39:14Z</updated>
		
		<summary type="html">&lt;p&gt;Izar: Updated bio&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Izar Tarandach is Lead Product Security Architect at Autodesk inc.. Prior, he was the Security Architect for Enterprise Hybrid Cloud at Dell EMC, for long before a Security Consultant at the EMC Product Security Office. With more years than he’s willing to admit to in the information security arena, he is a member of SAFECode Technical Leadership Council and a founding contributor to the IEEE Center for Security Design. He holds a masters degree in Computer Science/Security from Boston University and has served as an instructor in Digital Forensics at Boston University and in Secure Development at the University of Oregon.&lt;/div&gt;</summary>
		<author><name>Izar</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Projects/OWASP_Mobile_Security_Project_-2015_Scratchpad&amp;diff=195735</id>
		<title>Projects/OWASP Mobile Security Project -2015 Scratchpad</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Projects/OWASP_Mobile_Security_Project_-2015_Scratchpad&amp;diff=195735"/>
				<updated>2015-06-03T18:24:07Z</updated>
		
		<summary type="html">&lt;p&gt;Izar: /* Proposed Timeline */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is just a place to gather some ideas for the 2015 reworking of the Mobile Top Ten. It's totally unofficial open musings about truth, beauty, and justice.&lt;br /&gt;
&lt;br /&gt;
=Proposed Timeline=&lt;br /&gt;
&lt;br /&gt;
The content of the Mobile Top 10 will be refreshed at some cadence, and most probably not a short one. In between there will be needed changes as appropriate, but major changes will happen sparsely between &amp;quot;official releases&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In order to keep interest in the project and to offer deeper and more complete content, there is a proposal to supply architectural and code samples that illustrate the Top 10 items.&lt;br /&gt;
&lt;br /&gt;
As a first milestone it is suggested that 6 months after the Top 10 is released we are able to do a refresh launch offering the initial version of these samples.&lt;br /&gt;
&lt;br /&gt;
A set cadence for further refresh/release later on needs to be established as well.&lt;br /&gt;
&lt;br /&gt;
=What is It?=&lt;br /&gt;
&lt;br /&gt;
This is the &amp;quot;Mobile Top Ten&amp;quot; ''what''? It's the top 10 &amp;quot;stuff people tend to screw up&amp;quot;, but here are some important questions.&lt;br /&gt;
&lt;br /&gt;
* Business risk or technical risk? The business risk would be something like &amp;quot;intellectual property unprotected&amp;quot; or &amp;quot;customer data exposed.&amp;quot; A technical risk would be something like &amp;quot;data stored in plain text files.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* Root cause, or final impact? Often root causes are things like not encrypting when we should. Final impact is stuff like unintended data leaks. The problem is that some of these things are overlapping. Not every lack of crypto is a data leak, but many are.&lt;br /&gt;
&lt;br /&gt;
* What threats are in scope? There are apps that simply do not care about protecting from malware, jailbreaking, etc. Think Yelp: it's just restaurant reviews. No financial impact, no reason to care about many client-side attacks. Plenty of apps ''do'' care about client-side attacks. E.g., banking, communications, health data. Many items hinge on whether or not you care about client side attacks. How do we capture this?&lt;br /&gt;
** If you care about client-side attacks, then failing to encrypt stuff is basically a data leakage.&lt;br /&gt;
** If you don't care about client-side attacks, then failing to encrypt stuff is kinda &amp;quot;gee you should do that&amp;quot;.&lt;br /&gt;
** If you care about client-side attacks, there are probably some platform features that are not sufficient as-is: the app sandbox, etc. You probably want to be putting your own additional layer of encryptiong / protection, etc.&lt;br /&gt;
** If you don't care about client-side attacks, then you simply need to be using the standard APIs (keychain, app data storage, etc.) in the standard supported ways.&lt;br /&gt;
&lt;br /&gt;
=Who is it For?=&lt;br /&gt;
&lt;br /&gt;
Do we intend this to be a tool that infosec / appsec people use? Do we intend lay people to make use of it? (e.g., developers and non-mobile IT security people) What does the target audience need to get from it?&lt;br /&gt;
&lt;br /&gt;
(''Paco's opinion'') We need to have a narrative: If you found functionality that does X, it is probably in bucket A, unless it is also doing (or not doing) Y, in which case that's bucket B.&lt;br /&gt;
&lt;br /&gt;
=Comments on Submitted Data=&lt;br /&gt;
&lt;br /&gt;
==General==&lt;br /&gt;
&lt;br /&gt;
(Jason) By looking at some data sets it becomes clear there is a doctrine that some consultancies use to do mobile testing. Some did not contribute m1 data, because they consider mobile security client-only. The same applied to m10. In addition, a couple of datasets used CWE IDs. These were harder to parse because generic CWE's do not specify if the vuln is client or server (and in a lot of these cases the vuln could be either). As Paco stated, code quality, source level findings are hard to categorize as well.&lt;br /&gt;
&lt;br /&gt;
==BugCrowd==&lt;br /&gt;
I see “storing passwords in the clear” as a very common finding among their data. It gets classifed as M5 poor authentication, M2 insecure data storage, M4 data leakage, and sometimes M6 (broken crypto).&lt;br /&gt;
&lt;br /&gt;
I see “storing session tokens insecurely” as a common finding. It is getting classified as M9 (session handling) and M2 (insecure data storage). I wonder openly whether passwords and session tokens are really that different.&lt;br /&gt;
&lt;br /&gt;
We see a lot of caching of non-password, non-session data. Some of it is done explicitly by the app, some of it is done by the mobile OS through snapshotting, backups, etc. Sometimes it is classified as “data leakage” (M4) and sometimes as insecure storage (M2). And what is interesting is that some of it is the result of the OS and some is the result of the app. Do we want to make that distinction in the T10?&lt;br /&gt;
&lt;br /&gt;
==MetaIntelli==&lt;br /&gt;
&lt;br /&gt;
They only have 18 distinct things they report on, though they have 111,000 data points. Two of the 18 things are double-counted. They appear to be categorised in both M3 and another one.&lt;br /&gt;
&lt;br /&gt;
=Other Questions=&lt;br /&gt;
Communications issues are a problem a lot. But TLS and crypto are tightly coupled. “Communications issues&amp;quot; includes certificate pinning, weak TLS ciphers, improper cert validation, HTTP and plaintext protocols, and more. There’s a lot of overlap with “broken crypto” like using Base64 instead of encryption, hard coded keys/passwords, weak hash algorithms, and so on. How do we tease out “crypto” issues from “communications” issues from “insecure storage” issues?&lt;br /&gt;
&lt;br /&gt;
I can imagine a heuristic like this:&lt;br /&gt;
* did you use crypto where you were supposed to, but the crypto primitive you chose wasn’t appropriate for the task? That’s broken crypto.&lt;br /&gt;
* Did you omit crypto entirely when you should have used it? That’s insecure comms or insecure storage.&lt;br /&gt;
&lt;br /&gt;
Some findings are deeply mobile (e.g., intent hijacking, keychain issues, jailbreak/root detection, etc.). They’re really tied to their respective platforms. Is that a problem for us? Does it matter?&lt;br /&gt;
&lt;br /&gt;
=Conclusions Drawn From Data=&lt;br /&gt;
These are conclusions proposed from the 2014 data.&lt;br /&gt;
==At Least One New Category Is Needed==&lt;br /&gt;
((Paco)) The &amp;quot;Other&amp;quot; category is not the least popular category. It's more popular, by an order of magnitude, than several others. This tells me that if we had a better category that captured &amp;quot;other&amp;quot; findings, it would be a benefit to the users of the top 10.&lt;br /&gt;
&lt;br /&gt;
==The Bottom 5 Categories account for 25% Or Less==&lt;br /&gt;
&lt;br /&gt;
The least popular 5 items are (where &amp;quot;1&amp;quot; is the least popular and &amp;quot;5&amp;quot; is 5th least popular or 6th most popular):&lt;br /&gt;
&lt;br /&gt;
# M8: Security Decisions Via Untrusted Inputs&lt;br /&gt;
# M7: Client Side Injection&lt;br /&gt;
# M9: Improper Session Handling&lt;br /&gt;
# M6: Broken Cryptography&lt;br /&gt;
# M1: Weak Server Side Controls&lt;br /&gt;
&lt;br /&gt;
Combined with the fact that the 3rd or 4th most popular category is &amp;quot;Other&amp;quot;, this suggests that 2 or 3 of these are, in fact, not in the &amp;quot;top ten&amp;quot;. They may be, for example, 11 and 12 or even higher.&lt;br /&gt;
&lt;br /&gt;
==The Existing Buckets are Hard To Use==&lt;br /&gt;
&lt;br /&gt;
A few contributors tried to categorise their findings into the existing MT10. When they did, they showed symptoms of difficulty. Some examples in the table below show how MetaIntelli flagged findings in two different categories, and BugCrowd flagged the same kind of finding in 3 different categories. This suggests that the existing MT10 is not clear enough about where these issues belong.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! Description&lt;br /&gt;
! Contributor&lt;br /&gt;
! Categories&lt;br /&gt;
|-&lt;br /&gt;
|The app is not verifying hostname, certificate matching and validity when doing SSL secure connections.&lt;br /&gt;
|MetaIntelli&lt;br /&gt;
|M3 and M9&lt;br /&gt;
|-&lt;br /&gt;
|Contains URLs with not valid SSL certificates and/or chain of trust&lt;br /&gt;
|MetaIntelli&lt;br /&gt;
|M3 and M5&lt;br /&gt;
|-&lt;br /&gt;
|Authentication cookies stored in cleartext in sqlite database&lt;br /&gt;
|BugCrowd&lt;br /&gt;
|M9 - Improper Session Handling&lt;br /&gt;
|-&lt;br /&gt;
|Blackberry app stores credentials in plaintext&lt;br /&gt;
|BugCrowd&lt;br /&gt;
|M2 - Insecure Data Storage&lt;br /&gt;
|-&lt;br /&gt;
|Credentials and sensitive information not secured on Windows Phone app&lt;br /&gt;
|BugCrowd&lt;br /&gt;
|M5 - Poor Authorization and Authentication&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Some Topics that Show Up But Are Hard To Place==&lt;br /&gt;
&lt;br /&gt;
There are a few things that show up in the contributed data that do not have a good category to go into.&lt;br /&gt;
&lt;br /&gt;
===Code Level Findings===&lt;br /&gt;
&lt;br /&gt;
If someone is doing bad C coding (e.g., strcpy() and similar), there is no good bucket for that. Likewise, misusing the platform APIs (e.g., Android, iOS, etc.) is not well covered. It's hard to place violations of platform best practices (e.g., with intents and broadcasts and so on).&lt;br /&gt;
&lt;br /&gt;
Most of the Android developers use &amp;quot;printStackTrace&amp;quot; in their code, which is a bad practice. Even the Android APK is released in DEBUG mode.&lt;br /&gt;
&lt;br /&gt;
=OWASP Category Elements=&lt;br /&gt;
This section explores the critical elements that must be included within all OWASP Mobile Top Ten 2015 categories. Each element is listed below along with a brief description of the appropriate content. The goal is to &amp;quot;test drive&amp;quot; this list of required elements with a sample, non-commital category to verify that the elements adequately cover what is needed within each of the OWASP Mobile Top Ten 2015 categories. Each of these elements has been initially based off the Google Hangout meeting held on April 1 2015.&lt;br /&gt;
&lt;br /&gt;
==Label (generic and audience-specific labels)==&lt;br /&gt;
This element is a unique identifier for the bucket of issues that belong together. In the [https://docs.google.com/a/owasp.org/forms/d/1WMEbjVgXU4VkjHP5AcW934D9EI0_XQ5vmjb-Y5liMQY/viewform OWASP Mobile Top Ten 2015 Survey], we found that there were many different audiences that may use the OWASP Mobile Top Ten 2015 for different purposes. As always, there needs to be a generic label that uniquely identifies each bucket of issues. However, there should also be additional labels for the same category that are audience-specific to make it easier for different audiences to identify the category they are looking for. These additional labels will help clarify and differentiate the categories.&lt;br /&gt;
&lt;br /&gt;
==Overview Text==&lt;br /&gt;
This element is a generic education piece (100-200 words) around the nature of the category. It should describe the nature of the category as it relates to the different audiences (e.g., penetration testers; software engineers). It should include external references and educational links to other sources around the nature of the problem.&lt;br /&gt;
&lt;br /&gt;
==Prominent Characteristics==&lt;br /&gt;
This element eliminates any uncertainty or ambiguity that may result from vagueness / broadness in the category labels. It should include &amp;quot;headline vulnerabilities&amp;quot; that made it into the media and help each audience get a &amp;quot;gut feel&amp;quot; for what belongs to this category. In the 2014 list, we found that there were many instances where the same vulnerabilities were spread across many different categories. Hence, the need for this additional element along with a strive towards better categorisation.&lt;br /&gt;
&lt;br /&gt;
==Risk==&lt;br /&gt;
This element helps clarify how critical the category of issues is from both a business and technical perspective. During the meeting of April 1 2015, it was proposed that the CVSS classification scheme may be used here as a way of helping guide the audiences in prioritisation of the fixing of the issues.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
This element gives coding-specific examples, CVE vulnerabilities and newsworthy events that fall into this category. This element will help clarify to the difference audiences what fits into this category. &lt;br /&gt;
 &lt;br /&gt;
== Audience Specific Guidance==&lt;br /&gt;
This element gives practical advice and guidance for category remediation that is relevant to each audience (100-200 words). Each audience may approach the issue of remediation from very different perspectives. For example, an auditor may simply want to know more about whether or not remediation is appropriate. Meanwhile, a software engineer may want to have coding-specific advice.  Each audience's concerns must be addressed in this element. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=&amp;quot;Test Drive&amp;quot; Category Element=&lt;br /&gt;
Here, we are testing a particular category to see whether or not the proposed elements for each category are adequate to address each audience's needs. It is important to note that this is a sample category and is not a formal commitment to any final category in the OWASP Mobile Top Ten 2015. It is strictly meant for testing purposes. Members who would like to 'own' particular elements in the category below should 'sign up' and add content where appropriate.&lt;br /&gt;
&lt;br /&gt;
==Insecure Data Transmission==&lt;br /&gt;
&lt;br /&gt;
===Generic Label===&lt;br /&gt;
Owner(s): Jonathan Carter&lt;br /&gt;
&lt;br /&gt;
===Audience-Specific Labels===&lt;br /&gt;
Owner(s): Jonathan Carter&lt;br /&gt;
&lt;br /&gt;
===Overview Text===&lt;br /&gt;
&lt;br /&gt;
Mobile devices and applications can be used to transmit data over many communication channels. These channels include, but are not limited to:&lt;br /&gt;
&amp;quot;Wireless Cellular Protocols (2G, 3G, 4G, 5G, etc.), WiFi(Ad-Hoc, Infrastructure, and Peer to Peer modes), Bluetooth (and it's variants), Infrared, RFID, NFC, etc.&lt;br /&gt;
&lt;br /&gt;
Vulnerabilities in this category focus on weaknesses associated with &amp;quot;data in motion&amp;quot; when transmission occurs over the above noted communication channels. These vulnerabilities can arise as a result of one or more failures in adequately securing the communications channels including but not limited to: plain-text transmission of sensitive data (i.e. not utilizing adequate encryption over the communication channel), insufficient authentication of encrypted channel endpoints (i.e. Failing to confirm the identity of the remote end-point you are attempting secure transmissions with) and/or insufficiently/inadequately establishing the encryption communications protocol (i.e. using weak encryption secrets, ciphers and/or protocols).&lt;br /&gt;
&lt;br /&gt;
Owner(s): Milan Singh Thakur, Amin Lalji&lt;br /&gt;
&lt;br /&gt;
===Prominent Characteristics===&lt;br /&gt;
Owner(s): David Fern&lt;br /&gt;
&lt;br /&gt;
The key differentiator of this vulnerability is that it is concerned about unencrypted or improperly encrypted data being stolen during transmission, not on the device but through the airwaves.&lt;br /&gt;
&lt;br /&gt;
[[File:Data Transport.jpg]]&lt;br /&gt;
&lt;br /&gt;
'''Insecure Data Transmission should not be confused with others in the top 10 such as:&lt;br /&gt;
'''&lt;br /&gt;
&lt;br /&gt;
'''M3: Insufficient Transport Layer Protection''' – I DO NOT SEE ANT DIFFERENCE &lt;br /&gt;
&lt;br /&gt;
'''M4: Unintended Data Leakage''' – Unintended data leakage is a result of insecure data transmission. Once data has been stolen and interpreted it may contain information that is valuable to attackers (leaked). &lt;br /&gt;
&lt;br /&gt;
'''M6: Broken Cryptography''' – While broken cryptography does relate to data that has been improperly encrypted, and it may be an input or causes of insecure data transmission, it focuses on the encryption process/technique itself on the device transmitting the data.&lt;br /&gt;
&lt;br /&gt;
===Risk===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The risk attributed to mobile applications that suffer from this category of vulnerabilities rely upon the &amp;quot;business&amp;quot; value of the data being transmitted - however from a technical perspective, exploitation of this vulnerability can lead to a loss of confidentiality (i.e. access to confidential/sensitive data by unauthorized individuals/systems) and possibly a loss of integrity (i.e. data may be changed in transit).&lt;br /&gt;
&lt;br /&gt;
The ease of exploitation of this type vulnerability varies based on the communication channel, but generally speaking, is not an overly complex attack to successfully execute (i.e. when sensitive data is transmitted over WiFi in clear-text, it is trivial to intercept and review).&lt;br /&gt;
&lt;br /&gt;
Mitigating the risks associated with this category of vulnerabilities can take various forms depending on the transmission protocol being used.&lt;br /&gt;
&lt;br /&gt;
** Include examples here for protocol level security implemented with Layer 6/7 (TLS/HTTPS), WiFi, Bluetooth, NFC, RFID, etc.)&lt;br /&gt;
&lt;br /&gt;
Owner(s): Rajvinder Singh, Milan Singh Thakur, Amin Lalji&lt;br /&gt;
&lt;br /&gt;
===Examples===&lt;br /&gt;
Owner(s): Adam Kliarsky&lt;br /&gt;
&lt;br /&gt;
===Audience-Specific Guidance===&lt;br /&gt;
Owner(s): Andi Pannell, Amin Lalji&lt;br /&gt;
&lt;br /&gt;
From both a development and auditing stance, the easiest way to test this is to insert a proxy (such as burp) between the device running the mobile app and the wifi connection. &lt;br /&gt;
Looking for data being transferred over plain text, as well as identifying weak procotols (SSLv2, SSLv3) and ciphers (RC4, MD5) being used to transmit data.&lt;br /&gt;
&lt;br /&gt;
=Top Ten Scratchpad=&lt;br /&gt;
These are proposed new categories for the 2015 Mobile Top Ten. Edit them. Discuss them. Include inline comments with attirbution where possible.&lt;br /&gt;
&lt;br /&gt;
==Improper Platform Usage==&lt;br /&gt;
===Generic Label===&lt;br /&gt;
===Audience-Specific Label===&lt;br /&gt;
===Overview Text===&lt;br /&gt;
This category would cover misuse or failure to use platform security controls. It might include Android intents, platform permissions, misuse of TouchID, the Keychain, or some other security control that is part of the mobile operating system.&lt;br /&gt;
&lt;br /&gt;
===Prominent Characteristics===&lt;br /&gt;
===Risk===&lt;br /&gt;
===Examples===&lt;br /&gt;
&lt;br /&gt;
==Insecure Data ==&lt;br /&gt;
===Generic Label===&lt;br /&gt;
===Audience-Specific Label===&lt;br /&gt;
===Overview Text===&lt;br /&gt;
This new category will be a combination of M2 + M4 from Mobile Top Ten 2014.&lt;br /&gt;
&lt;br /&gt;
===Prominent Characteristics===&lt;br /&gt;
===Risk===&lt;br /&gt;
===Examples===&lt;br /&gt;
&lt;br /&gt;
==Insecure Communication (Owner: Andrew Blaich)==&lt;br /&gt;
===Generic Label===&lt;br /&gt;
===Audience-Specific Label===&lt;br /&gt;
===Overview Text===&lt;br /&gt;
This covers poor handshaking, incorrect SSL versions, weak negotiation, cleartext communication of sensitive assets, etc.&lt;br /&gt;
&lt;br /&gt;
===Prominent Characteristics===&lt;br /&gt;
===Risk===&lt;br /&gt;
===Examples===&lt;br /&gt;
&lt;br /&gt;
==Insecure Authentication==&lt;br /&gt;
===Generic Label===&lt;br /&gt;
===Audience-Specific Label===&lt;br /&gt;
===Overview Text===&lt;br /&gt;
Broken notions of authenticating the end user or bad session management.&lt;br /&gt;
&lt;br /&gt;
===Prominent Characteristics===&lt;br /&gt;
===Risk===&lt;br /&gt;
===Examples===&lt;br /&gt;
&lt;br /&gt;
==Insufficient Cryptography==&lt;br /&gt;
===Generic Label===&lt;br /&gt;
===Audience-Specific Label===&lt;br /&gt;
===Overview Text===&lt;br /&gt;
The code applies cryptography to a sensitive information asset. However, the cryptographic algorithm is flawed in some way.&lt;br /&gt;
&lt;br /&gt;
===Prominent Characteristics===&lt;br /&gt;
===Risk===&lt;br /&gt;
===Examples===&lt;br /&gt;
&lt;br /&gt;
==Insecure Authorization==&lt;br /&gt;
===Generic Label===&lt;br /&gt;
===Audience-Specific Label===&lt;br /&gt;
===Overview Text===&lt;br /&gt;
This used to be &amp;quot;Client Side Injection&amp;quot;, one of our lesser-used categories. This is a category to capture any failures in authorization (e.g., authorization decisions in the client side, forced browsing, etc.). It is distinct from authentication issues (e.g., device enrolment, user identification, etc.).&lt;br /&gt;
&lt;br /&gt;
===Prominent Characteristics===&lt;br /&gt;
===Risk===&lt;br /&gt;
===Examples===&lt;br /&gt;
&lt;br /&gt;
==Client Code Quality Issues==&lt;br /&gt;
===Generic Label===&lt;br /&gt;
===Audience-Specific Label===&lt;br /&gt;
===Overview Text===&lt;br /&gt;
This was &amp;quot;Security Decisions Via Untrusted Inputs&amp;quot;, one of our lesser-used categories. This would be the catch-all for code-level implementation problems in the mobile client. That's distinct from server-side coding mistakes. This would capture things like buffer overflows, format string vulnerabilities, and various other code-level mistakes where the solution is to rewrite some code that's running on the mobile device.&lt;br /&gt;
&lt;br /&gt;
===Prominent Characteristics===&lt;br /&gt;
===Risk===&lt;br /&gt;
===Examples===&lt;br /&gt;
&lt;br /&gt;
==Code Tampering (Owner: Jonathan Carter)==&lt;br /&gt;
===Generic Label===&lt;br /&gt;
===Audience-Specific Label===&lt;br /&gt;
===Overview Text===&lt;br /&gt;
This category covers binary patching, local resource modification, method hooking, method swizzling, and dynamic memory modification.&lt;br /&gt;
&lt;br /&gt;
===Prominent Characteristics===&lt;br /&gt;
===Risk===&lt;br /&gt;
===Examples===&lt;br /&gt;
&lt;br /&gt;
==Reverse Engineering (Owner: Jonathan Carter)==&lt;br /&gt;
===Generic Label===&lt;br /&gt;
===Audience-Specific Label===&lt;br /&gt;
===Overview Text===&lt;br /&gt;
This category includes analysis of the final core binary to determine its source code, libraries, algorithms, and other assets.  Think about using IDA Pro, Hopper, otool, and other binary inspection tools used to reverse engineer the application.  This is valuable to a hacker on its own.&lt;br /&gt;
&lt;br /&gt;
===Prominent Characteristics===&lt;br /&gt;
===Risk===&lt;br /&gt;
===Examples===&lt;br /&gt;
&lt;br /&gt;
==Extraneous Functionality (Owner: Andrew Blaich)==&lt;br /&gt;
===Generic Label===&lt;br /&gt;
===Audience-Specific Label===&lt;br /&gt;
&lt;br /&gt;
===Overview Text===&lt;br /&gt;
Often, developers include hidden backdoor functionality or other internal development security controls that are not intended to be released into a production environment. For example, a developer may accidentally include a password as a comment in a hybrid app. Another example includes disabling of 2-factor authentication during testing.&lt;br /&gt;
&lt;br /&gt;
===Prominent Characteristics===&lt;br /&gt;
===Risk===&lt;br /&gt;
===Examples===&lt;br /&gt;
&lt;br /&gt;
(Jason) Regarding m10 - Several submissions reported m10 vulns. Unfortunately some were types of services such as binary reputation scanners, that do not have the ability to check for dynamic or code level findings. In order to fix this i recommend a name change or re-working of this category.  I want to separate out the delineation of Anti-exploit vs Code Obfuscation/Anti-reversing. Must talk to group about this.&lt;/div&gt;</summary>
		<author><name>Izar</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Certificate_and_Public_Key_Pinning&amp;diff=195380</id>
		<title>Certificate and Public Key Pinning</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Certificate_and_Public_Key_Pinning&amp;diff=195380"/>
				<updated>2015-05-27T16:38:17Z</updated>
		
		<summary type="html">&lt;p&gt;Izar: /* What Is Pinning? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
[[Certificate and Public Key Pinning]] is a technical guide to implementing certificate and public key pinning as discussed at the ''[https://www.owasp.org/index.php/Virginia Virginia chapter's]'' presentation [[Media:Securing-Wireless-Channels-in-the-Mobile-Space.ppt|Securing Wireless Channels in the Mobile Space]]. This guide is focused on providing clear, simple, actionable guidance for securing the channel in a hostile environment where actors could be malicious and the conference of trust a liability. Additional presentation material included [[Media:pubkey-pin-supplement.pdf|supplement with code excerpts]], [[Media:pubkey-pin-android.zip|Android sample program]], [[Media:pubkey-pin-ios.zip|iOS sample program]], [[Media:pubkey-pin-dotnet.zip|.Net sample program]], and [[Media:pubkey-pin-openssl.zip|OpenSSL sample program]].&lt;br /&gt;
&lt;br /&gt;
A cheat sheet is available at [[Pinning_Cheat_Sheet|Pinning Cheat Sheet]].&lt;br /&gt;
&lt;br /&gt;
== Introduction == &lt;br /&gt;
&lt;br /&gt;
Secure channels are a cornerstone to users and employees working remotely and on the go. Users and developers expect end-to-end security when sending and receiving data - especially sensitive data on channels protected by VPN, SSL, or TLS. While organizations which control DNS and CA have likely reduced risk to trivial levels under most threat models, users and developers subjugated to other's DNS and a public CA hierarchy are exposed to non-trivial amounts of risk. In fact, history has shown those relying on outside services have suffered chronic breaches in their secure channels.&lt;br /&gt;
&lt;br /&gt;
The pandemic abuse of trust has resulted in users, developers and applications making security related decisions on untrusted input. The situation is somewhat of a paradox: entities such as DNS and CAs are trusted and supposed to supply trusted input; yet their input cannot be trusted. Relying on untrusted input for security related decisions is not only bad karma, it violates a number of secure coding principals (see, for example, OWASP's [[Injection Theory]] and [[Data Validation]]).&lt;br /&gt;
&lt;br /&gt;
Pinning effectively removes the &amp;quot;conference of trust&amp;quot;. An application which pins a certificate or public key no longer needs to depend on others - such as DNS or CAs - when making security decisions relating to a peer's identity. For those familiar with SSH, you should realize that public key pinning is nearly identical to SSH's &amp;lt;tt&amp;gt;StrictHostKeyChecking&amp;lt;/tt&amp;gt; option. SSH had it right the entire time, and the rest of the world is beginning to realize the virtues of directly identifying a host or service by its public key.&lt;br /&gt;
&lt;br /&gt;
Others who actively engage in pinning include Google and its browser Chrome. Chrome was successful in detecting the DigiNotar compromise which uncovered suspected interception by the Iranian government on its citizens. The initial report of the compromise can be found at ''[https://productforums.google.com/d/topic/gmail/3J3r2JqFNTw/discussion Is This MITM Attack to Gmail's SSL?]''; and Google Security's immediate response at ''[https://googleonlinesecurity.blogspot.com/2011/08/update-on-attempted-man-in-middle.html An update on attempted man-in-the-middle attacks]''.&lt;br /&gt;
&lt;br /&gt;
== What's the problem? ==&lt;br /&gt;
&lt;br /&gt;
Users, developers, and applications expect end-to-end security on their secure channels, but some secure channels are not meeting the expectation. Specifically, channels built using well known protocols such as VPN, SSL, and TLS can be vulnerable to a number of attacks.&lt;br /&gt;
&lt;br /&gt;
Examples of past failures are listed on the discussion tab for this article. This cheat sheet does not attempt to catalogue the failures in the industry, investigate the design flaws in the scaffolding, justify the lack of accountability or liability with the providers, explain the race to the bottom in services, or demystify the collusion between, for example, Browsers and CAs. For additional reading, please visit ''[http://www.cs.auckland.ac.nz/~pgut001/pubs/pkitutorial.pdf PKI is Broken]'' and ''[http://blog.cryptographyengineering.com/2012/02/how-to-fix-internet.html The Internet is Broken]''.&lt;br /&gt;
&lt;br /&gt;
=== Patient 0 ===&lt;br /&gt;
&lt;br /&gt;
The original problem was the ''Key Distribution Problem''. Insecure communications can be transformed into a secure communication problem with encryption. Encrypted communications can be transformed into an identity problem with signatures. The identity problem terminates at the key distribution problem. They are the same problem.&lt;br /&gt;
&lt;br /&gt;
=== The Cures ===&lt;br /&gt;
&lt;br /&gt;
There are three cures for the key distribution problem. First is to have first hand knowledge of your partner or peer (i.e., a peer, server or service). This could be solved with SneakerNet. Unfortunately, SneakerNet does not scale and cannot be used to solve the key distribution problem.&lt;br /&gt;
&lt;br /&gt;
The second is to rely on others, and it has two variants: (1) web of trust, and (2) hierarchy of trust. Web of Trust and Hierarchy of Trust solve the key distribution problem in a sterile environment. However, Web of Trust and Hierarchy of Trust each requires us to rely on others - or '''confer trust'''. In practice, trusting others is showing to be problematic.&lt;br /&gt;
&lt;br /&gt;
== What Is Pinning? ==&lt;br /&gt;
&lt;br /&gt;
Pinning is the process of associating a host with their ''expected'' X509 certificate or public key. Once a certificate or public key is known or seen for a host, the certificate or public key is associated or 'pinned' to the host. If more than one certificate or public key is acceptable, then the program holds a ''pinset'' (taking from [https://developers.google.com/events/io/sessions/gooio2012/107/ Jon Larimer and Kenny Root Google I/O talk]). In this case, the advertised identity must match one of the elements in the pinset.&lt;br /&gt;
&lt;br /&gt;
A host or service's certificate or public key can be added to an application at development time, or it can be added upon first encountering the certificate or public key. The former - adding at development time - is preferred since ''preloading'' the certificate or public key ''out of band'' usually means the attacker cannot taint the pin. If the certificate or public key is added upon first encounter, you will be using ''key continuity''. Key continuity can fail if the attacker has a privileged position during the first first encounter.&lt;br /&gt;
&lt;br /&gt;
Pinning leverages knowledge of the pre-existing relationship between the user and an organization or service to help make better security related decisions. Because you already have information on the server or service, you don't need to rely on generalized mechanisms meant to solve the ''key distribution'' problem. That is, you don't need to turn to DNS for name/address mappings or CAs for bindings and status. One exception is revocation and it is discussed below in [[#Pinning_Gaps|Pinning Gaps]].&lt;br /&gt;
&lt;br /&gt;
It is also worth mention that Pinning is not Stapling. Stapling sends both the certificate and  OCSP responder information in the same request to avoid the additional fetches the client should perform during path validations.&lt;br /&gt;
&lt;br /&gt;
=== When Do You Pin? ===&lt;br /&gt;
&lt;br /&gt;
You should pin anytime you want to be relatively certain of the remote host's identity or when operating in a hostile environment. Since one or both are almost always true, you should probably pin all the time.&lt;br /&gt;
&lt;br /&gt;
A perfect case in point: during the two weeks or so of preparation for the presentation and cheat sheet, we've observed three relevant and related failures. First was [http://gaurangkp.wordpress.com/2013/01/09/nokia-https-mitm/ Nokia/Opera willfully breaking the secure channel]; second was [http://blog.malwarebytes.org/intelligence/2013/02/digital-certificates-and-malware-a-dangerous-mix/ DigiCert issuing a code signing certificate for malware]; and third was [http://krebsonsecurity.com/2013/02/security-firm-bit9-hacked-used-to-spread-malware/ Bit9's loss of its root signing key]. The environment is not only hostile, its toxic.&lt;br /&gt;
&lt;br /&gt;
=== When Do You Whitelist? ===&lt;br /&gt;
&lt;br /&gt;
If you are working for an organization which practices &amp;quot;egress filtering&amp;quot; as part of a Data Loss Prevention (DLP) strategy, you will likely encounter ''Interception Proxies''. I like to refer to these things as '''&amp;quot;good&amp;quot; bad guys''' (as opposed to '''&amp;quot;bad&amp;quot; bad guys''') since both break end-to-end security and we can't tell them apart. In this case, '''do not''' offer to whitelist the interception proxy since it defeats your security goals. Add the interception proxy's public key to your pinset after being '''instructed''' to do so by the folks in Risk Acceptance.&lt;br /&gt;
&lt;br /&gt;
Note: if you whitelist a certificate or public key for a different host (for example, to accommodate an interception proxy), you are no longer pinning the expected certificates and keys for the host. Security and integrity on the channel could suffer, and it surely breaks end-to-end security expectations of users and organizations.&lt;br /&gt;
&lt;br /&gt;
For more reading on interception proxies, the additional risk they bestow, and how they fail, see Dr. Matthew Green's ''[http://blog.cryptographyengineering.com/2012/03/how-do-interception-proxies-fail.html How do Interception Proxies fail?]'' and Jeff Jarmoc's BlackHat talk ''[https://www.blackhat.com/html/bh-eu-12/bh-eu-12-archives.html#jarmoc SSL/TLS Interception Proxies and Transitive Trust]''.&lt;br /&gt;
&lt;br /&gt;
=== How Do You Pin? ===&lt;br /&gt;
&lt;br /&gt;
The idea is to re-use the exiting protocols and infrastructure, but use them in a hardened manner. For re-use, a program would keep doing the things it used to do when establishing a secure connection.&lt;br /&gt;
&lt;br /&gt;
To harden the channel, the program would take advantage of the &amp;lt;tt&amp;gt;OnConnect&amp;lt;/tt&amp;gt; callback offered by a library, framework or platform. In the callback, the program would verify the remote host's identity by validating its certificate or public key. While pinning does not have to occur in an &amp;lt;tt&amp;gt;OnConnect&amp;lt;/tt&amp;gt; callback, its often most convenient because the underlying connection information is readily available.&lt;br /&gt;
&lt;br /&gt;
== What Should Be Pinned? ==&lt;br /&gt;
&lt;br /&gt;
The first thing to decide is what should be pinned. For this choice, you have two options: you can (1) pin  the certificate; or (2) pin the public key. If you choose public keys, you have two additional choices: (a) pin the &amp;lt;tt&amp;gt;subjectPublicKeyInfo&amp;lt;/tt&amp;gt;; or (b) pin one of the concrete types such as &amp;lt;tt&amp;gt;RSAPublicKey&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;DSAPublicKey&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The three choices are explained below in more detail. I would encourage you to pin the &amp;lt;tt&amp;gt;subjectPublicKeyInfo&amp;lt;/tt&amp;gt; because it has the public parameters (such as &amp;lt;tt&amp;gt;{e,n}&amp;lt;/tt&amp;gt; for an RSA public key) '''and''' contextual information such as an algorithm and OID. The context will help you keep your bearings at times, and Figure 1 below shows the additional information available.&lt;br /&gt;
&lt;br /&gt;
=== Encodings/Formats ===&lt;br /&gt;
&lt;br /&gt;
For the purposes of this article, the objects are in X509-compatible presentation format (PKCS#1 defers to X509, both of which use ASN.1). If you have a PEM encoded object (for example, &amp;lt;tt&amp;gt;-----BEGIN CERTIFICATE-----&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;-----END CERTIFICATE-----&amp;lt;/tt&amp;gt;), then convert the object to DER encoding. Conversion using OpenSSL is offered below in [[#Format_Conversions|Format Conversions]].&lt;br /&gt;
&lt;br /&gt;
A certificate is an object which binds an entity (such as a person or organization) to a public key via a signature. The certificate is DER encoded, and has associated data or attributes such as ''Subject'' (who is identified or bound), ''Issuer'' (who signed it), ''Validity'' (''NotBefore'' and ''NotAfter''), and a ''Public Key''.&lt;br /&gt;
&lt;br /&gt;
A certificate has a ''subjectPublicKeyInfo''. The subjectPublicKeyInfo is a key with additional information. The ASN.1 type includes an ''Algorithm ID'', a ''Version'', and an extensible format to hold a concrete public key. Figures 1 and 2 below show different views of the same RSA key, which is the subjectPublicKeyInfo. The key is for the site [https://www.random.org random.org], and it is used in the sample programs and listings below.&lt;br /&gt;
&lt;br /&gt;
{| align=&amp;quot;center&amp;quot;&lt;br /&gt;
| [[File:random-org-der-dump.png|thumb|375px|Figure 1: subjectPublicKeyInfo dumped with dumpans1]]&lt;br /&gt;
| [[File:random-org-der-hex.png|thumb|375px|Figure 2: subjectPublicKeyInfo under a hex editor]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The concrete public key is an encoded public key. The key format will usually be specified elsewhere - for example, PKCS#1 in the case of RSA Public Keys. In the case of an RSA public key, the type is ''RSAPublicKey'' and the parameters &amp;lt;tt&amp;gt;{e,n}&amp;lt;/tt&amp;gt; will be ASN.1 encoded. Figures 1 and 2 above clearly show the modulus (''n'' at line 28) and exponent (''e'' at line 289). For DSA, the concrete type is DSAPublicKey and the ASN.1 encoded parameters would be &amp;lt;tt&amp;gt;{p,q,g,y}&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Final takeaways: (1) a certificate binds an entity to a public key; (2) a certificate has a subjectPublicKeyInfo; and (3) a subjectPublicKeyInfo has an concrete public key. For those who want to learn more, a more in-depth discussion from a programmer's perspective can be found at the Code Project's article ''[http://www.codeproject.com/Articles/25487/Cryptographic-Interoperability-Keys Cryptographic Interoperability: Keys]''.&lt;br /&gt;
&lt;br /&gt;
=== Certificate ===&lt;br /&gt;
&lt;br /&gt;
[[File:pin-cert.png|thumb|right|100px|Certificate]] The certificate is easiest to pin. You can fetch the certificate out of band for the website, have the IT folks email your company certificate to you, use &amp;lt;tt&amp;gt;openssl s_client&amp;lt;/tt&amp;gt; to retrieve the certificate etc. When the certificate expires, you would update your application. Assuming your application has no bugs or security defects, the application would be updated every year or two.&lt;br /&gt;
&lt;br /&gt;
At runtime, you retrieve the website or server's certificate in the callback. Within the callback, you compare the retrieved certificate with the certificate embedded within the program. If the comparison fails, then fail the method or function. &lt;br /&gt;
&lt;br /&gt;
There is a downside to pinning a certificate. If the site rotates its certificate on a regular basis, then your application would need to be updated regularly. For example, Google rotates its certificates, so you will need to update your application about once a month (if it depended on Google services). Even though Google rotates its certificates, the underlying public keys (within the certificate) remain static.&lt;br /&gt;
&lt;br /&gt;
=== Public Key ===&lt;br /&gt;
&lt;br /&gt;
[[File:pin-pubkey.png|thumb|right|100px|Public Key]] Public key pinning is more flexible but a little trickier due to the extra steps necessary to extract the public key from a certificate. As with a certificate, the program checks the extracted public key with its embedded copy of the public key.&lt;br /&gt;
&lt;br /&gt;
There are two downsides two public key pinning. First, its harder to work with keys (versus certificates) since you usually must extract the key from the certificate. Extraction is a minor inconvenience in Java and .Net, buts its uncomfortable in Cocoa/CocoaTouch and OpenSSL. Second, the key is static and may violate key rotation policies.&lt;br /&gt;
&lt;br /&gt;
=== Hashing ===&lt;br /&gt;
&lt;br /&gt;
While the three choices above used DER encoding, its also acceptable to use a hash of the information (or other transforms). In fact, the original sample programs were written using digested certificates and public keys. The samples were changed to allow a programmer to inspect the objects with tools like &amp;lt;tt&amp;gt;dumpasn1&amp;lt;/tt&amp;gt; and other ASN.1 decoders.&lt;br /&gt;
&lt;br /&gt;
Hashing also provides three additional benefits. First, hashing allows you to anonymize a certificate or public key. This might be important if you application is concerned about leaking information during decompilation and re-engineering.&lt;br /&gt;
&lt;br /&gt;
Second, a digested certificate fingerprint is often available as a native API for many libraries, so its convenient to use.&lt;br /&gt;
&lt;br /&gt;
Finally, an organization might want to supply a reserve (or back-up) identity in case the primary identity is compromised. Hashing ensures your adversaries do not see the reserved certificate or public key in advance of its use. In fact, Google's IETF draft ''websec-key-pinning'' uses the technique.&lt;br /&gt;
&lt;br /&gt;
== What About X509? ==&lt;br /&gt;
&lt;br /&gt;
PKI{X} and the Internet form an intersection. What Internet users expect and what they receive from CAs could vary wildly. For example, an Internet user has security goals, while a CA has revenue goals and legal goals. Many are surprised to learn that the user is often required to perform host identity verification even though the CA issued the certificate (the details are buried in CA warranties on their certificates and their Certification Practice Statement (CPS)).&lt;br /&gt;
&lt;br /&gt;
There are a number of PKI profiles available. For the Internet, &amp;quot;Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL)&amp;quot;, also known as [http://tools.ietf.org/rfc/rfc5280.txt RFC 5280], is of interest. Since a certificate is specified in the ITU's X509 standard, there are lots of mandatory and optional fields available for validation from both bodies. Because of the disjoint goals among groups, the next section provides guidance.&lt;br /&gt;
&lt;br /&gt;
=== Mandatory Checks ===&lt;br /&gt;
&lt;br /&gt;
All X509 verifications must include:&lt;br /&gt;
&lt;br /&gt;
* A path validation check. The check verifies all the signatures on certificates in the chain are valid under a given PKI. The check begins at the server or service's certificate (the leaf), and proceeds back to a trusted root certificate (the root).&lt;br /&gt;
&lt;br /&gt;
* A validity check, or the &amp;lt;tt&amp;gt;notBefore&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;notAfter&amp;lt;/tt&amp;gt; fields. The &amp;lt;tt&amp;gt;notAfter&amp;lt;/tt&amp;gt; field is especially important since a CA will not warrant the certificate after the date, and it does not have to provide CRL/OCSP updates after the date.&lt;br /&gt;
&lt;br /&gt;
* Revocation status. As with &amp;lt;tt&amp;gt;notAfter&amp;lt;/tt&amp;gt;, revocation is important because the CA will not warrant a certificate once it is listed as revoked. The IETF approved way of checking a certificate's revocation is OCSP and specified in [http://tools.ietf.org/rfc/rfc2560.txt RFC 2560].&lt;br /&gt;
&lt;br /&gt;
=== Optional Checks ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;[Mulling over what else to present, and the best way to present it. Subject name? DNS lookups? Key Usage? Algorithms? Geolocation based on IP? Check back soon.]&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
In the model which pre-dated PKIX RFC-5280, X.509v1 there was strong binding of the certificate Subject name to the X.500 Directory.  With the update to X.509v3, the Directory is  still the standard for authentication of caCertificate attributes, versus accepting a self signed root. Geo-location is important, the fake certificate for Google was given a location of Florida, instead of Mountain View, CA. The binding of the certificate to the Directory can anchor the root caCertificate, in effect &amp;quot;pin&amp;quot; it, to a valid entity that can have demonstrable attributes such as location.  This is detailed in RFC-1255.  Additional fields specified, such as the subject alternative field, for example a RFC-822 email address, or DNS name, can be located in the DNS, but the actual heavy lifting is done by the X.500 Directory, which is used currently as a cross-certificate trust conduit at the Federal Bridge between major communities of interest, that are not Internet focused. While those cross-certificates are valuable in validation between trust communities, a self-signed root, still needs to be either pinned, curated in trust bundle such as in  web browser software secure storage or represented by a federated community. The Directory can play a role to fill in gaps to validate caCertificates, either locally, or nationally under an administrative domain such as c=US. By divorcing the subject from the Directory entry, problems begin to arise in which pinning plays a key role to ensure that client and server have the same reference points.&lt;br /&gt;
&lt;br /&gt;
=== Public Key Checks ===&lt;br /&gt;
&lt;br /&gt;
''Quod vide'' (''q.v.''). Verifying the identity of a host with knowledge of its associated/expected public key is pinning.&lt;br /&gt;
&lt;br /&gt;
== Examples of Pinning ==&lt;br /&gt;
&lt;br /&gt;
This section demonstrates certificate and public key pinning in Android Java, iOS, .Net, and OpenSSL. All programs attempt to connect to [https://www.random.org random.org] and fetch bytes (Dr. Mads Haahr participates in AOSP's pinning program, so the site should have a static key). The programs enjoy a pre-existing relationship with the site (more correctly, ''a priori'' knowledge), so they include a copy of the site's public key and pin the identity on the key.&lt;br /&gt;
&lt;br /&gt;
Parameter validation, return value checking, and error checking have been omitted in the code below, but is present in the sample programs. So the sample code is ready for copy/paste. By far, the most uncomfortable languages are C-based: iOS and OpenSSL.&lt;br /&gt;
&lt;br /&gt;
===HTTP pinning===&lt;br /&gt;
[http://www.rfc-editor.org/rfc/rfc7469.txt RFC 7469] introduced a new HTTP header that allows SSL servers to declare hashes of their certificates with time scope in which these certificates should not be changed. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
       Public-Key-Pins: max-age=2592000;&lt;br /&gt;
       pin-sha256=&amp;quot;E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g=&amp;quot;;&lt;br /&gt;
       pin-sha256=&amp;quot;LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ=&amp;quot;;&lt;br /&gt;
       report-uri=&amp;quot;http://example.com/pkp-report&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Android ===&lt;br /&gt;
&lt;br /&gt;
Pinning in Android is accomplished through a custom &amp;lt;tt&amp;gt;X509TrustManager&amp;lt;/tt&amp;gt;. &amp;lt;tt&amp;gt;X509TrustManager&amp;lt;/tt&amp;gt; should perform the customary X509 checks in addition to performing the pin.&lt;br /&gt;
&lt;br /&gt;
Download: [[Media:pubkey-pin-android.zip|Android sample program]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;public final class PubKeyManager implements X509TrustManager&lt;br /&gt;
{&lt;br /&gt;
  private static String PUB_KEY = &amp;quot;30820122300d06092a864886f70d0101&amp;quot; +&lt;br /&gt;
    &amp;quot;0105000382010f003082010a0282010100b35ea8adaf4cb6db86068a836f3c85&amp;quot; +&lt;br /&gt;
    &amp;quot;5a545b1f0cc8afb19e38213bac4d55c3f2f19df6dee82ead67f70a990131b6bc&amp;quot; +&lt;br /&gt;
    &amp;quot;ac1a9116acc883862f00593199df19ce027c8eaaae8e3121f7f329219464e657&amp;quot; +&lt;br /&gt;
    &amp;quot;2cbf66e8e229eac2992dd795c4f23df0fe72b6ceef457eba0b9029619e0395b8&amp;quot; +&lt;br /&gt;
    &amp;quot;609851849dd6214589a2ceba4f7a7dcceb7ab2a6b60c27c69317bd7ab2135f50&amp;quot; +&lt;br /&gt;
    &amp;quot;c6317e5dbfb9d1e55936e4109b7b911450c746fe0d5d07165b6b23ada7700b00&amp;quot; +&lt;br /&gt;
    &amp;quot;33238c858ad179a82459c4718019c111b4ef7be53e5972e06ca68a112406da38&amp;quot; +&lt;br /&gt;
    &amp;quot;cf60d2f4fda4d1cd52f1da9fd6104d91a34455cd7b328b02525320a35253147b&amp;quot; +&lt;br /&gt;
    &amp;quot;e0b7a5bc860966dc84f10d723ce7eed5430203010001&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
  public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException&lt;br /&gt;
  {&lt;br /&gt;
    if (chain == null) {&lt;br /&gt;
      throw new IllegalArgumentException(&amp;quot;checkServerTrusted: X509Certificate array is null&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    if (!(chain.length &amp;gt; 0)) {&lt;br /&gt;
      throw new IllegalArgumentException(&amp;quot;checkServerTrusted: X509Certificate is empty&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    if (!(null != authType &amp;amp;&amp;amp; authType.equalsIgnoreCase(&amp;quot;RSA&amp;quot;))) {&lt;br /&gt;
      throw new CertificateException(&amp;quot;checkServerTrusted: AuthType is not RSA&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // Perform customary SSL/TLS checks&lt;br /&gt;
    try {&lt;br /&gt;
      TrustManagerFactory tmf = TrustManagerFactory.getInstance(&amp;quot;X509&amp;quot;);&lt;br /&gt;
      tmf.init((KeyStore) null);&lt;br /&gt;
      &lt;br /&gt;
      for (TrustManager trustManager : tmf.getTrustManagers()) {&lt;br /&gt;
        ((X509TrustManager) trustManager).checkServerTrusted(chain, authType);&lt;br /&gt;
      }&lt;br /&gt;
    } catch (Exception e) {&lt;br /&gt;
      throw new CertificateException(e);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // Hack ahead: BigInteger and toString(). We know a DER encoded Public Key begins&lt;br /&gt;
    // with 0x30 (ASN.1 SEQUENCE and CONSTRUCTED), so there is no leading 0x00 to drop.&lt;br /&gt;
    RSAPublicKey pubkey = (RSAPublicKey) chain[0].getPublicKey();&lt;br /&gt;
    String encoded = new BigInteger(1 /* positive */, pubkey.getEncoded()).toString(16);&lt;br /&gt;
&lt;br /&gt;
    // Pin it!&lt;br /&gt;
    final boolean expected = PUB_KEY.equalsIgnoreCase(encoded);&lt;br /&gt;
    if (!expected) {&lt;br /&gt;
      throw new CertificateException(&amp;quot;checkServerTrusted: Expected public key: &amp;quot;&lt;br /&gt;
                + PUB_KEY + &amp;quot;, got public key:&amp;quot; + encoded);&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;PubKeyManager&amp;lt;/tt&amp;gt; would be used in code similar to below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;TrustManager tm[] = { new PubKeyManager() };&lt;br /&gt;
&lt;br /&gt;
SSLContext context = SSLContext.getInstance(&amp;quot;TLS&amp;quot;);&lt;br /&gt;
context.init(null, tm, null);&lt;br /&gt;
&lt;br /&gt;
URL url = new URL( &amp;quot;https://www.random.org/integers/?&amp;quot; +&lt;br /&gt;
                   &amp;quot;num=16&amp;amp;min=0&amp;amp;max=255&amp;amp;col=16&amp;amp;base=10&amp;amp;format=plain&amp;amp;rnd=new&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();&lt;br /&gt;
connection.setSSLSocketFactory(context.getSocketFactory());&lt;br /&gt;
&lt;br /&gt;
InputStreamReader instream = new InputStreamReader(connection.getInputStream());&lt;br /&gt;
StreamTokenizer tokenizer = new StreamTokenizer(instream);&lt;br /&gt;
...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== iOS ===&lt;br /&gt;
&lt;br /&gt;
iOS pinning is performed through a &amp;lt;tt&amp;gt;NSURLConnectionDelegate&amp;lt;/tt&amp;gt;. The delegate must implement &amp;lt;tt&amp;gt;connection:canAuthenticateAgainstProtectionSpace:&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;connection:didReceiveAuthenticationChallenge:&amp;lt;/tt&amp;gt;. Within &amp;lt;tt&amp;gt;connection:didReceiveAuthenticationChallenge:&amp;lt;/tt&amp;gt;, the delegate must call &amp;lt;tt&amp;gt;SecTrustEvaluate&amp;lt;/tt&amp;gt; to perform customary X509 checks.&lt;br /&gt;
&lt;br /&gt;
Download: [[Media:pubkey-pin-ios.zip|iOS sample program]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;-(IBAction)fetchButtonTapped:(id)sender&lt;br /&gt;
{&lt;br /&gt;
    NSString* requestString = @&amp;quot;https://www.random.org/integers/?&lt;br /&gt;
        num=16&amp;amp;min=0&amp;amp;max=255&amp;amp;col=16&amp;amp;base=16&amp;amp;format=plain&amp;amp;rnd=new&amp;quot;;&lt;br /&gt;
    NSURL* requestUrl = [NSURL URLWithString:requestString];&lt;br /&gt;
&lt;br /&gt;
    NSURLRequest* request = [NSURLRequest requestWithURL:requestUrl&lt;br /&gt;
                                             cachePolicy:NSURLRequestReloadIgnoringLocalCacheData&lt;br /&gt;
                                         timeoutInterval:10.0f];&lt;br /&gt;
&lt;br /&gt;
    NSURLConnection* connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
-(BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:&lt;br /&gt;
                  (NSURLProtectionSpace*)space&lt;br /&gt;
{&lt;br /&gt;
    return [[space authenticationMethod] isEqualToString: NSURLAuthenticationMethodServerTrust];&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
- (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:&lt;br /&gt;
                   (NSURLAuthenticationChallenge *)challenge&lt;br /&gt;
{&lt;br /&gt;
  if ([[[challenge protectionSpace] authenticationMethod] isEqualToString: NSURLAuthenticationMethodServerTrust])&lt;br /&gt;
  {&lt;br /&gt;
    do&lt;br /&gt;
    {&lt;br /&gt;
      SecTrustRef serverTrust = [[challenge protectionSpace] serverTrust];&lt;br /&gt;
      if(nil == serverTrust)&lt;br /&gt;
        break; /* failed */&lt;br /&gt;
&lt;br /&gt;
      OSStatus status = SecTrustEvaluate(serverTrust, NULL);&lt;br /&gt;
      if(!(errSecSuccess == status))&lt;br /&gt;
        break; /* failed */&lt;br /&gt;
&lt;br /&gt;
      SecCertificateRef serverCertificate = SecTrustGetCertificateAtIndex(serverTrust, 0);&lt;br /&gt;
      if(nil == serverCertificate)&lt;br /&gt;
        break; /* failed */&lt;br /&gt;
&lt;br /&gt;
      CFDataRef serverCertificateData = SecCertificateCopyData(serverCertificate);&lt;br /&gt;
      [(id)serverCertificateData autorelease];&lt;br /&gt;
      if(nil == serverCertificateData)&lt;br /&gt;
        break; /* failed */&lt;br /&gt;
&lt;br /&gt;
      const UInt8* const data = CFDataGetBytePtr(serverCertificateData);&lt;br /&gt;
      const CFIndex size = CFDataGetLength(serverCertificateData);&lt;br /&gt;
      NSData* cert1 = [NSData dataWithBytes:data length:(NSUInteger)size];&lt;br /&gt;
&lt;br /&gt;
      NSString *file = [[NSBundle mainBundle] pathForResource:@&amp;quot;random-org&amp;quot; ofType:@&amp;quot;der&amp;quot;];&lt;br /&gt;
      NSData* cert2 = [NSData dataWithContentsOfFile:file];&lt;br /&gt;
&lt;br /&gt;
      if(nil == cert1 || nil == cert2)&lt;br /&gt;
        break; /* failed */&lt;br /&gt;
&lt;br /&gt;
      const BOOL equal = [cert1 isEqualToData:cert2];&lt;br /&gt;
      if(!equal)&lt;br /&gt;
        break; /* failed */&lt;br /&gt;
&lt;br /&gt;
      // The only good exit point&lt;br /&gt;
      return [[challenge sender] useCredential: [NSURLCredential credentialForTrust: serverTrust]&lt;br /&gt;
                    forAuthenticationChallenge: challenge];&lt;br /&gt;
    } while(0);&lt;br /&gt;
&lt;br /&gt;
    // Bad dog&lt;br /&gt;
    return [[challenge sender] cancelAuthenticationChallenge: challenge];&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== .Net ===&lt;br /&gt;
&lt;br /&gt;
.Net pinning can be achieved by using &amp;lt;tt&amp;gt;ServicePointManager&amp;lt;/tt&amp;gt; as shown below.&lt;br /&gt;
&lt;br /&gt;
Download: [[Media:pubkey-pin-dotnet.zip|.Net sample program]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;// Encoded RSAPublicKey&lt;br /&gt;
private static String PUB_KEY = &amp;quot;30818902818100C4A06B7B52F8D17DC1CCB47362&amp;quot; +&lt;br /&gt;
    &amp;quot;C64AB799AAE19E245A7559E9CEEC7D8AA4DF07CB0B21FDFD763C63A313A668FE9D764E&amp;quot; +&lt;br /&gt;
    &amp;quot;D913C51A676788DB62AF624F422C2F112C1316922AA5D37823CD9F43D1FC54513D14B2&amp;quot; +&lt;br /&gt;
    &amp;quot;9E36991F08A042C42EAAEEE5FE8E2CB10167174A359CEBF6FACC2C9CA933AD403137EE&amp;quot; +&lt;br /&gt;
    &amp;quot;2C3F4CBED9460129C72B0203010001&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
public static void Main(string[] args)&lt;br /&gt;
{&lt;br /&gt;
  ServicePointManager.ServerCertificateValidationCallback = PinPublicKey;&lt;br /&gt;
  WebRequest wr = WebRequest.Create(&amp;quot;https://encrypted.google.com/&amp;quot;);&lt;br /&gt;
  wr.GetResponse();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public static bool PinPublicKey(object sender, X509Certificate certificate, X509Chain chain,&lt;br /&gt;
                                SslPolicyErrors sslPolicyErrors)&lt;br /&gt;
{&lt;br /&gt;
  if (null == certificate)&lt;br /&gt;
    return false;&lt;br /&gt;
&lt;br /&gt;
  String pk = certificate.GetPublicKeyString();&lt;br /&gt;
  if (pk.Equals(PUB_KEY))&lt;br /&gt;
    return true;&lt;br /&gt;
&lt;br /&gt;
  // Bad dog&lt;br /&gt;
  return false;&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== OpenSSL ===&lt;br /&gt;
&lt;br /&gt;
Pinning can occur at one of two places with OpenSSL. First is the user supplied &amp;lt;tt&amp;gt;verify_callback&amp;lt;/tt&amp;gt;. Second is after the connection is established via &amp;lt;tt&amp;gt;SSL_get_peer_certificate&amp;lt;/tt&amp;gt;. Either method will allow you to access the peer's certificate.&lt;br /&gt;
&lt;br /&gt;
Though OpenSSL performs the X509 checks, you must fail the connection and tear down the socket on error. By design, a server that does not supply a certificate will result in &amp;lt;tt&amp;gt;X509_V_OK&amp;lt;/tt&amp;gt; with a '''NULL''' certificate. To check the result of the customary verification: (1) you must call &amp;lt;tt&amp;gt;SSL_get_verify_result&amp;lt;/tt&amp;gt; and verify the return code is &amp;lt;tt&amp;gt;X509_V_OK&amp;lt;/tt&amp;gt;; and (2) you must call &amp;lt;tt&amp;gt;SSL_get_peer_certificate&amp;lt;/tt&amp;gt; and verify the certificate is '''non-NULL'''.&lt;br /&gt;
&lt;br /&gt;
Download: [[Media:pubkey-pin-openssl.zip|OpenSSL sample program]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int pkp_pin_peer_pubkey(SSL* ssl)&lt;br /&gt;
{&lt;br /&gt;
    if(NULL == ssl) return FALSE;&lt;br /&gt;
    &lt;br /&gt;
    X509* cert = NULL;&lt;br /&gt;
    FILE* fp = NULL;&lt;br /&gt;
    &lt;br /&gt;
    /* Scratch */&lt;br /&gt;
    int len1 = 0, len2 = 0;&lt;br /&gt;
    unsigned char *buff1 = NULL, *buff2 = NULL;&lt;br /&gt;
    &lt;br /&gt;
    /* Result is returned to caller */&lt;br /&gt;
    int ret = 0, result = FALSE;&lt;br /&gt;
    &lt;br /&gt;
    do&lt;br /&gt;
    {&lt;br /&gt;
        /* http://www.openssl.org/docs/ssl/SSL_get_peer_certificate.html */&lt;br /&gt;
        cert = SSL_get_peer_certificate(ssl);&lt;br /&gt;
        if(!(cert != NULL))&lt;br /&gt;
            break; /* failed */&lt;br /&gt;
        &lt;br /&gt;
        /* Begin Gyrations to get the subjectPublicKeyInfo       */&lt;br /&gt;
        /* Thanks to Viktor Dukhovni on the OpenSSL mailing list */&lt;br /&gt;
        &lt;br /&gt;
        /* http://groups.google.com/group/mailing.openssl.users/browse_thread/thread/d61858dae102c6c7 */&lt;br /&gt;
        len1 = i2d_X509_PUBKEY(X509_get_X509_PUBKEY(cert), NULL);&lt;br /&gt;
        if(!(len1 &amp;gt; 0))&lt;br /&gt;
            break; /* failed */&lt;br /&gt;
        &lt;br /&gt;
        /* scratch */&lt;br /&gt;
        unsigned char* temp = NULL;&lt;br /&gt;
        &lt;br /&gt;
        /* http://www.openssl.org/docs/crypto/buffer.html */&lt;br /&gt;
        buff1 = temp = OPENSSL_malloc(len1);&lt;br /&gt;
        if(!(buff1 != NULL))&lt;br /&gt;
            break; /* failed */&lt;br /&gt;
        &lt;br /&gt;
        /* http://www.openssl.org/docs/crypto/d2i_X509.html */&lt;br /&gt;
        len2 = i2d_X509_PUBKEY(X509_get_X509_PUBKEY(cert), &amp;amp;temp);&lt;br /&gt;
&lt;br /&gt;
        /* These checks are verifying we got back the same values as when we sized the buffer.      */&lt;br /&gt;
        /* Its pretty weak since they should always be the same. But it gives us something to test. */&lt;br /&gt;
        if(!((len1 == len2) &amp;amp;&amp;amp; (temp != NULL) &amp;amp;&amp;amp; ((temp - buff1) == len1)))&lt;br /&gt;
            break; /* failed */&lt;br /&gt;
        &lt;br /&gt;
        /* End Gyrations */&lt;br /&gt;
        &lt;br /&gt;
        /* See the warning above!!!                                            */&lt;br /&gt;
        /* http://pubs.opengroup.org/onlinepubs/009696699/functions/fopen.html */&lt;br /&gt;
        fp = fopen(&amp;quot;random-org.der&amp;quot;, &amp;quot;rx&amp;quot;);&lt;br /&gt;
        if(NULL ==fp) {&lt;br /&gt;
            fp = fopen(&amp;quot;random-org.der&amp;quot;, &amp;quot;r&amp;quot;);&lt;br /&gt;
        &lt;br /&gt;
        if(!(NULL != fp))&lt;br /&gt;
            break; /* failed */&lt;br /&gt;
        &lt;br /&gt;
        /* Seek to eof to determine the file's size                            */&lt;br /&gt;
        /* http://pubs.opengroup.org/onlinepubs/009696699/functions/fseek.html */&lt;br /&gt;
        ret = fseek(fp, 0, SEEK_END);&lt;br /&gt;
        if(!(0 == ret))&lt;br /&gt;
            break; /* failed */&lt;br /&gt;
        &lt;br /&gt;
        /* Fetch the file's size                                               */&lt;br /&gt;
        /* http://pubs.opengroup.org/onlinepubs/009696699/functions/ftell.html */&lt;br /&gt;
        long size = ftell(fp);&lt;br /&gt;
&lt;br /&gt;
        /* Arbitrary size, but should be relatively small (less than 1K or 2K) */&lt;br /&gt;
        if(!(size != -1 &amp;amp;&amp;amp; size &amp;gt; 0 &amp;amp;&amp;amp; size &amp;lt; 2048))&lt;br /&gt;
            break; /* failed */&lt;br /&gt;
        &lt;br /&gt;
        /* Rewind to beginning to perform the read                             */&lt;br /&gt;
        /* http://pubs.opengroup.org/onlinepubs/009696699/functions/fseek.html */&lt;br /&gt;
        ret = fseek(fp, 0, SEEK_SET);&lt;br /&gt;
        if(!(0 == ret))&lt;br /&gt;
            break; /* failed */&lt;br /&gt;
        &lt;br /&gt;
        /* Re-use buff2 and len2 */&lt;br /&gt;
        buff2 = NULL; len2 = (int)size;&lt;br /&gt;
        &lt;br /&gt;
        /* http://www.openssl.org/docs/crypto/buffer.html */&lt;br /&gt;
        buff2 = OPENSSL_malloc(len2);&lt;br /&gt;
        if(!(buff2 != NULL))&lt;br /&gt;
            break; /* failed */&lt;br /&gt;
        &lt;br /&gt;
        /* http://pubs.opengroup.org/onlinepubs/009696699/functions/fread.html */&lt;br /&gt;
        /* Returns number of elements read, which should be 1 */&lt;br /&gt;
        ret = (int)fread(buff2, (size_t)len2, 1, fp);&lt;br /&gt;
        if(!(ret == 1))&lt;br /&gt;
            break; /* failed */&lt;br /&gt;
        &lt;br /&gt;
        /* Re-use size. MIN and MAX macro below... */&lt;br /&gt;
        size = len1 &amp;lt; len2 ? len1 : len2;&lt;br /&gt;
        &lt;br /&gt;
        /*************************/&lt;br /&gt;
        /*****    PAYDIRT    *****/&lt;br /&gt;
        /*************************/&lt;br /&gt;
        if(len1 != (int)size || len2 != (int)size || 0 != memcmp(buff1, buff2, (size_t)size))&lt;br /&gt;
            break; /* failed */&lt;br /&gt;
        &lt;br /&gt;
        /* The one good exit point */&lt;br /&gt;
        result = TRUE;&lt;br /&gt;
        &lt;br /&gt;
    } while(0);&lt;br /&gt;
    &lt;br /&gt;
    if(fp != NULL)&lt;br /&gt;
        fclose(fp);&lt;br /&gt;
    &lt;br /&gt;
    /* http://www.openssl.org/docs/crypto/buffer.html */&lt;br /&gt;
    if(NULL != buff2)&lt;br /&gt;
        OPENSSL_free(buff2);&lt;br /&gt;
    &lt;br /&gt;
    /* http://www.openssl.org/docs/crypto/buffer.html */&lt;br /&gt;
    if(NULL != buff1)&lt;br /&gt;
        OPENSSL_free(buff1);&lt;br /&gt;
    &lt;br /&gt;
    /* http://www.openssl.org/docs/crypto/X509_new.html */&lt;br /&gt;
    if(NULL != cert)&lt;br /&gt;
        X509_free(cert);&lt;br /&gt;
    &lt;br /&gt;
    return result;&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Pinning Alternatives ==&lt;br /&gt;
&lt;br /&gt;
Not all applications use split key cryptography. Fortunately, there are protocols which allow you to set up a secure channel based on knowledge of passwords and pre-shared secrets (rather than putting the secret on the wire in a basic authentication scheme). Two are listed below - SRP and PSK. SRP and PSK have [http://www.iana.org/assignments/tls-parameters/tls-parameters.xml#tls-parameters-3 88 cipher suites assigned to them by IANA for TLS], so there's no shortage of choices.&lt;br /&gt;
&lt;br /&gt;
{| align=&amp;quot;center&amp;quot;&lt;br /&gt;
| [[File:pin-iana-assigned.png|thumb|450px|Figure 3: IANA reserved cipher suites for SRP and PSK]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== SRP ===&lt;br /&gt;
&lt;br /&gt;
Secure Remote Password (SRP) is a Password Authenticated Key Exchange (PAKE) by Thomas Wu based upon Diffie-Hellman. The protocol is standardized in [https://tools.ietf.org/rfc/rfc5054.txt RFC 5054] and available in the OpenSSL library (among others). In the SRP scheme, the server uses a verifier which consists of a &amp;lt;tt&amp;gt;{salt, hash(password)}&amp;lt;/tt&amp;gt; pair. The user has the password and receives the salt from the server. With lots of hand waving, both parties select per-instance random values (nonces) and execute the protocol using ''g&amp;lt;sup&amp;gt;{(salt + password)|verifier} + nonces&amp;lt;/sup&amp;gt;'' rather than traditional Diffie-Hellman using ''g&amp;lt;sup&amp;gt;ab&amp;lt;/sup&amp;gt;''.&lt;br /&gt;
&lt;br /&gt;
[[File:homer-p-np.jpg|thumb|right|150px|P=NP!!!]]Diffie-Hellman based schemes are part of a family of problems based on Discrete Logs (DL), which are logarithms over a finite field. DL schemes are appealing because they are known to be hard (unless ''P=NP'', which would cause computational number theorists to have a cow).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== PSK ===&lt;br /&gt;
&lt;br /&gt;
PSK is Pre-Shared Key and specified in [https://tools.ietf.org/rfc/rfc4279.txt RFC 4279] and [https://tools.ietf.org/rfc/rfc4764.txt RFC 4764]. The shared secret is used as a pre-master secret in TLS-PSK for SSL/TLS; or used to key a block cipher in EAP-PSK. EAP-PSK is designed for authentication over insecure networks such as IEEE 802.11.&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous ==&lt;br /&gt;
&lt;br /&gt;
This sections covers administrivia and miscellaneous items related to pinning.&lt;br /&gt;
&lt;br /&gt;
=== Ephemeral Keys ===&lt;br /&gt;
&lt;br /&gt;
Ephemeral keys are temporary keys used for one instance of a protocol execution and then thrown away. An ephemeral key has the benefit of providing forward secrecy, meaning a compromise of the site or service's long term (static) signing key does not facilitate decrypting past messages because the key was temporary and discarded (once the session terminated).&lt;br /&gt;
&lt;br /&gt;
Ephemeral keys do not affect pinning because the Ephemeral key is delivered in a separate &amp;lt;tt&amp;gt;ServerKeyExchange&amp;lt;/tt&amp;gt; message. In addition, the ephemeral key is a key and not a certificate, so it does not change the construction of the certificate chain. That is, the certificate of interest will still be located at &amp;lt;tt&amp;gt;certificates[0]&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Pinning Gaps ===&lt;br /&gt;
&lt;br /&gt;
There are two gaps when pinning due to reuse of the existing infrastructure and protocols. First, an explicit challenge is '''not''' sent by the program to the peer server based on the server's public information. So the program never knows if the peer can actually decrypt messages. However, the shortcoming is usually academic in practice since an adversary will receive messages it can't decrypt.&lt;br /&gt;
&lt;br /&gt;
Second is revocation. Clients don't usually engage in revocation checking, so it could be possible to use a known bad certificate or key in a pinset. Even if revocation is active, Certificate Revocation Lists (CRLs) and Online Certificate Status Protocol (OCSP) can be defeated in a hostile environment. An application can take steps to remediate, with the primary means being freshness. That is, an application should be updated and distributed immediately when a critical security parameter changes.&lt;br /&gt;
&lt;br /&gt;
=== No Relationship ^@$! ===&lt;br /&gt;
&lt;br /&gt;
If you don't have a pre-existing relationship, all is not lost. First, you can pin a host or server's certificate or public key the first time you encounter it. If the bad guy was not active when you encountered the certificate or public key, he or she will not be successful with future funny business.&lt;br /&gt;
&lt;br /&gt;
Second, bad certificates are being spotted quicker in the field due to projects like [http://www.chromium.org Chromium] and [https://addons.mozilla.org/en-us/firefox/addon/certificate-patrol/ Certificate Patrol], and initiatives like the EFF's [https://www.eff.org/observatory SSL Observatory].&lt;br /&gt;
&lt;br /&gt;
Third, help is on its way, and there are a number of futures that will assist with the endeavors:&lt;br /&gt;
&lt;br /&gt;
* Public Key Pinning (http://www.ietf.org/id/draft-ietf-websec-key-pinning-09.txt) – an extension to the HTTP protocol allowing web host operators to instruct user agents (UAs) to remember (&amp;quot;pin&amp;quot;) the hosts' cryptographic identities for a given period of time.&lt;br /&gt;
* DNS-based Authentication of Named Entities (DANE) (https://datatracker.ietf.org/doc/rfc6698/) - uses Secure DNS to associate Certificates with Domain Names For S/MIME, SMTP with TLS, DNSSEC and TLSA records.&lt;br /&gt;
* Sovereign Keys (http://www.eff.org/sovereign-keys) - operates by providing an optional and secure way of associating domain names with public keys via DNSSEC. PKI (hierarchical) is still used. Semi-centralized with append only logging.&lt;br /&gt;
* Convergence (http://convergence.io) – different [geographical] views of a site and its associated data (certificates and public keys). Web of Trust is used. Semi-centralized.&lt;br /&gt;
&lt;br /&gt;
While Sovereign Keys and Convergence still require us to confer trust to outside parties, the parties involved do not serve share holders or covet revenue streams. Their interests are industry transparency and user security.&lt;br /&gt;
&lt;br /&gt;
=== More Information? ===&lt;br /&gt;
&lt;br /&gt;
Pinning is an ''old new thing'' that has been shaken, stirred, and repackaged. While &amp;quot;pinning&amp;quot; and &amp;quot;pinsets&amp;quot; are relatively new terms for old things, Jon Larimer and Kenny Root spent time on the subject at Google I/O 2012 with their talk ''[https://developers.google.com/events/io/sessions/gooio2012/107/ Security and Privacy in Android Apps]''.&lt;br /&gt;
&lt;br /&gt;
=== Format Conversions ===&lt;br /&gt;
&lt;br /&gt;
As a convenience to readers, the following with convert between PEM and DER format using OpenSSL.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# Public key, X509&lt;br /&gt;
$ openssl genrsa -out rsa-openssl.pem 3072&lt;br /&gt;
$ openssl rsa -in rsa-openssl.pem -pubout -outform DER -out rsa-openssl.der&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# Private key, PKCS#8&lt;br /&gt;
$ openssl genrsa -out rsa-openssl.pem 3072&lt;br /&gt;
$ openssl pkcs8 -nocrypt -in rsa-openssl.pem -inform PEM -topk8 -outform DER -out rsa-openssl.der&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* OWASP [[Injection_Theory|Injection Theory]]&lt;br /&gt;
* OWASP [[Data_Validation|Data Validation]]&lt;br /&gt;
* OWASP [[Transport_Layer_Protection_Cheat_Sheet|Transport Layer Protection Cheat Sheet]]&lt;br /&gt;
* IETF [http://www.ietf.org/id/draft-ietf-websec-key-pinning-09.txt Public Key Pinning]&lt;br /&gt;
* IETF [http://www.ietf.org/rfc/rfc5054.txt RFC 5054 (SRP)]&lt;br /&gt;
* IETF [http://www.ietf.org/rfc/rfc4764.txt RFC 4764 (EAP-PSK)]&lt;br /&gt;
* IETF [http://www.ietf.org/rfc/rfc1421.txt RFC 1421 (PEM Encoding)]&lt;br /&gt;
* IETF [http://www.ietf.org/rfc/rfc5280.txt RFC 5280 (Internet X.509, PKIX)]&lt;br /&gt;
* IETF [http://www.ietf.org/rfc/rfc4648.txt RFC 4648 (Base16, Base32, and Base64 Encodings)]&lt;br /&gt;
* IETF [http://www.ietf.org/rfc/rfc3279.txt RFC 3279 (PKI, X509 Algorithms and CRL Profiles)]&lt;br /&gt;
* IETF [http://www.ietf.org/rfc/rfc4055.txt RFC 4055 (PKI, X509 Additional Algorithms and CRL Profiles)]&lt;br /&gt;
* IETF [http://www.ietf.org/rfc/rfc2246.txt RFC 2246 (TLS 1.0)]&lt;br /&gt;
* IETF [http://www.ietf.org/rfc/rfc4346.txt RFC 4346 (TLS 1.1)]&lt;br /&gt;
* IETF [http://www.ietf.org/rfc/rfc5246.txt RFC 5246 (TLS 1.2)]&lt;br /&gt;
* IETF [http://www.ietf.org/rfc/rfc6698.txt RFC 6698, Draft (DANE)]&lt;br /&gt;
* EFF [http://www.eff.org/sovereign-keys Sovereign Keys]&lt;br /&gt;
* Thoughtcrime Labs [http://convergence.io/ Convergence]&lt;br /&gt;
* RSA Laboratories [http://www.rsa.com/rsalabs/node.asp?id=2125 PKCS#1, RSA Encryption Standard]&lt;br /&gt;
* RSA Laboratories [http://www.rsa.com/rsalabs/node.asp?id=2128 PKCS#6, Extended-Certificate Syntax Standard]&lt;br /&gt;
* ITU [http://www.itu.int/rec/T-REC-X.690-200811-I/en Specification of Basic Encoding Rules (BER), Canonical Encoding Rules (CER) and Distinguished Encoding Rules (DER)]&lt;br /&gt;
* TOR Project [https://blog.torproject.org/blog/detecting-certificate-authority-compromises-and-web-browser-collusion Detecting Certificate Authority Compromises and Web Browser Collusion]&lt;br /&gt;
* Code Project [http://www.codeproject.com/Articles/25487/Cryptographic-Interoperability-Keys Cryptographic Interoperability: Keys]&lt;br /&gt;
* Google I/O [https://developers.google.com/events/io/sessions/gooio2012/107/ Security and Privacy in Android Apps]&lt;br /&gt;
* Trevor Perrin [https://crypto.stanford.edu/RealWorldCrypto/slides/perrin.pdf Transparency, Trust Agility, Pinning (Recent Developments in Server Authentication)]&lt;br /&gt;
* Dr. Peter Gutmann's [http://www.cs.auckland.ac.nz/~pgut001/pubs/pkitutorial.pdf PKI is Broken]&lt;br /&gt;
* Dr. Matthew Green's [http://blog.cryptographyengineering.com/2012/02/how-to-fix-internet.html The Internet is Broken]&lt;br /&gt;
* Dr. Matthew Green's [http://blog.cryptographyengineering.com/2012/03/how-do-interception-proxies-fail.html How do Interception Proxies fail?]&lt;br /&gt;
&lt;br /&gt;
= Authors and Primary Editors  =&lt;br /&gt;
&lt;br /&gt;
* Jeffrey Walton - jeffrey, owasp.org&lt;br /&gt;
* JohnSteven - john, owasp.org&lt;br /&gt;
* Jim Manico - jim, owasp.org&lt;br /&gt;
* Kevin Wall - kevin, owasp.org&lt;br /&gt;
&lt;br /&gt;
[[Category:Control]]&lt;/div&gt;</summary>
		<author><name>Izar</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Projects/OWASP_Mobile_Security_Project_-2015_Scratchpad&amp;diff=192678</id>
		<title>Projects/OWASP Mobile Security Project -2015 Scratchpad</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Projects/OWASP_Mobile_Security_Project_-2015_Scratchpad&amp;diff=192678"/>
				<updated>2015-04-02T17:32:37Z</updated>
		
		<summary type="html">&lt;p&gt;Izar: wordsmithing&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is just a place to gather some ideas for the 2015 reworking of the Mobile Top Ten. It's totally unofficial open musings about truth, beauty, and justice.&lt;br /&gt;
&lt;br /&gt;
=What is It?=&lt;br /&gt;
&lt;br /&gt;
This is the &amp;quot;Mobile Top Ten&amp;quot; ''what''? It's the top 10 &amp;quot;stuff people tend to screw up&amp;quot;, but here are some important questions.&lt;br /&gt;
&lt;br /&gt;
* Business risk or technical risk? The business risk would be something like &amp;quot;intellectual property unprotected&amp;quot; or &amp;quot;customer data exposed.&amp;quot; A technical risk would be something like &amp;quot;data stored in plain text files.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* Root cause, or final impact? Often root causes are things like not encrypting when we should. Final impact is stuff like unintended data leaks. The problem is that some of these things are overlapping. Not every lack of crypto is a data leak, but many are.&lt;br /&gt;
&lt;br /&gt;
* What threats are in scope? There are apps that simply do not care about protecting from malware, jailbreaking, etc. Think Yelp: it's just restaurant reviews. No financial impact, no reason to care about many client-side attacks. Plenty of apps ''do'' care about client-side attacks. E.g., banking, communications, health data. Many items hinge on whether or not you care about client side attacks. How do we capture this?&lt;br /&gt;
** If you care about client-side attacks, then failing to encrypt stuff is basically a data leakage.&lt;br /&gt;
** If you don't care about client-side attacks, then failing to encrypt stuff is kinda &amp;quot;gee you should do that&amp;quot;.&lt;br /&gt;
** If you care about client-side attacks, there are probably some platform features that are not sufficient as-is: the app sandbox, etc. You probably want to be putting your own additional layer of encryptiong / protection, etc.&lt;br /&gt;
** If you don't care about client-side attacks, then you simply need to be using the standard APIs (keychain, app data storage, etc.) in the standard supported ways.&lt;br /&gt;
&lt;br /&gt;
=Who is it For?=&lt;br /&gt;
&lt;br /&gt;
Do we intend this to be a tool that infosec / appsec people use? Do we intend lay people to make use of it? (e.g., developers and non-mobile IT security people) What does the target audience need to get from it?&lt;br /&gt;
&lt;br /&gt;
(''Paco's opinion'') We need to have a narrative: If you found functionality that does X, it is probably in bucket A, unless it is also doing (or not doing) Y, in which case that's bucket B.&lt;br /&gt;
&lt;br /&gt;
=Comments on Submitted Data=&lt;br /&gt;
&lt;br /&gt;
==General==&lt;br /&gt;
&lt;br /&gt;
(Jason) By looking at some data sets it becomes clear there is a doctrine that some consultancies use to do mobile testing. Some did not contribute m1 data, because they consider mobile security client-only. The same applied to m10. In addition, a couple of datasets used CWE IDs. These were harder to parse because generic CWE's do not specify if the vuln is client or server (and in a lot of these cases the vuln could be either). As Paco stated, code quality, source level findings are hard to categorize as well.&lt;br /&gt;
&lt;br /&gt;
==BugCrowd==&lt;br /&gt;
I see “storing passwords in the clear” as a very common finding among their data. It gets classifed as M5 poor authentication, M2 insecure data storage, M4 data leakage, and sometimes M6 (broken crypto).&lt;br /&gt;
&lt;br /&gt;
I see “storing session tokens insecurely” as a common finding. It is getting classified as M9 (session handling) and M2 (insecure data storage). I wonder openly whether passwords and session tokens are really that different.&lt;br /&gt;
&lt;br /&gt;
We see a lot of caching of non-password, non-session data. Some of it is done explicitly by the app, some of it is done by the mobile OS through snapshotting, backups, etc. Sometimes it is classified as “data leakage” (M4) and sometimes as insecure storage (M2). And what is interesting is that some of it is the result of the OS and some is the result of the app. Do we want to make that distinction in the T10?&lt;br /&gt;
&lt;br /&gt;
==MetaIntelli==&lt;br /&gt;
&lt;br /&gt;
They only have 18 distinct things they report on, though they have 111,000 data points. Two of the 18 things are double-counted. They appear to be categorised in both M3 and another one.&lt;br /&gt;
&lt;br /&gt;
=Other Questions=&lt;br /&gt;
Communications issues are a problem a lot. But TLS and crypto are tightly coupled. “Communications issues&amp;quot; includes certificate pinning, weak TLS ciphers, improper cert validation, HTTP and plaintext protocols, and more. There’s a lot of overlap with “broken crypto” like using Base64 instead of encryption, hard coded keys/passwords, weak hash algorithms, and so on. How do we tease out “crypto” issues from “communications” issues from “insecure storage” issues?&lt;br /&gt;
&lt;br /&gt;
I can imagine a heuristic like this:&lt;br /&gt;
* did you use crypto where you were supposed to, but the crypto primitive you chose wasn’t appropriate for the task? That’s broken crypto.&lt;br /&gt;
* Did you omit crypto entirely when you should have used it? That’s insecure comms or insecure storage.&lt;br /&gt;
&lt;br /&gt;
Some findings are deeply mobile (e.g., intent hijacking, keychain issues, jailbreak/root detection, etc.). They’re really tied to their respective platforms. Is that a problem for us? Does it matter?&lt;br /&gt;
&lt;br /&gt;
=Conclusions Drawn From Data=&lt;br /&gt;
These are conclusions proposed from the 2014 data.&lt;br /&gt;
==At Least One New Category Is Needed==&lt;br /&gt;
((Paco)) The &amp;quot;Other&amp;quot; category is not the least popular category. It's more popular, by an order of magnitude, than several others. This tells me that if we had a better category that captured &amp;quot;other&amp;quot; findings, it would be a benefit to the users of the top 10.&lt;br /&gt;
&lt;br /&gt;
==The Bottom 5 Categories account for 25% Or Less==&lt;br /&gt;
&lt;br /&gt;
The least popular 5 items are (where &amp;quot;1&amp;quot; is the least popular and &amp;quot;5&amp;quot; is 5th least popular or 6th most popular):&lt;br /&gt;
&lt;br /&gt;
# M8: Security Decisions Via Untrusted Inputs&lt;br /&gt;
# M7: Client Side Injection&lt;br /&gt;
# M9: Improper Session Handling&lt;br /&gt;
# M6: Broken Cryptography&lt;br /&gt;
# M1: Weak Server Side Controls&lt;br /&gt;
&lt;br /&gt;
Combined with the fact that the 3rd or 4th most popular category is &amp;quot;Other&amp;quot;, this suggests that 2 or 3 of these are, in fact, not in the &amp;quot;top ten&amp;quot;. They may be, for example, 11 and 12 or even higher.&lt;br /&gt;
&lt;br /&gt;
==The Existing Buckets are Hard To Use==&lt;br /&gt;
&lt;br /&gt;
A few contributors tried to categorise their findings into the existing MT10. When they did, they showed symptoms of difficulty. Some examples in the table below show how MetaIntelli flagged findings in two different categories, and BugCrowd flagged the same kind of finding in 3 different categories. This suggests that the existing MT10 is not clear enough about where these issues belong.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! Description&lt;br /&gt;
! Contributor&lt;br /&gt;
! Categories&lt;br /&gt;
|-&lt;br /&gt;
|The app is not verifying hostname, certificate matching and validity when doing SSL secure connections.&lt;br /&gt;
|MetaIntelli&lt;br /&gt;
|M3 and M9&lt;br /&gt;
|-&lt;br /&gt;
|Contains URLs with not valid SSL certificates and/or chain of trust&lt;br /&gt;
|MetaIntelli&lt;br /&gt;
|M3 and M5&lt;br /&gt;
|-&lt;br /&gt;
|Authentication cookies stored in cleartext in sqlite database&lt;br /&gt;
|BugCrowd&lt;br /&gt;
|M9 - Improper Session Handling&lt;br /&gt;
|-&lt;br /&gt;
|Blackberry app stores credentials in plaintext&lt;br /&gt;
|BugCrowd&lt;br /&gt;
|M2 - Insecure Data Storage&lt;br /&gt;
|-&lt;br /&gt;
|Credentials and sensitive information not secured on Windows Phone app&lt;br /&gt;
|BugCrowd&lt;br /&gt;
|M5 - Poor Authorization and Authentication&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Some Topics that Show Up But Are Hard To Place==&lt;br /&gt;
&lt;br /&gt;
There are a few things that show up in the contributed data that do not have a good category to go into.&lt;br /&gt;
&lt;br /&gt;
===Code Level Findings===&lt;br /&gt;
&lt;br /&gt;
If someone is doing bad C coding (e.g., strcpy() and similar), there is no good bucket for that. Likewise, misusing the platform APIs (e.g., Android, iOS, etc.) is not well covered. It's hard to place violations of platform best practices (e.g., with intents and broadcasts and so on).&lt;br /&gt;
&lt;br /&gt;
Most of the Android developers use &amp;quot;printStackTrace&amp;quot; in their code, which is a bad practice. Even the Android APK is released in DEBUG mode.&lt;br /&gt;
&lt;br /&gt;
=OWASP Category Elements=&lt;br /&gt;
This section explores the critical elements that must be included within all OWASP Mobile Top Ten 2015 categories. Each element is listed below along with a brief description of the appropriate content. The goal is to &amp;quot;test drive&amp;quot; this list of required elements with a sample, non-commital category to verify that the elements adequately cover what is needed within each of the OWASP Mobile Top Ten 2015 categories. Each of these elements has been initially based off the Google Hangout meeting held on April 1 2015.&lt;br /&gt;
&lt;br /&gt;
==Label (generic and audience-specific labels)==&lt;br /&gt;
This element is a unique identifier for the bucket of issues that belong together. In the [https://docs.google.com/a/owasp.org/forms/d/1WMEbjVgXU4VkjHP5AcW934D9EI0_XQ5vmjb-Y5liMQY/viewform OWASP Mobile Top Ten 2015 Survey], we found that there were many different audiences that may use the OWASP Mobile Top Ten 2015 for different purposes. As always, there needs to be a generic label that uniquely identifies each bucket of issues. However, there should also be additional labels for the same category that are audience-specific to make it easier for different audiences to identify the category they are looking for. These additional labels will help clarify and differentiate the categories.&lt;br /&gt;
&lt;br /&gt;
==Overview Text==&lt;br /&gt;
This element is a generic education piece (100-200 words) around the nature of the category. It should describe the nature of the category as it relates to the different audiences (e.g., penetration testers; software engineers). It should include external references and educational links to other sources around the nature of the problem.&lt;br /&gt;
&lt;br /&gt;
==Prominent Characteristics==&lt;br /&gt;
This element eliminates any uncertainty or ambiguity that may result from vagueness / broadness in the category labels. It should include &amp;quot;headline vulnerabilities&amp;quot; that made it into the media and help each audience get a &amp;quot;gut feel&amp;quot; for what belongs to this category. In the 2014 list, we found that there were many instances where the same vulnerabilities were spread across many different categories. Hence, the need for this additional element along with a strive towards better categorisation.&lt;br /&gt;
&lt;br /&gt;
==Risk==&lt;br /&gt;
This element helps clarify how critical the category of issues is from both a business and technical perspective. During the meeting of April 1 2015, it was proposed that the CVSS classification scheme may be used here as a way of helping guide the audiences in prioritisation of the fixing of the issues.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
This element gives coding-specific examples, CVE vulnerabilities and newsworthy events that fall into this category. This element will help clarify to the difference audiences what fits into this category. &lt;br /&gt;
 &lt;br /&gt;
== Audience Specific Guidance==&lt;br /&gt;
This element gives practical advice and guidance for category remediation that is relevant to each audience (100-200 words). Each audience may approach the issue of remediation from very different perspectives. For example, an auditor may simply want to know more about whether or not remediation is appropriate. Meanwhile, a software engineer may want to have coding-specific advice.  Each audience's concerns must be addressed in this element. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=&amp;quot;Test Drive&amp;quot; Category Element=&lt;br /&gt;
Here, we are testing a particular category to see whether or not the proposed elements for each category are adequate to address each audience's needs. It is important to note that this is a sample category and is not a formal commitment to any final category in the OWASP Mobile Top Ten 2015. It is strictly meant for testing purposes. Members who would like to 'own' particular elements in the category below should 'sign up' and add content where appropriate.&lt;br /&gt;
&lt;br /&gt;
==Insecure Data Transmission==&lt;br /&gt;
&lt;br /&gt;
===Generic Label===&lt;br /&gt;
Owner(s): Jonathan Carter&lt;br /&gt;
&lt;br /&gt;
===Audience-Specific Labels===&lt;br /&gt;
Owner(s): Jonathan Carter&lt;br /&gt;
&lt;br /&gt;
===Overview Text===&lt;br /&gt;
&lt;br /&gt;
This category focuses on the many available communication channels in the mobile environment and the secure transmission of data through them. If your application is using '''Wi-Fi, WiFi-direct, Bluetooth, Infra-red, RFIDs, POS devices (with NFC Tags)'''; then this category provides guidance in securing data while in transit. Included but not limited to are '''plaintext transmission of sensitive data, insufficient authentication of encrypted channel endpoints, insufficient regard to failures in building a properly encrypted channel, poor choice of security mechanisms over distinct networks''', etc.&lt;br /&gt;
&lt;br /&gt;
Additionaly, this category applies in the same way to secure data transmission in the '''Internet Of Things (IoT)'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Owner(s): Milan Singh Thakur&lt;br /&gt;
&lt;br /&gt;
===Prominent Characteristics===&lt;br /&gt;
Owner(s): David Fern&lt;br /&gt;
&lt;br /&gt;
===Risk===&lt;br /&gt;
Confidential and sensitive data residing on the mobile devices if not fully SSL encrypted during transmission is highly susceptible to eavesdropping. As majority of wireless, mobile devices have capability to use and switch to various home Wifi and public unsecured Wifi. This could be disastrous while giving attackers a glimpse of your personal, non-shareable information which can lead to '''identity theft''' and '''social engineering attacks'''. Similarly, it applies to those mobile apps also where data transmission is not fully SSL encrypted and failed to perform a Valid SSL Certificate check. Additionally, this might lead further to '''man-in-the-middle attacks'''.&lt;br /&gt;
&lt;br /&gt;
Even if the application uses encryption and the device is connected to a public WiFi, an attacker can easily capture all Wireless traffic (as in War-driving). Then attacker can perform '''offline decryption''' and possibly have all your sensitive data. &lt;br /&gt;
Consider the situation where your application server uses TLS1.0/SSLv3. You think it is secure? Nope, it is highly vulnerable to attacks like '''CRIME, POODLE and Handshake Re-negotiation'''.&lt;br /&gt;
&lt;br /&gt;
Owner(s): Rajvinder Singh, Milan Singh Thakur&lt;br /&gt;
&lt;br /&gt;
===Examples===&lt;br /&gt;
Owner(s): Adam Kliarsky&lt;br /&gt;
&lt;br /&gt;
===Audience-Specific Guidance===&lt;br /&gt;
Owner(s): Andi Pannell&lt;br /&gt;
&lt;br /&gt;
=Top Ten Scratchpad=&lt;br /&gt;
Here's some top-ten possible categories. This is a wiki. Edit them. Change them. Leave comments. Mark it up.&lt;br /&gt;
&lt;br /&gt;
==M1: Weak Server Side Controls                 ==&lt;br /&gt;
Stuff&lt;br /&gt;
&lt;br /&gt;
==M2: Insecure Data Storage                     ==&lt;br /&gt;
(Jason) As i look through the data I think more and more about how m2 and m4 might be combined.&lt;br /&gt;
&lt;br /&gt;
==M3: Insufficient Transport Layer Protection   ==&lt;br /&gt;
Stuff&lt;br /&gt;
&lt;br /&gt;
==M4: Unintended Data Leakage                   ==&lt;br /&gt;
&lt;br /&gt;
Stuff&lt;br /&gt;
==M5: Poor Authorization and Authentication     ==&lt;br /&gt;
&lt;br /&gt;
Stuff&lt;br /&gt;
==M6: Broken Cryptography                       ==&lt;br /&gt;
&lt;br /&gt;
Stuff&lt;br /&gt;
==M7: Client Side Injection                     ==&lt;br /&gt;
&lt;br /&gt;
Stuff&lt;br /&gt;
==M8: Security Decisions Via Untrusted Inputs   ==&lt;br /&gt;
&lt;br /&gt;
Stuff&lt;br /&gt;
==M9: Improper Session Handling                 ==&lt;br /&gt;
&lt;br /&gt;
Stuff&lt;br /&gt;
==M10: Lack of Binary Protections               ==&lt;br /&gt;
&lt;br /&gt;
(Jason) Regarding m10 - Several submissions reported m10 vulns. Unfortunately some were types of services such as binary reputation scanners, that do not have the ability to check for dynamic or code level findings. In order to fix this i recommend a name change or re-working of this category.  I want to separate out the delineation of Anti-exploit vs Code Obfuscation/Anti-reversing. Must talk to group about this.&lt;/div&gt;</summary>
		<author><name>Izar</name></author>	</entry>

	</feed>