Browse Source

Un type de donnees en plus 'xss' pour un jeu de donnees contenant du html malicieux

master
Cerdic 4 months ago
parent
commit
cadbdd7fb2
  1. 38
      inc/tb_essais_type.php
  2. 1307
      inc/xssAttacks.xml
  3. 1
      lang/tb_fr.php

38
inc/tb_essais_type.php

@ -339,8 +339,46 @@ paragraphes avec des accents UTF-8 aàâä eéèêë iîï oô uùü",
);
return $jeu;
break;
case 'xss':
// HTML Purifier XSS Attacks Smoketest
// XSS attacks are from <a href="http://ha.ckers.org/xss.html">http://ha.ckers.org/xss.html</a>
$xml_file = find_in_path('inc/xssAttacks.xml');
$xml = simplexml_load_file($xml_file);
$jeu = [];
foreach ($xml->attack as $attack){
$code = $attack->code;
// custom code for null byte injection tests
if (substr($code, 0, 7)=='perl -e'){
$code = substr($code, $i = strpos($code, '"')+1, strrpos($code, '"')-$i);
$code = str_replace('\0', "\0", $code);
}
// disable vectors we cannot test in any meaningful way
if ($code=='See Below'){
continue;
} // event handlers, whitelist defeats
if ($attack->name=='OBJECT w/Flash 2'){
continue;
} // requires ActionScript
if ($attack->name=='IMG Embedded commands 2'){
continue;
} // is an HTTP response
// custom code for US-ASCII, which couldn't be expressed in XML without encoding
if ($attack->name=='US-ASCII encoding'){
$code = urldecode($code);
}
$jeu[] = (string)$code;
}
return $jeu;
break;
}
return $jeu;
}
?>

1307
inc/xssAttacks.xml
File diff suppressed because it is too large
View File

1
lang/tb_fr.php

@ -66,6 +66,7 @@ Les pseudo-types disponibles sont :
-* <tt>mimetype</tt> string de nommage des mime-type
-* <tt>version</tt> Numeros de version a 1,2 ou 3 digits, avec variantes dev, alpha, beta, RC, pl
-* <tt>operateur</tt> pour des operateurs de comparaison
-* <tt>xss</tt> pour du html malicieux
'
);

Loading…
Cancel
Save