<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Minimizing the Attack Surface, Part 1</title>
	<atom:link href="http://www.veracode.com/blog/2008/06/minimizing-the-attack-surface-part-1/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.veracode.com/blog/2008/06/minimizing-the-attack-surface-part-1/</link>
	<description>Application security testing, analysis, and metrics</description>
	<lastBuildDate>Tue, 15 May 2012 22:16:53 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Zero in a bit &#187; Minimizing the Attack Surface, Part 2</title>
		<link>http://www.veracode.com/blog/2008/06/minimizing-the-attack-surface-part-1/comment-page-1/#comment-1356</link>
		<dc:creator>Zero in a bit &#187; Minimizing the Attack Surface, Part 2</dc:creator>
		<pubDate>Mon, 07 Jul 2008 21:10:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.veracode.com/blog/?p=111#comment-1356</guid>
		<description>[...] finally getting around to finishing my post on minimizing attack surfaces. Here&#8217;s Part 1, in case you missed [...]</description>
		<content:encoded><![CDATA[<p>[...] finally getting around to finishing my post on minimizing attack surfaces. Here&#8217;s Part 1, in case you missed [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Zero in a bit &#187; DWR 2.0.5 Fixes XSS Vulnerability</title>
		<link>http://www.veracode.com/blog/2008/06/minimizing-the-attack-surface-part-1/comment-page-1/#comment-1102</link>
		<dc:creator>Zero in a bit &#187; DWR 2.0.5 Fixes XSS Vulnerability</dc:creator>
		<pubDate>Mon, 30 Jun 2008 03:04:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.veracode.com/blog/?p=111#comment-1102</guid>
		<description>[...] for now, but I&#8217;ll be referencing this example again when I get around to writing Part 2 of my Minimizing the Attack Surface [...]</description>
		<content:encoded><![CDATA[<p>[...] for now, but I&#8217;ll be referencing this example again when I get around to writing Part 2 of my Minimizing the Attack Surface [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: links for 2008-06-26 (Jarrett House North)</title>
		<link>http://www.veracode.com/blog/2008/06/minimizing-the-attack-surface-part-1/comment-page-1/#comment-1090</link>
		<dc:creator>links for 2008-06-26 (Jarrett House North)</dc:creator>
		<pubDate>Thu, 26 Jun 2008 02:33:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.veracode.com/blog/?p=111#comment-1090</guid>
		<description>[...] Zero in a bit » Minimizing the Attack Surface, Part 1 How does &#8220;attack surface minimization&#8221; translate into the web application world? (tags: security) [...]</description>
		<content:encoded><![CDATA[<p>[...] Zero in a bit » Minimizing the Attack Surface, Part 1 How does &#8220;attack surface minimization&#8221; translate into the web application world? (tags: security) [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Interesting Information Security Bits for June 25th, 2008 &#171; Infosec Ramblings</title>
		<link>http://www.veracode.com/blog/2008/06/minimizing-the-attack-surface-part-1/comment-page-1/#comment-1087</link>
		<dc:creator>Interesting Information Security Bits for June 25th, 2008 &#171; Infosec Ramblings</dc:creator>
		<pubDate>Wed, 25 Jun 2008 19:15:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.veracode.com/blog/?p=111#comment-1087</guid>
		<description>[...] Eng at Veracode has Part 1 of Minimizing the Attack Surface up. Good [...]</description>
		<content:encoded><![CDATA[<p>[...] Eng at Veracode has Part 1 of Minimizing the Attack Surface up. Good [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Evan</title>
		<link>http://www.veracode.com/blog/2008/06/minimizing-the-attack-surface-part-1/comment-page-1/#comment-1084</link>
		<dc:creator>Evan</dc:creator>
		<pubDate>Wed, 25 Jun 2008 13:22:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.veracode.com/blog/?p=111#comment-1084</guid>
		<description>Chris: I&#039;ve always felt that this is one of the problems with development these days.  Everyone is looking for the quick fix/integration technique.  Developers are forgetting three things: 

1) Never trust data coming into your application/class
2) Design with re-use in mind.
3) Keep it simple

While these frameworks allow for companies/systems to be developed more rapidly they tend to open up a lot of other issues -- the struts validation framework for example leads to developers forgetting about validating the data as it comes into the class itself (whose to say the web front end is the only place data will be coming from).

XML File usage has gotten way out of hand and adds to the complexity.  Sure, someone coudl develop a front end or Eclipse plugin to assist, but it&#039;s still another area where manipulation and management needs to occur. (keep it simple).

While I&#039;m not perfect at it, I was always taught through my undergrad program -- know what you are using and what it does.  Without it, you are flying blind.</description>
		<content:encoded><![CDATA[<p>Chris: I&#8217;ve always felt that this is one of the problems with development these days.  Everyone is looking for the quick fix/integration technique.  Developers are forgetting three things: </p>
<p>1) Never trust data coming into your application/class<br />
2) Design with re-use in mind.<br />
3) Keep it simple</p>
<p>While these frameworks allow for companies/systems to be developed more rapidly they tend to open up a lot of other issues &#8212; the struts validation framework for example leads to developers forgetting about validating the data as it comes into the class itself (whose to say the web front end is the only place data will be coming from).</p>
<p>XML File usage has gotten way out of hand and adds to the complexity.  Sure, someone coudl develop a front end or Eclipse plugin to assist, but it&#8217;s still another area where manipulation and management needs to occur. (keep it simple).</p>
<p>While I&#8217;m not perfect at it, I was always taught through my undergrad program &#8212; know what you are using and what it does.  Without it, you are flying blind.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andre Gironda</title>
		<link>http://www.veracode.com/blog/2008/06/minimizing-the-attack-surface-part-1/comment-page-1/#comment-1083</link>
		<dc:creator>Andre Gironda</dc:creator>
		<pubDate>Wed, 25 Jun 2008 09:40:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.veracode.com/blog/?p=111#comment-1083</guid>
		<description>&lt;i&gt;Your focus seems to be on exploring coding practices that may make it more efficient for an organization to unit test its own code (correct me if I’ve misunderstood)&lt;/i&gt;

Yes, I did want to point out that these sorts of coding practices make testing more efficient (and more capable).  I consider this as a primary benefit to security, although using DI or IoC certainly will reduce the surface area of third-party code as a secondary benefit (or is this the primary?).  Lead developers will often integrate DI/IoC/TDD/Plugin-pattern concepts into the mix of things that the people on their team need to learn and use - along with choice of third-party libraries and coding standards with regards to base class libraries.

&lt;i&gt;In a typical development shop, who would own the task of analyzing and reducing the attack surface of third-party libraries?&lt;/i&gt;

Maybe it would be the same person who is also responsible for solving / working around the issues with compile-time dependencies?

&lt;i&gt;Beyond unit testing though, IoC frameworks introduce some unique challenges to automated data/control flow analysis and they can be confusing for a code reviewer as well. That’s a totally separate discussion though&lt;/i&gt;

Actually, it&#039;s really a part of the same discussion.  If I suggest that DI or IoC frameworks be used for security purposes, then it would make sense to talk about the disadvantages as well.  I wouldn&#039;t say that the challenges are unique to DI/IoC, but I would say that the majority of automated security review tools out there make it difficult to support this.

&lt;i&gt;It’s almost a deployment-related task (e.g. removing all the sample apps from Tomcat), but not quite&lt;/i&gt;

To put it in your Unix README terminology - tarfiles sometimes shipped with MANIFEST files that contained a list of all of the files that shipped with that tar file.  Assembly manifests (when provided in third-party packages) should contain the metadata for the assembly such as the name and version of the assembly, the files that make up the assembly (including their names and hash values), the compile-time dependency of this assembly on other assemblies, the culture or language an assembly supports, and the set of permissions required for the assembly to run properly.</description>
		<content:encoded><![CDATA[<p><i>Your focus seems to be on exploring coding practices that may make it more efficient for an organization to unit test its own code (correct me if I’ve misunderstood)</i></p>
<p>Yes, I did want to point out that these sorts of coding practices make testing more efficient (and more capable).  I consider this as a primary benefit to security, although using DI or IoC certainly will reduce the surface area of third-party code as a secondary benefit (or is this the primary?).  Lead developers will often integrate DI/IoC/TDD/Plugin-pattern concepts into the mix of things that the people on their team need to learn and use &#8211; along with choice of third-party libraries and coding standards with regards to base class libraries.</p>
<p><i>In a typical development shop, who would own the task of analyzing and reducing the attack surface of third-party libraries?</i></p>
<p>Maybe it would be the same person who is also responsible for solving / working around the issues with compile-time dependencies?</p>
<p><i>Beyond unit testing though, IoC frameworks introduce some unique challenges to automated data/control flow analysis and they can be confusing for a code reviewer as well. That’s a totally separate discussion though</i></p>
<p>Actually, it&#8217;s really a part of the same discussion.  If I suggest that DI or IoC frameworks be used for security purposes, then it would make sense to talk about the disadvantages as well.  I wouldn&#8217;t say that the challenges are unique to DI/IoC, but I would say that the majority of automated security review tools out there make it difficult to support this.</p>
<p><i>It’s almost a deployment-related task (e.g. removing all the sample apps from Tomcat), but not quite</i></p>
<p>To put it in your Unix README terminology &#8211; tarfiles sometimes shipped with MANIFEST files that contained a list of all of the files that shipped with that tar file.  Assembly manifests (when provided in third-party packages) should contain the metadata for the assembly such as the name and version of the assembly, the files that make up the assembly (including their names and hash values), the compile-time dependency of this assembly on other assemblies, the culture or language an assembly supports, and the set of permissions required for the assembly to run properly.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Eng</title>
		<link>http://www.veracode.com/blog/2008/06/minimizing-the-attack-surface-part-1/comment-page-1/#comment-1081</link>
		<dc:creator>Chris Eng</dc:creator>
		<pubDate>Tue, 24 Jun 2008 22:07:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.veracode.com/blog/?p=111#comment-1081</guid>
		<description>@Dre:

Your comments are always longer than my original posts. :)

I think you&#039;ve forked off in a slightly different direction than where I was going but it is an interesting direction nonetheless.  Your focus seems to be on exploring coding practices that may make it more efficient for an organization to unit test its own code (correct me if I&#039;ve misunderstood).  Beyond unit testing though, IoC frameworks introduce some unique challenges to automated data/control flow analysis and they can be confusing for a code reviewer as well.  That&#039;s a totally separate discussion though.

My intent in the post is not to suggest that people should change their entire development practice.  Rather, it is to illustrate that while an organization may be going to great lengths to incorporate security into their custom code, they&#039;re often being extremely careless in allowing third-party interfaces to unnecessarily widen the scope of potential attack vectors.  It&#039;s almost a deployment-related task (e.g. removing all the sample apps from Tomcat), but not quite. 

In a typical development shop, who would own the task of analyzing and reducing the attack surface of third-party libraries?  I don&#039;t think it has a clear owner, which is probably why it&#039;s often overlooked.</description>
		<content:encoded><![CDATA[<p>@Dre:</p>
<p>Your comments are always longer than my original posts. :)</p>
<p>I think you&#8217;ve forked off in a slightly different direction than where I was going but it is an interesting direction nonetheless.  Your focus seems to be on exploring coding practices that may make it more efficient for an organization to unit test its own code (correct me if I&#8217;ve misunderstood).  Beyond unit testing though, IoC frameworks introduce some unique challenges to automated data/control flow analysis and they can be confusing for a code reviewer as well.  That&#8217;s a totally separate discussion though.</p>
<p>My intent in the post is not to suggest that people should change their entire development practice.  Rather, it is to illustrate that while an organization may be going to great lengths to incorporate security into their custom code, they&#8217;re often being extremely careless in allowing third-party interfaces to unnecessarily widen the scope of potential attack vectors.  It&#8217;s almost a deployment-related task (e.g. removing all the sample apps from Tomcat), but not quite. </p>
<p>In a typical development shop, who would own the task of analyzing and reducing the attack surface of third-party libraries?  I don&#8217;t think it has a clear owner, which is probably why it&#8217;s often overlooked.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andre Gironda</title>
		<link>http://www.veracode.com/blog/2008/06/minimizing-the-attack-surface-part-1/comment-page-1/#comment-1080</link>
		<dc:creator>Andre Gironda</dc:creator>
		<pubDate>Tue, 24 Jun 2008 21:29:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.veracode.com/blog/?p=111#comment-1080</guid>
		<description>Chris,

I love these analogies, and I think I even see where you are going with this.

External libraries/packages/components are good in most situations, especially base class libraries and already-secure components such as OWASP ESAPI.  Other times, they&#039;re not so great, but you&#039;re right -- there are a few ways to solve these problems, but certain development shops must be ready for them and aware of how to integrate them into their lifecycle.

Aspect Security (authors of OWASP ESAPI) recently did some presentations at the OWASP AppSec EU 2008 conference in Belgium.  Dave Wichers talked about Agile Security, and I&#039;ve seen Jeff Williams write about it on The Register and possibly other places.  Some of the benefits of Agile for Security they claim include Test-Driven Development (TDD), Sprints (i.e. short cycles of iterative programming), User stories (use cases written in longer &quot;story&quot; format), and constant Refactoring (to avoid the anti-pattern of Big-Design-Up-Front).

I read this and immediately thought it was brilliant.  However, I told them that the word &quot;Agile&quot; is a difficult word to use because many shops aren&#039;t one (Agile) or the other (Waterfall), but very often &quot;their own thing&quot;.  However, the concepts of Test-first development, constant Refactoring, short Sprints, and User stories are all top-notch ideas -- ideal for security purposes!

However, the BDUF argument is an interesting one (another that differs depending on the team or project), but the same concepts of short Sprints can also be applied for testing and inspection, especially with the noisy, high-error rate of static analysis tools such as FxCop or FindBugs (or worse, the popular commercial security review tools!).  It is very nice to be able to refactor and add functionality, but I think it&#039;s also smart to talk and prepare for that functionality from the start.  Not to mention coding standards, which can be checked with much faster tools such as the style checkers StyleCop or PMD.

Last year, I was working with a development team and we went through a lot of these types of issues.  I was very hyped about Continuous Integration and TDD, as well as build statistics such as code coverage and Cyclomatic complexity. After seeing many of the results, I think that McCabe doesn&#039;t work well for security purposes, and that code coverage is merely a tool to help improve writing tests (not a goal or standard, per-se).

The tests can certainly help a ton, however the developers seemed to be faster to respond to issues with peer review using failed build reports (or just picking on the guy who never listens code).  It helped that they were using a framework that supported MVC (although there were many valid arguments that MVP models were better, especially for testing purposes), as well as Dependency injection.

You could go on about Security Patterns for a long time, Design-by-Contract -- we could talk about how Model-driven development or Behavior-driven development differs from Test-driven development... but really I think you&#039;re getting to a few specific areas of interest that I really appreciate.

Developers already have to minimize surface area to avoid compile-time dependencies.  It&#039;s already in their benefit to do this sort of thing in order to have maintainable code.  Unfortunately, modern languages (especially web application languages of both the bytecode and scripting varieties) expose public interface by default (marked as virtual).  Note that last decade&#039;s language choice, C++, did not -- so you might make the claim that Classic ASP does have its benefits with its drawbacks (and there are other examples of this).

In C# (for ASP.NET), this is typically done by marking your classes as `sealed&#039;.  In addition, you can clobber base class methods with `new&#039;.  There are better ways to do this, however, which I will get to in a second.

If supported, you can limit dependencies between libraries with Dependency injection (DI).  DI works by trading off compile-time for runtime dependencies through xml config files (although some DI frameworks, such as Google Guice are XML-free).  I&#039;m most familiar with Spring (for JEE, which also has Guice and PicoContainer as DI options), but I&#039;ve been looking at C# .NET ones such as Castle Project MonoRail / Windsor, as well as the new ones: Ninject and Microsoft&#039;s very own Unity DI framework.  Somebody smart is probably hitting up Wikipedia right now, but those are the only ones that I&#039;ve familiar with or have read about.

Additionally, this helps with testing in isolation: a huge win for security testing.  Stephen de Vries wrote an excellent paper on this subject here - http://research.corsaire.com/whitepapers/technical.html &quot;Security Testing Applications through Automated Software Tests&quot;.  In it, Stephen says:

``Unit tests should only test a single class and should not rely on helper or dependent classes. Since few classes exist in such a form of isolation it is usually necessary to create a &quot;stub&quot; or &quot;mock&quot; of the helper class that only does what is expected by the calling class and no more. Using this technique has the added benefit of allowing developers to complete modules in parallel without having to wait for dependent modules to be completed. To enable this form of testing it is important that the code is pluggable, this can be achieved by using the Inversion of Control (IoC) or Service Locator design patterns. Pluggable code using these patterns is a worthy goal in itself and the ease with which they allow tests to be performed is just one of their many advantages.&#039;&#039;

I guess if you&#039;re not going to talk about DI/IoC, then I certainly will at some point.  There&#039;s a lot more to be said (I&#039;ve seen frameworks that combine AOP with DI), but I think this is probably enough for now.  Suffice it to say, there is a lot of synergistic behavior between some of the development patterns for removal of surface area, ease of testing, et al.  Looking forward to the next post.</description>
		<content:encoded><![CDATA[<p>Chris,</p>
<p>I love these analogies, and I think I even see where you are going with this.</p>
<p>External libraries/packages/components are good in most situations, especially base class libraries and already-secure components such as OWASP ESAPI.  Other times, they&#8217;re not so great, but you&#8217;re right &#8212; there are a few ways to solve these problems, but certain development shops must be ready for them and aware of how to integrate them into their lifecycle.</p>
<p>Aspect Security (authors of OWASP ESAPI) recently did some presentations at the OWASP AppSec EU 2008 conference in Belgium.  Dave Wichers talked about Agile Security, and I&#8217;ve seen Jeff Williams write about it on The Register and possibly other places.  Some of the benefits of Agile for Security they claim include Test-Driven Development (TDD), Sprints (i.e. short cycles of iterative programming), User stories (use cases written in longer &#8220;story&#8221; format), and constant Refactoring (to avoid the anti-pattern of Big-Design-Up-Front).</p>
<p>I read this and immediately thought it was brilliant.  However, I told them that the word &#8220;Agile&#8221; is a difficult word to use because many shops aren&#8217;t one (Agile) or the other (Waterfall), but very often &#8220;their own thing&#8221;.  However, the concepts of Test-first development, constant Refactoring, short Sprints, and User stories are all top-notch ideas &#8212; ideal for security purposes!</p>
<p>However, the BDUF argument is an interesting one (another that differs depending on the team or project), but the same concepts of short Sprints can also be applied for testing and inspection, especially with the noisy, high-error rate of static analysis tools such as FxCop or FindBugs (or worse, the popular commercial security review tools!).  It is very nice to be able to refactor and add functionality, but I think it&#8217;s also smart to talk and prepare for that functionality from the start.  Not to mention coding standards, which can be checked with much faster tools such as the style checkers StyleCop or PMD.</p>
<p>Last year, I was working with a development team and we went through a lot of these types of issues.  I was very hyped about Continuous Integration and TDD, as well as build statistics such as code coverage and Cyclomatic complexity. After seeing many of the results, I think that McCabe doesn&#8217;t work well for security purposes, and that code coverage is merely a tool to help improve writing tests (not a goal or standard, per-se).</p>
<p>The tests can certainly help a ton, however the developers seemed to be faster to respond to issues with peer review using failed build reports (or just picking on the guy who never listens code).  It helped that they were using a framework that supported MVC (although there were many valid arguments that MVP models were better, especially for testing purposes), as well as Dependency injection.</p>
<p>You could go on about Security Patterns for a long time, Design-by-Contract &#8212; we could talk about how Model-driven development or Behavior-driven development differs from Test-driven development&#8230; but really I think you&#8217;re getting to a few specific areas of interest that I really appreciate.</p>
<p>Developers already have to minimize surface area to avoid compile-time dependencies.  It&#8217;s already in their benefit to do this sort of thing in order to have maintainable code.  Unfortunately, modern languages (especially web application languages of both the bytecode and scripting varieties) expose public interface by default (marked as virtual).  Note that last decade&#8217;s language choice, C++, did not &#8212; so you might make the claim that Classic ASP does have its benefits with its drawbacks (and there are other examples of this).</p>
<p>In C# (for ASP.NET), this is typically done by marking your classes as `sealed&#8217;.  In addition, you can clobber base class methods with `new&#8217;.  There are better ways to do this, however, which I will get to in a second.</p>
<p>If supported, you can limit dependencies between libraries with Dependency injection (DI).  DI works by trading off compile-time for runtime dependencies through xml config files (although some DI frameworks, such as Google Guice are XML-free).  I&#8217;m most familiar with Spring (for JEE, which also has Guice and PicoContainer as DI options), but I&#8217;ve been looking at C# .NET ones such as Castle Project MonoRail / Windsor, as well as the new ones: Ninject and Microsoft&#8217;s very own Unity DI framework.  Somebody smart is probably hitting up Wikipedia right now, but those are the only ones that I&#8217;ve familiar with or have read about.</p>
<p>Additionally, this helps with testing in isolation: a huge win for security testing.  Stephen de Vries wrote an excellent paper on this subject here &#8211; <a href="http://research.corsaire.com/whitepapers/technical.html" rel="nofollow">http://research.corsaire.com/whitepapers/technical.html</a> &#8220;Security Testing Applications through Automated Software Tests&#8221;.  In it, Stephen says:</p>
<p>&#8220;Unit tests should only test a single class and should not rely on helper or dependent classes. Since few classes exist in such a form of isolation it is usually necessary to create a &#8220;stub&#8221; or &#8220;mock&#8221; of the helper class that only does what is expected by the calling class and no more. Using this technique has the added benefit of allowing developers to complete modules in parallel without having to wait for dependent modules to be completed. To enable this form of testing it is important that the code is pluggable, this can be achieved by using the Inversion of Control (IoC) or Service Locator design patterns. Pluggable code using these patterns is a worthy goal in itself and the ease with which they allow tests to be performed is just one of their many advantages.&#8221;</p>
<p>I guess if you&#8217;re not going to talk about DI/IoC, then I certainly will at some point.  There&#8217;s a lot more to be said (I&#8217;ve seen frameworks that combine AOP with DI), but I think this is probably enough for now.  Suffice it to say, there is a lot of synergistic behavior between some of the development patterns for removal of surface area, ease of testing, et al.  Looking forward to the next post.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

