<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>John Melton's Weblog - Latest Comments</title><link xmlns="http://www.w3.org/2005/Atom" rel="http://api.friendfeed.com/2008/03#sup" href="http://disqus.com/sup/all.sup#forumcomments-10ea64e8" type="application/json"/><link>http://jtmelton.disqus.com/</link><description></description><atom:link href="http://jtmelton.disqus.com/comments.rss" rel="self"></atom:link><language>en</language><lastBuildDate>Thu, 10 May 2012 18:23:42 -0000</lastBuildDate><item><title>Re: Year Of Security for Java &amp;#8211; Week 19 &amp;#8211; Reduce the Attack Surface</title><link>http://www.jtmelton.com/2012/05/09/year-of-security-for-java-week-19-reduce-the-attack-surface/#comment-525835088</link><description>&lt;p&gt;Jim, I deeply enjoy hearing your thoughts and comments about pretty much everything. You are clearly a very sharp guy, and your writing expresses that.&lt;/p&gt;

&lt;p&gt;That said, I only partially agree with your comments. Reducing attack surface is absolutely about entry points, whether urls, apis, etc. as you pointed out. In the past I've been bitten by all of these issues as it relates to reducing attack surface. &lt;br&gt;You agreed that #4 and #5 have relevance, so I won't belabor those. &lt;/p&gt;

&lt;p&gt;For #1 (dead code), I certainly could have done a better job at pointing out the relationship with attack surface. What I've seen in the past is someone enable dead/commented code thinking maybe that's the reason why some bug they were dealing with was happening. They then fix the bug, and now the "dead" code is live and accessible as a new(old) entry point. This is certainly a tenuous leap, but one I've seen repeatedly. Luckily we caught many of these through code review, but other groups might not have appropriate processes in place, so I pointed it out here. Your points here are definitely well taken though - I could've done a much better job describing these. &lt;/p&gt;

&lt;p&gt;For #2, (copied code), I've definitely seen this happen a lot w/ junior developers. They copy a bit of code not knowing that they're opening up a new entry point. Say, they've copied code that has a springmvc annotation on it for instance. That's automatically a new entrypoint. This is a particularly egregious example, but I've certainly seen things like this happen repeatedly, whether copying code or configuration.&lt;/p&gt;

&lt;p&gt;For #3 (extra features), This is an area where the issue is probably clear. A dev builds some extra thing-a-ma-bob into the app for the "wow" of the end user. It's pretty, but also adds to the attack surface unnecessarily. &lt;/p&gt;

&lt;p&gt;I hope I've given a little clarity to the issues you brought up. Thanks for pointing them out!&lt;br&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">jtmelton</dc:creator><pubDate>Thu, 10 May 2012 18:23:42 -0000</pubDate></item><item><title>Re: Year Of Security for Java &amp;#8211; Week 19 &amp;#8211; Reduce the Attack Surface</title><link>http://www.jtmelton.com/2012/05/09/year-of-security-for-java-week-19-reduce-the-attack-surface/#comment-525789184</link><description>&lt;p&gt;A lot of this is good advice.  But not a lot of it has to do with reducing the attack surface of the application. The attack surface is the total of the entry points that an attacker can possibly use to attack the application: sockets, URLs, APIs, files, external databases, etc. Understanding this and protecting these entry points (and reducing them where possible) is what managing the attack surface should be about.&lt;/p&gt;

&lt;p&gt;Nothing that you are saying here is bad advice by any means, but this discussion seems to be more about lean development than attack surface management except for #5 "extra services enabled" which is about turning off stuff you don't need in third party apps (application hardening) and maybe #4 not including code in libraries that you don't necessarily need (although this is easier said than done).&lt;/p&gt;

&lt;p&gt;For example, dead code can't be attacked - it is after all dead. It's good to get rid of it for other reasons, but reducing the attack surface isn't one of them. &lt;/p&gt;

&lt;p&gt;One of the ways to reduce the attack surface of an app as you point out in #5 is to turn off features - therefore you shouldn't have to get rid of code that is disabled through configuration, unless the way that you have done it is naive (like "disabling" the feature only by not showing access at the client but still leaving the path open on the server). Again, there are good reasons to get rid if this code if you know you aren't going to use it, to simplify maintenance and testing and so on, but you've already reduced the attack surface by disabling the option. Copied code is often a bad idea, but again doesn't necessarily have to do with attack surface management.&lt;br&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jim Bird</dc:creator><pubDate>Thu, 10 May 2012 17:27:48 -0000</pubDate></item><item><title>Re: Year Of Security for Java &amp;#8211; Week 15 &amp;#8211; Audit Security Related Events</title><link>http://www.jtmelton.com/2012/04/10/year-of-security-for-java-week-15-audit-security-related-events/#comment-494259944</link><description>&lt;p&gt;Excellent series. &lt;/p&gt;

&lt;p&gt;Section 4.3 of the PCI Payment Application Data Security Standard(*)  gives an overview of the type of data that should be stored as part of an audit trail. &lt;br&gt;(*)&lt;a href="https://www.pcisecuritystandards.org/documents/pa-dss_v2.pdf" rel="nofollow"&gt;https://www.pcisecuritystandar...&lt;/a&gt; &lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Alexis FitzGerald</dc:creator><pubDate>Wed, 11 Apr 2012 08:53:28 -0000</pubDate></item><item><title>Re: The OWASP Top Ten and ESAPI &amp;#8211; Part 2 &amp;#8211; Injection Flaws</title><link>http://www.jtmelton.com/2009/12/01/the-owasp-top-ten-and-esapi-part-3-injection-flaws/#comment-457476824</link><description>&lt;p&gt;Thank you John , very helpful ^^&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Nareerat Preechakorn</dc:creator><pubDate>Mon, 05 Mar 2012 22:54:07 -0000</pubDate></item><item><title>Re: Year Of Security for Java &amp;#8211; Week 7 &amp;#8211; Content Security Policy</title><link>http://www.jtmelton.com/2012/02/14/year-of-security-for-java-week-7-content-security-policy/#comment-452249039</link><description>&lt;p&gt;I seriously wish other browsers would begin to implement CSP. Unfortunately, right now, only Firefox supports it. One day.&lt;/p&gt;

&lt;p&gt;WRT event handlers, you can't use the onWhatever handlers, but adding them is simple enough - document.getElementById('foo').click = function() { ... }.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Will Stranathan</dc:creator><pubDate>Wed, 29 Feb 2012 07:29:39 -0000</pubDate></item><item><title>Re: Year Of Security for Java &amp;#8211; Week 6 &amp;#8211; CSRF Prevention in Java</title><link>http://www.jtmelton.com/2012/02/07/year-of-security-for-java-week-6-csrf-prevention-in-java/#comment-433004487</link><description>&lt;p&gt;Stephen de Vries Good point. There are certain frameworks that do this, some better than others. My understanding is that one of the most successful is Django from the Python world.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">jtmelton</dc:creator><pubDate>Wed, 08 Feb 2012 09:54:46 -0000</pubDate></item><item><title>Re: Year Of Security for Java &amp;#8211; Week 6 &amp;#8211; CSRF Prevention in Java</title><link>http://www.jtmelton.com/2012/02/07/year-of-security-for-java-week-6-csrf-prevention-in-java/#comment-432775567</link><description>&lt;p&gt;I thought it was cute that you sometimes get CSRF protection for free when using some web frameworks.  For example Spring Webflow uses a flowId value to keep track of a flow within a session and it's attached to every request that's part of a flow.  So automatic CSRF protection.&lt;br&gt;JBoss Seam has a similar mechanism for it's "conversations" concept, but from what I remember the value was an incrementing numeric value - so not ideal for anti CSRF token.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Stephen de Vries</dc:creator><pubDate>Wed, 08 Feb 2012 04:39:13 -0000</pubDate></item><item><title>Re: The OWASP Top Ten and ESAPI &amp;#8211; Part 9 &amp;#8211; Insecure Communications</title><link>http://www.jtmelton.com/2010/08/04/the-owasp-top-ten-and-esapi-part-10-insecure-communications/#comment-409177651</link><description>&lt;p&gt;@Charles, &lt;br&gt;I honestly don't remember if there is a config option in the ESAPI.properties file (though that's where you need to check) related to https. However, you can always override the check (probably search for assertSecure in the ESAPI code) in your own implementation.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">john</dc:creator><pubDate>Wed, 21 Sep 2011 15:13:34 -0000</pubDate></item><item><title>Re: The OWASP Top Ten and ESAPI &amp;#8211; Part 9 &amp;#8211; Insecure Communications</title><link>http://www.jtmelton.com/2010/08/04/the-owasp-top-ten-and-esapi-part-10-insecure-communications/#comment-409177649</link><description>&lt;p&gt;Okay... but what if you WANT to use HTTP? The Swingset demo and apache server are HTTP, and none of the pages in the demo work because of that. How do I disable the HTTPS requirement in ESAPI so I can run these samples?&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Charles</dc:creator><pubDate>Wed, 21 Sep 2011 14:26:47 -0000</pubDate></item><item><title>Re: The OWASP Top Ten and ESAPI &amp;#8211; Part 1 &amp;#8211; Cross Site Scripting (XSS)</title><link>http://www.jtmelton.com/2009/01/12/the-owasp-top-ten-and-esapi-part-2-cross-site-scripting-xss/#comment-409177630</link><description>&lt;p&gt;@Charles, &lt;br&gt;Yes you can look at the esapi-dev and esapi-user mailing lists (and their archives). Thought it's not a standard forum, it's the mechanism you can use to get info. I'd start w/ the user list first.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">john</dc:creator><pubDate>Wed, 21 Sep 2011 01:02:53 -0000</pubDate></item><item><title>Re: The OWASP Top Ten and ESAPI &amp;#8211; Part 1 &amp;#8211; Cross Site Scripting (XSS)</title><link>http://www.jtmelton.com/2009/01/12/the-owasp-top-ten-and-esapi-part-2-cross-site-scripting-xss/#comment-409177629</link><description>&lt;p&gt;Is there a forum for ESAPI? I need to disable strong password checks, and the complete lack of documentation is daunting.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Charles</dc:creator><pubDate>Tue, 20 Sep 2011 20:10:40 -0000</pubDate></item><item><title>Re: A Simple Multi-Threaded Java HTTP Proxy Server</title><link>http://www.jtmelton.com/2007/11/27/a-simple-multi-threaded-java-http-proxy-server/#comment-409177610</link><description>&lt;p&gt;Thanks man!&lt;/p&gt;

&lt;p&gt;Now it's working... =)&lt;/p&gt;

&lt;p&gt;It helped me a lot!&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">João Cortela</dc:creator><pubDate>Thu, 25 Aug 2011 20:32:01 -0000</pubDate></item><item><title>Re: A Simple Multi-Threaded Java HTTP Proxy Server</title><link>http://www.jtmelton.com/2007/11/27/a-simple-multi-threaded-java-http-proxy-server/#comment-409177603</link><description>&lt;p&gt;@Joao, &lt;br&gt;Looks like you might not have the java command right. You might want to try "java -cp . proxy.ProxyServer"&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">john</dc:creator><pubDate>Thu, 25 Aug 2011 20:21:59 -0000</pubDate></item><item><title>Re: A Simple Multi-Threaded Java HTTP Proxy Server</title><link>http://www.jtmelton.com/2007/11/27/a-simple-multi-threaded-java-http-proxy-server/#comment-409177609</link><description>&lt;p&gt;Dude, i'm trying to run your proxy but it fails.&lt;br&gt;When I compile it with "javac *.java" everything goes OK but when I run "java ProxyServer" i get this error:&lt;/p&gt;

&lt;p&gt;"Exception in thread "main" java.lang.NoClassDefFoundError: ProxyServer (wrong name: proxy/ProxyServer)"&lt;/p&gt;

&lt;p&gt;Could you help me?&lt;br&gt;Thanks man!&lt;/p&gt;

&lt;p&gt;ps: Sorry for my english (=&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">João Cortela</dc:creator><pubDate>Thu, 25 Aug 2011 20:09:19 -0000</pubDate></item><item><title>Re: The OWASP Top Ten and ESAPI &amp;#8211; Part 2 &amp;#8211; Injection Flaws</title><link>http://www.jtmelton.com/2009/12/01/the-owasp-top-ten-and-esapi-part-3-injection-flaws/#comment-409177642</link><description>&lt;p&gt;@Ram&lt;br&gt;Thanks for the kind words. Glad you found it helpful&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">john</dc:creator><pubDate>Wed, 16 Mar 2011 06:13:36 -0000</pubDate></item><item><title>Re: The OWASP Top Ten and ESAPI &amp;#8211; Part 2 &amp;#8211; Injection Flaws</title><link>http://www.jtmelton.com/2009/12/01/the-owasp-top-ten-and-esapi-part-3-injection-flaws/#comment-409177643</link><description>&lt;p&gt;What an excellent technical details on OWASP issues. This is the best place to learn about Application Security especially J2EE application.&lt;/p&gt;

&lt;p&gt;Please continue writing such articles to help your fellow professionals.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Ram Guduputi</dc:creator><pubDate>Wed, 16 Mar 2011 04:42:41 -0000</pubDate></item><item><title>Re: Preventing Log Forging in Java</title><link>http://www.jtmelton.com/2010/09/21/preventing-log-forging-in-java/#comment-409177654</link><description>&lt;p&gt;@Eric, &lt;br&gt;Yep, this is a good point.  I generally see this more related to restricting the size of your input.  If you have length restrictions on incoming data that you are logging (request parms, headers, data from DB, etc.), then you are probably ok. However, you could certainly take the route of limiting the length of every log entry.  The issue there is that an attacker could fill to your limit with a few fields, and the remainder (where the actual attack might be) might not get logged.  I think individual restrictions on field length is probably a safer route to go, given that logs can be used forensically, so you probably don't want to lose some of that important data.  Nice catch though.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">john</dc:creator><pubDate>Wed, 09 Mar 2011 15:51:34 -0000</pubDate></item><item><title>Re: Preventing Log Forging in Java</title><link>http://www.jtmelton.com/2010/09/21/preventing-log-forging-in-java/#comment-409177652</link><description>&lt;p&gt;Sorry for dredging up a post from October...but I wanted to comment on another log forging case. What about a size limit on the amount of input data? Blocking CR/LF is good, but I think that being able to fill the log files with useless characters could also be an attack vector. Not very stealthy, but could be useful.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Eric</dc:creator><pubDate>Wed, 09 Mar 2011 15:39:13 -0000</pubDate></item><item><title>Re: A Simple Multi-Threaded Java HTTP Proxy Server</title><link>http://www.jtmelton.com/2007/11/27/a-simple-multi-threaded-java-http-proxy-server/#comment-409177606</link><description>&lt;p&gt;@Gareth, glad it helped.&lt;br&gt;@Ngoc, I wrote the example to be very simple and only support GET requests intentionally to show what it takes.  There are certainly ways to make this work for POST, but that would take more work, and I'll leave that up to you as I mentioned in the article. You could also just download one of many free http proxy tools that are much more functional.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">john</dc:creator><pubDate>Fri, 18 Feb 2011 04:47:51 -0000</pubDate></item><item><title>Re: A Simple Multi-Threaded Java HTTP Proxy Server</title><link>http://www.jtmelton.com/2007/11/27/a-simple-multi-threaded-java-http-proxy-server/#comment-409177613</link><description>&lt;p&gt;Hi John,&lt;/p&gt;

&lt;p&gt;The code works for GET requests only.&lt;br&gt;How to make this work for other request, such as POST?&lt;/p&gt;

&lt;p&gt;Tx.&lt;br&gt;Ngoc&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Ngoc</dc:creator><pubDate>Fri, 18 Feb 2011 04:37:24 -0000</pubDate></item><item><title>Re: The OWASP Top Ten and ESAPI &amp;#8211; Part 1 &amp;#8211; Cross Site Scripting (XSS)</title><link>http://www.jtmelton.com/2009/01/12/the-owasp-top-ten-and-esapi-part-2-cross-site-scripting-xss/#comment-409177626</link><description>&lt;p&gt;@Giriraj&lt;br&gt;That's pretty much right. However, I will point out that it doesn't necessarily mean that you must use a different tag library, though that is an option, and ESAPI does have good output encoding libraries via ESAPI.encoder()... Many of the struts tags do provide sufficient html entity output encoding (by far the most popular output context). In the end, you just have to think about where the data is going and see if the protection is good enough.&lt;/p&gt;

&lt;p&gt;XSS is rather simple to solve in *most* cases that I see (though that's just the examples I see), but can be difficult to solve in others, especially in cases where you put data into locations that process url and or javascript content, because browsers often try to "help" and will actually process multiple contexts at once, so you may have to end up wrapping multiple contexts like javascriptencode(urlencode(data)), or something along those lines.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">john</dc:creator><pubDate>Tue, 01 Feb 2011 14:31:00 -0000</pubDate></item><item><title>Re: The OWASP Top Ten and ESAPI &amp;#8211; Part 1 &amp;#8211; Cross Site Scripting (XSS)</title><link>http://www.jtmelton.com/2009/01/12/the-owasp-top-ten-and-esapi-part-2-cross-site-scripting-xss/#comment-409177619</link><description>&lt;p&gt;Thanks a lot John,&lt;/p&gt;

&lt;p&gt;I think I am getting a feel of what this is all about.&lt;/p&gt;

&lt;p&gt;I can do validation in conjunction with Struts validator.(that's what we use)&lt;br&gt;As for output escaping/encoding I guess the best approach would be to change tag libraries and depending upon the 5 different contexts mentioned in the Prevention Cheat Sheet, start using encoding scheme selectively.&lt;/p&gt;

&lt;p&gt;I thought it would be straightforward but it isn't. I would have to deviate from the usual developer's mentality.&lt;/p&gt;

&lt;p&gt;What do you think?&lt;/p&gt;

&lt;p&gt;Thanks again for your time...&lt;br&gt;Giriraj.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Giriraj</dc:creator><pubDate>Tue, 01 Feb 2011 11:52:50 -0000</pubDate></item><item><title>Re: The OWASP Top Ten and ESAPI &amp;#8211; Part 1 &amp;#8211; Cross Site Scripting (XSS)</title><link>http://www.jtmelton.com/2009/01/12/the-owasp-top-ten-and-esapi-part-2-cross-site-scripting-xss/#comment-409177623</link><description>&lt;p&gt;@GirirajNo&lt;br&gt;Thanks for the comment. &lt;br&gt;As for how to implement output encoding, the general recommendation is to put it where your output is actually being rendered, so yes, that's typically done in a jsp, whether it's in a tag or a scriplet or something like that.  Struts (1 and 2), SpringMVC, and other web frameworks have tags that usually do encoding (though not all of their tags do) that is sufficient for the html entity context, but nothing more.  &lt;/p&gt;

&lt;p&gt;As for context I really can't describe it any better than the cheatsheet - so see &lt;a href="http://www.owasp.org/index.php/XSS_(Cross_Site_Scripting)_Prevention_Cheat_Sheet" rel="nofollow"&gt;http://www.owasp.org/index.php...&lt;/a&gt;. In short though, it just means the browser interprets the text differently depending on whether your between, say a &amp;lt;p&amp;gt; tag versus if you're between &amp;lt;script&amp;gt; tags.&lt;/p&gt;

&lt;p&gt;I suppose a filter could be used to do output encoding via some parsing of the response or something along those lines, but it's much more likely that it would be used for something like input validation.  Something like checking all inputs (parameters, headers, etc) against some whitelist character set and for length might get you where you need to go, but that's often not complete, because there will almost always be business requirements that force exceptions to that validation for proper usage of the app.  &lt;/p&gt;

&lt;p&gt;As to your last point, I certainly understand where you are coming from. Development has been separate from security for a long time in the mind of most developers. Some in the educational system are trying to change that, and folks at owasp (and other groups that provide some sort of training/education) are trying as well, but it's a long road ahead.  I do know, however, learning the security piece well will make you a generally better developer, so it's a worthy thing to spend your efforts on.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">john</dc:creator><pubDate>Fri, 28 Jan 2011 14:40:13 -0000</pubDate></item><item><title>Re: The OWASP Top Ten and ESAPI &amp;#8211; Part 1 &amp;#8211; Cross Site Scripting (XSS)</title><link>http://www.jtmelton.com/2009/01/12/the-owasp-top-ten-and-esapi-part-2-cross-site-scripting-xss/#comment-409177622</link><description>&lt;p&gt;Hey John,&lt;/p&gt;

&lt;p&gt;It's a great article.&lt;/p&gt;

&lt;p&gt;I have a query regarding output encoding.&lt;br&gt;How do i go about implementing it our J2EE application?&lt;br&gt;I mean do I need to use tags to use escaping in all of the jsps that we have?&lt;br&gt;And I still quite don't understand "context"?&lt;/p&gt;

&lt;p&gt;Or can i use a filter to achieve escaping?&lt;/p&gt;

&lt;p&gt;Gosh, development seems to be the easier part. Securing the application is altogether different paradigm.&lt;/p&gt;

&lt;p&gt;Thanks,&lt;br&gt;Giriraj.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Giriraj</dc:creator><pubDate>Fri, 28 Jan 2011 10:46:40 -0000</pubDate></item><item><title>Re: A Simple Multi-Threaded Java HTTP Proxy Server</title><link>http://www.jtmelton.com/2007/11/27/a-simple-multi-threaded-java-http-proxy-server/#comment-409177607</link><description>&lt;p&gt;Dear John,&lt;/p&gt;

&lt;p&gt;Thank you for the example.  I'd been trying lots of things for ages to get my code working.&lt;/p&gt;

&lt;p&gt;Ta,&lt;/p&gt;

&lt;p&gt;Gareth&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Gareth</dc:creator><pubDate>Fri, 14 Jan 2011 17:46:26 -0000</pubDate></item></channel></rss>
