Ethical Hacking

Learn to find vulnerabilities before the bad guys do! Gain real world hands on hacking experience in our state of the art hacking lab. Course designed and taught by expert instructors with years of penetration testing experience. 12 student maximum in every class. Certification attempt included in every package.
Computer Forensics Training at InfoSec Institute

Gain the in-demand skills of a certified computer examiner, learn to recover trace data left behind by fraud, theft, and cybercrime perpetrators. Discover the source of computer crime and abuse at your organization so that it never happens again. All of our class sizes are guaranteed to be 12 students or less to facilitate one-on-one interaction with one of our expert instructors.




Network Security Web-App-Sec
[Top] [All Lists]

Re: Data sanitization approaches in Java

Subject: Re: Data sanitization approaches in Java
Date: Sun, 16 Jan 2005 09:11:18 -0500
Ben,

I did a presentation at last year's OWASP AppSec conference on this subject. There's a link to the presentations on the conference page (http://www.owasp.org/conferences/appsec2004nyc.html).

Essentially, the approaches range from completely external (deep packet inspection/web app firewall), to web server plugin (modsecurity) to J2EE filter, to a common validation library, to just doing it everywhere in your code. There are advantages and disadvantages to all of them, although I find the J2EE filter approach to be the most flexible.

Also, I noticed that you use the word "sanitization" -- did you mean actually modifying the input data? This is a little tricky in J2EE, although possible. If that's what you're after, let me know.

Oh, and URL encoding is really not a very good idea. Many interpreters just decode URL encoding automatically. HTML entity encoded data (< > ") is generally not interpreted. There's not an HtmlEntityEncoder built into J2EE, so you'll have to roll your own. I could post one if there's interest.

--Jeff

Jeff Williams, CEO
Aspect Security, Inc.
http://www.aspectsecurity.com

----- Original Message ----- From: "Benjamin Livshits" <livshits@cs.stanford.edu>
To: <webappsec@securityfocus.com>
Sent: Friday, January 14, 2005 4:20 PM
Subject: Data sanitization approaches in Java



I was wondering about data sanitization strategies commonly used in
today's Web applications, especially those written using J2EE. I am
aware of libraries that would simplify the sanitization process for you,
however, I haven't really seen many applications that use anything more
sophisticated than URL-encoding the user-supplied string data.

Are there some common sanitization strategies that people actually use
in their code on a regular basis?

Thanks in advance,
-Ben


<Prev in Thread] Current Thread [Next in Thread>