I'm building an application which lets users input custom CSS for their own profiles (kinda like MySpace, Friendster, or Blogger).
The problem is I'm having a hard time finding a way to purify XSS attacks through CSS. I tried using HTMLPurifier, but it doesn't work. One example:
html {
expression: alert('xss');
}
body {
background-color: #FFF;
}
This would be allowed by HTMLPurifier.
Are there any settings I need to use for HTMLPurifier to make this invalid?
Thanks!
Update
Is expression: the only way to push an exploit via CSS? If so, would a regular expression be more efficient than using HTMLPurifier?