« Yaconf::has
インストール/設定 »

Taint

はじめに

taint は、XSS コード (汚染された文字列) を検出するための拡張モジュールです。 SQL インジェクションやシェルコマンドインジェクションなどの脆弱性を検出するためにも使えます。

taint を有効にすると、汚染された文字列 ($_GET, $_POST, $_COOKIE に由来するもの) を何かの関数に渡そうとしたときに警告を出すようになります。

例1 taint() の例

<?php
$a = trim($_GET['a']);

$file_name = '/tmp' .  $a;
$output    = "Welcome, {$a} !!!";
$var       = "output";
$sql       = "Select *  from " . $a;
$sql      .= "ooxx";

echo $output;

print $$var;

include $file_name;

mysql_query($sql);
?>

上の例の出力は、 たとえば以下のようになります。

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
関連キーワード:
汚染   tainted   Taint   taint   Warning   output   mysql   query   検出   インジェクション   print   main   Attempt   contains   除去   Yaconf   基本   コード   拡張   シェル   脆弱性   由来   trim   Welcome   ooxx
関連する関数・ページ:
function.is-tainted   ref.taint   function.taint   taint.detail   function.untaint   taint.detail.basic