PHP 8.6.0 Beta 1 is available for testing

Taint

Introducción

Taint es una extensión que sirve para detectar código XSS (strings corrompidos, «tainted»). También se puede utilizar para localizar vulnerabilidades a inyecciones SQL, inyecciones «shell», etc.

Si taint está habilitada, advertirá de si se ha proporcionado una cadena corrompida (que venga de $_GET , $_POST o $_COOKIE ) a alguna función.

Ejemplo #1 Ejemplo de taint()

<?php
$a = trim($_GET['a']);
$nombre_fichero = '/tmp' . $a;
$salida = "¡¡¡Bienvenido, {$a} !!!";
$var = "salida";
$sql = "Select * from " . $a;
$sql .= "ooxx";
echo $salida;
print $$var;
include $nombre_fichero;
mysql_query($sql);
?>

Resultado del ejemplo anterior es similar a:

Warning: main() [function.echo]: Attempt to echo a string that might be tainted
Warning: main() [function.echo]: Attempt to print a string that might be tainted
Warning: include() [function.include]: File path contains data that might be tainted
Warning: mysql_query() [function.mysql-query]: SQL statement contains data that might be tainted

Found A Problem?

Learn How To Improve This PageSubmit a Pull RequestReport a Bug
+add a note

User Contributed Notes 1 note

up
3
dewi at dewimorgan dot com
8 years ago
Latest compatibility info is available at the pecl page - https://pecl.php.net/package/taint shows that latest compatibility is 7+, and a windows DLL is available.
+add a note

AltStyle によって変換されたページ (->オリジナル) /