[Full-Disclosure] [ANNOUNCE] kses 0.2.2
Ulf.Harnhammar.9485 at student.uu.se
Tue Feb 8 02:05:06 GMT 2005
kses 0.2.2 [kses strips evil scripts!]
* INTRODUCTION *
kses is an HTML/XHTML filter written in PHP. It removes all unwanted HTML
elements and attributes, no matter how malformed HTML input you give it.
It also does several checks on attribute values. kses can be used to avoid
Cross-Site Scripting (XSS), Buffer Overflows and Denial of Service attacks,
among other things.
The program is released under the terms of the GNU General Public License.
It is used by popular programs such as WordPress and Geeklog.
* FEATURES *
Some of kses' current features are:
* It will only allow the HTML elements and attributes that it was explicitly
told to allow.
* Element and attribute names are case-insensitive (a href vs A HREF).
* It will understand and process whitespace correctly.
* Attribute values can be surrounded with quotes, apostrophes or nothing.
* It will accept valueless attributes with just names and no values (selected).
* It will accept XHTML's closing " /" marks.
* Attribute values that are surrounded with nothing will get quotes to avoid
producing non-W3C conforming HTML
(<a href=http://sourceforge.net/projects/kses> works but isn't valid HTML).
* It handles lots of types of malformed HTML, by interpreting the existing
code the best it can and then rebuilding new code from it. That's a better
approach than trying to process existing code, as you're bound to forget about
some weird special case somewhere. It handles problems like never-ending
quotes and tags gracefully.
* It will remove additional "<" and ">" characters that people may try to
sneak in somewhere.
* It supports checking attribute values for minimum/maximum length and
minimum/maximum value, to protect against Buffer Overflows and Denial of
Service attacks against WWW clients and various servers. You can stop
<iframe src= width= height=> from having too high values for width and height,
* It has got a system for whitelisting URL protocols. You can say that
attribute values may only start with http:, https:, ftp: and gopher:, but no
do this work handle whitespace, upper/lower case, HTML entities
It also normalizes HTML entities as a nice side effect.
* It handles NULL bytes and Opera's chr(173) whitespace characters.
* There is a procedural version and two object-oriented versions (for PHP 4
and PHP 5) of kses.
* NEW IN 0.2.2 *
The 0.2.2 release adds a second object-oriented kses version for PHP 5, the use
of isset() avoids PHP notice warnings, the chr(173) handling is changed to help
Asian users, and the handling of closing HTML elements is improved, among other
You can download this new version at http://sourceforge.net/projects/kses .
Any comments, bug reports, feature requests or security audits are very
welcome, so don't hesitate to get in touch.
// Ulf Harnhammar and the kses development group, February 2005
Full-Disclosure is hosted and sponsored by Secunia.