<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.2.3" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: Week of War on WAF&#8217;s: Day 4 &#8212; Closer to the code</title>
	<link>http://www.tssci-security.com/archives/2008/06/26/week-of-war-on-wafs-day-4-closer-to-the-code/</link>
	<description>top secret/secure computing information</description>
	<pubDate>Fri, 21 Nov 2008 16:21:20 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.3</generator>

	<item>
		<title>By: Rohit Sethi</title>
		<link>http://www.tssci-security.com/archives/2008/06/26/week-of-war-on-wafs-day-4-closer-to-the-code/#comment-8150</link>
		<dc:creator>Rohit Sethi</dc:creator>
		<pubDate>Thu, 26 Jun 2008 21:58:33 +0000</pubDate>
		<guid>http://www.tssci-security.com/archives/2008/06/26/week-of-war-on-wafs-day-4-closer-to-the-code/#comment-8150</guid>
		<description>Jeff, I don't pretend that AOP is a 10 minute solution to fixing your code. You're absolutely right that it requires context and you certainly need to think. I would challenge anyone to find a way to really secure an application without having to think or understand context.

Of course you can re-factor code instead. The big difference is that that the existing code becomes tightly coupled to the security mechanisms. As soon as you enter authorization calls on your methods or you sanitize input within business logic, you begin to scatter code - and code scattering has been proven to lead to more defects (one such study can be found here: http://www1.cs.columbia.edu/~eaddy/publications/Identifying,%20Assigning,%20and%20Quantifying%20Crosscutting%20Concerns.slides.pdf).
Perhaps more important, each security aspect is centralized. Yes there will be different advice for different fields, but in most applications many of the fields can be categorized together and use the same advice (e.g. text in comment fields, addresses, etc.).

What about using AOP for OWASP Top 10? That's a paper on it's own, but let me talk about XSS. Output encoding is one of the most common defenses, and the OWASP Reform project (part of ESAPI if I remember correctly) is a great tool for this. If you can identify the objects that will be used in the presentation tier then you can use AOP to call Reform and encode them just before they are passed to the presentation tier. You could also do this with simple code changes, but the difference with AOP is that you are encapsulating that security concern away from the code. A developer who understands the code base and has a strong application security background could be assigned to develop these aspects. 

Logging is properly not the best poster child for AOP because you are right that sometimes it is so context sensitive that it needs to be put within the method code. On the other hand, there are many cases in large applications where standardized logging is happening consistently across many different objects (e.g. "Entering method .." for all methods within the service layer). Why not take out that standardized logging statement away from each individual object and modularize it? There will still be some logging left in the object, but the code will be less scattered.

ESAPI is a great set of tools. I think it is even better when (some parts of it) are applied with AOP to occur transparently from the rest of the code. I'd also point out that I don't think AOP can be used for ALL application security concerns (e.g. you can't use AOP to convert dynamic SQL to prepared statements - that has to be built in). 

As for securing WebGoat, I think that is a fantastic idea and something I will implement when I get some free time. 

So yes it may be faster to secure code directly, but there are certainly advantages to fixing much of the application without actually changing the code.</description>
		<content:encoded><![CDATA[<p>Jeff, I don&#8217;t pretend that AOP is a 10 minute solution to fixing your code. You&#8217;re absolutely right that it requires context and you certainly need to think. I would challenge anyone to find a way to really secure an application without having to think or understand context.</p>
<p>Of course you can re-factor code instead. The big difference is that that the existing code becomes tightly coupled to the security mechanisms. As soon as you enter authorization calls on your methods or you sanitize input within business logic, you begin to scatter code - and code scattering has been proven to lead to more defects (one such study can be found here: <a href="http://www1.cs.columbia.edu/~eaddy/publications/Identifying,%20Assigning,%20and%20Quantifying%20Crosscutting%20Concerns.slides.pdf"  onclick="javascript:urchinTracker ('/outbound/comment/www1.cs.columbia.edu');">http://www1.cs.columbia.edu/~eaddy/publications/Identifying,%20Assigning,%20and%20Quantifying%20Crosscutting%20Concerns.slides.pdf</a>).<br />
Perhaps more important, each security aspect is centralized. Yes there will be different advice for different fields, but in most applications many of the fields can be categorized together and use the same advice (e.g. text in comment fields, addresses, etc.).</p>
<p>What about using AOP for OWASP Top 10? That&#8217;s a paper on it&#8217;s own, but let me talk about XSS. Output encoding is one of the most common defenses, and the OWASP Reform project (part of ESAPI if I remember correctly) is a great tool for this. If you can identify the objects that will be used in the presentation tier then you can use AOP to call Reform and encode them just before they are passed to the presentation tier. You could also do this with simple code changes, but the difference with AOP is that you are encapsulating that security concern away from the code. A developer who understands the code base and has a strong application security background could be assigned to develop these aspects. </p>
<p>Logging is properly not the best poster child for AOP because you are right that sometimes it is so context sensitive that it needs to be put within the method code. On the other hand, there are many cases in large applications where standardized logging is happening consistently across many different objects (e.g. &#8220;Entering method ..&#8221; for all methods within the service layer). Why not take out that standardized logging statement away from each individual object and modularize it? There will still be some logging left in the object, but the code will be less scattered.</p>
<p>ESAPI is a great set of tools. I think it is even better when (some parts of it) are applied with AOP to occur transparently from the rest of the code. I&#8217;d also point out that I don&#8217;t think AOP can be used for ALL application security concerns (e.g. you can&#8217;t use AOP to convert dynamic SQL to prepared statements - that has to be built in). </p>
<p>As for securing WebGoat, I think that is a fantastic idea and something I will implement when I get some free time. </p>
<p>So yes it may be faster to secure code directly, but there are certainly advantages to fixing much of the application without actually changing the code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rohit Sethi</title>
		<link>http://www.tssci-security.com/archives/2008/06/26/week-of-war-on-wafs-day-4-closer-to-the-code/#comment-8147</link>
		<dc:creator>Rohit Sethi</dc:creator>
		<pubDate>Thu, 26 Jun 2008 20:37:59 +0000</pubDate>
		<guid>http://www.tssci-security.com/archives/2008/06/26/week-of-war-on-wafs-day-4-closer-to-the-code/#comment-8147</guid>
		<description>Ivan, it sounds like you and I really aren't disagreeing on too many fronts. Certainly WAFs are more applicable than AOP in some cases, and AOP is not the ideal solution for everyone. Also, you are correct about changing the data - I probably should have said "reject the payload" instead of "strip out malicious characters". The only reason I used that example is because I know many applications do strip out malicious character, which is their way of fixing the application itself (even when they know the application intimately). I don't mean to imply that it's an ideal solution.

I don't think that AOP and WAF are different implementations of the same thing. A WAF is external to the application, whereas AOP is internal and that alone is a critical difference. The powerful pointcut syntax with mature AOP languages offer developers a degree of granulaity that's just not possible outside of the application. I also disagree that you need to build the entire functionality from scratch. You do have to build security aspects once, but after they're built it's a simple process to reuse them in other applications with different pointcuts and small tweaks to the actual advice. The toolkits you're talking about are just that, and we hope to have a few of these aspects up for general use on our website later this year.

As you correctly stated, and as mentioned in the article, AOP isn't a good fit when you don't understand the application's internals.

Cheers,

Rohit</description>
		<content:encoded><![CDATA[<p>Ivan, it sounds like you and I really aren&#8217;t disagreeing on too many fronts. Certainly WAFs are more applicable than AOP in some cases, and AOP is not the ideal solution for everyone. Also, you are correct about changing the data - I probably should have said &#8220;reject the payload&#8221; instead of &#8220;strip out malicious characters&#8221;. The only reason I used that example is because I know many applications do strip out malicious character, which is their way of fixing the application itself (even when they know the application intimately). I don&#8217;t mean to imply that it&#8217;s an ideal solution.</p>
<p>I don&#8217;t think that AOP and WAF are different implementations of the same thing. A WAF is external to the application, whereas AOP is internal and that alone is a critical difference. The powerful pointcut syntax with mature AOP languages offer developers a degree of granulaity that&#8217;s just not possible outside of the application. I also disagree that you need to build the entire functionality from scratch. You do have to build security aspects once, but after they&#8217;re built it&#8217;s a simple process to reuse them in other applications with different pointcuts and small tweaks to the actual advice. The toolkits you&#8217;re talking about are just that, and we hope to have a few of these aspects up for general use on our website later this year.</p>
<p>As you correctly stated, and as mentioned in the article, AOP isn&#8217;t a good fit when you don&#8217;t understand the application&#8217;s internals.</p>
<p>Cheers,</p>
<p>Rohit</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff Williams</title>
		<link>http://www.tssci-security.com/archives/2008/06/26/week-of-war-on-wafs-day-4-closer-to-the-code/#comment-8146</link>
		<dc:creator>Jeff Williams</dc:creator>
		<pubDate>Thu, 26 Jun 2008 20:23:12 +0000</pubDate>
		<guid>http://www.tssci-security.com/archives/2008/06/26/week-of-war-on-wafs-day-4-closer-to-the-code/#comment-8146</guid>
		<description>Could you share the procedure for using AOP to secure a real application?  How about WebGoat?  How many of the OWASP Top Ten can you eliminate from an application with AOP?  Is doing it with AOP faster and easier to maintain than just doing it in the code?

AOP just seems like such a cumbersome way of doing security. The root of the problem is that you can't just mash in security calls according to some pattern.  You actually have to think.  You need a lot of context too.

For example, in your article, you apply a single regex to an input field to stop XSS. But every field needs a different regex!  You can't use the same rule for output encoding either - you need to encode for the location within the HTML. Even logging (the AOP poster child) needs a custom log message for whatever is happening in the code - particularly for security logging.

For almost every example I can think of (validation, encoding, access control, logging, encryption, concurrency, direct object references, etc...) it would be faster and better to just update the code.  Try using something like ESAPI to refactor security into an application instead.</description>
		<content:encoded><![CDATA[<p>Could you share the procedure for using AOP to secure a real application?  How about WebGoat?  How many of the OWASP Top Ten can you eliminate from an application with AOP?  Is doing it with AOP faster and easier to maintain than just doing it in the code?</p>
<p>AOP just seems like such a cumbersome way of doing security. The root of the problem is that you can&#8217;t just mash in security calls according to some pattern.  You actually have to think.  You need a lot of context too.</p>
<p>For example, in your article, you apply a single regex to an input field to stop XSS. But every field needs a different regex!  You can&#8217;t use the same rule for output encoding either - you need to encode for the location within the HTML. Even logging (the AOP poster child) needs a custom log message for whatever is happening in the code - particularly for security logging.</p>
<p>For almost every example I can think of (validation, encoding, access control, logging, encryption, concurrency, direct object references, etc&#8230;) it would be faster and better to just update the code.  Try using something like ESAPI to refactor security into an application instead.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ivan Ristic</title>
		<link>http://www.tssci-security.com/archives/2008/06/26/week-of-war-on-wafs-day-4-closer-to-the-code/#comment-8144</link>
		<dc:creator>Ivan Ristic</dc:creator>
		<pubDate>Thu, 26 Jun 2008 20:10:51 +0000</pubDate>
		<guid>http://www.tssci-security.com/archives/2008/06/26/week-of-war-on-wafs-day-4-closer-to-the-code/#comment-8144</guid>
		<description>Personally I see WAFs as a concept that can be implemented in a number of ways. Network gateway, web server embedded, AOP--those are all different implementations of the same thing, and I don't think we should be partial to any particular implementation: people should use whatever works for them. The network gateway WAF implementation is popular because it does not require anything to touch applications. There is the drawback of impedance mismatch--which you mention--that this increases the danger of different interpretation of the same data stream. AOP implementations have their own challenges, one being that each application needs to implement its own defence, and another that, in most cases, you need to build to entire functionality from scratch. To take this further, the concept of application self-defence is great, but we need to support it with toolkits (so that you don't have to start from scratch every time) and tools to handle logging, alert management and blocking (on a scale larger than single application node).

By the way, in response to:

&#62; With a WAF, you can protect against SQL
&#62; injection by stripping out malicious
&#62; characters; with AOP, you can strip out those
&#62; characters and additionally throw an
&#62; exception/error anytime a dynamic SQL method
&#62; is invoked.

I think that transforming input data in any way is very dangerous and nearly impossible to get right. To do it properly you have to have complete knowledge of what the application is doing with the input. If you know this you are better off fixing the application itself. Either that, or you are desperate, in which it is all right because you have no choice.</description>
		<content:encoded><![CDATA[<p>Personally I see WAFs as a concept that can be implemented in a number of ways. Network gateway, web server embedded, AOP&#8211;those are all different implementations of the same thing, and I don&#8217;t think we should be partial to any particular implementation: people should use whatever works for them. The network gateway WAF implementation is popular because it does not require anything to touch applications. There is the drawback of impedance mismatch&#8211;which you mention&#8211;that this increases the danger of different interpretation of the same data stream. AOP implementations have their own challenges, one being that each application needs to implement its own defence, and another that, in most cases, you need to build to entire functionality from scratch. To take this further, the concept of application self-defence is great, but we need to support it with toolkits (so that you don&#8217;t have to start from scratch every time) and tools to handle logging, alert management and blocking (on a scale larger than single application node).</p>
<p>By the way, in response to:</p>
<p>&gt; With a WAF, you can protect against SQL<br />
&gt; injection by stripping out malicious<br />
&gt; characters; with AOP, you can strip out those<br />
&gt; characters and additionally throw an<br />
&gt; exception/error anytime a dynamic SQL method<br />
&gt; is invoked.</p>
<p>I think that transforming input data in any way is very dangerous and nearly impossible to get right. To do it properly you have to have complete knowledge of what the application is doing with the input. If you know this you are better off fixing the application itself. Either that, or you are desperate, in which it is all right because you have no choice.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.247 seconds -->
