Continuando con la serie, ¿qué cosas se tienen que cumplir para que el siguiente código sea vulnerable a XSS?

php:
<?php
/* Evitar XSS a través de otros formatos */
header('Content-type: text/html; charset=utf-8;');

$color = '000';
if ( !empty($_GET['color']) ) {
        $color = htmlentities(strip_tags($_GET['color']));
}


?>
<html>

<head>
        <title>Anti XSS Page :D </title>
        <style type="text/css">
        #demo {
                width: 100%;
                height: 50px;
                background: #<?php echo $color;  ?>;
        }
        </style>
</head>

<body>

<div id="demo">

</div>

</body>

</html>

Actualización: Bien, luego de haber esperado un cierto tiempo, paso a comentar el problema:

La porción de código mostrada, es vulnerable a XSS solamente en Internet Explorer, puesto que este buen navegador :D , posee características que permiten ejecutar código javascript dentro de una hoja de estilos.

Microsoft Internet Explorer 5 offers an easy-to-use new feature that enables Web authors and developers to vastly improve the appearance and rendering of their Web pages. Using the power of dynamic properties, it is now possible to declare property values not only as constants, but also as formulas. The formulas used in a dynamic property can reference property values from other elements, thereby allowing authors unique flexibility when designing their Web pages.

Ahora que sabemos que se puede ejecutar javascript dentro de la hoja de estilos -en todas las versiones de IE, entonces lo único que tenemos que hacer es usar valores que no sean afectados por la función htmlentities, por ejemplo si se usa lo siguiente f00;left:expression(alert(String.fromCharCode(88,83,83))) (abrir con IE), se mostrará un mensaje con el texto XSS.

Si quieren encontrar más ejemplos (abrir con IE) de este tipo, pueden darse una vuelta por MSDN