<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/refs.basic.other.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'it',
  ),
  'this' => 
  array (
    0 => 'book.taint.php',
    1 => 'Taint',
    2 => 'Taint',
  ),
  'up' => 
  array (
    0 => 'refs.basic.other.php',
    1 => 'Altre estensioni fondamentali',
  ),
  'prev' => 
  array (
    0 => 'yaconf.has.php',
    1 => 'Yaconf::has',
  ),
  'next' => 
  array (
    0 => 'taint.setup.php',
    1 => 'Installazione/Configurazione',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/taint/book.xml',
  ),
  'history' => 
  array (
  ),
  'extra_header_links' => 
  array (
    'rel' => 'alternate',
    'href' => '/manual/en/feeds/book.taint.atom',
    'type' => 'application/atom+xml',
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="book.taint" class="book">
 
 <h1 class="title">Taint</h1>
 

 <div id="intro.taint" class="preface">
  <h1 class="title">Introduzione</h1>
  <p class="para">
   Taint is an extension, which is used for detecting XSS codes (tainted
   string).
   And also can be used to spot sql injection vulnerabilities, and shell
   inject, etc.
  </p>
  <p class="para">
   When taint is enabled, if you pass a tainted string (comes from <var class="varname"><a href="reserved.variables.get.php" class="classname">$_GET</a></var>,
   <var class="varname"><a href="reserved.variables.post.php" class="classname">$_POST</a></var> or <var class="varname"><a href="reserved.variables.cookies.php" class="classname">$_COOKIE</a></var>) to some functions, taint will warn you about that.
  </p>
  <div class="example" id="example-1">
   <p><strong>Example #1 <span class="function"><a href="function.taint.php" class="function">Taint()</a></span>example</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$a </span><span style="color: #007700">= </span><span style="color: #0000BB">trim</span><span style="color: #007700">(</span><span style="color: #0000BB">$_GET</span><span style="color: #007700">[</span><span style="color: #DD0000">'a'</span><span style="color: #007700">]);<br /><br /></span><span style="color: #0000BB">$file_name </span><span style="color: #007700">= </span><span style="color: #DD0000">'/tmp' </span><span style="color: #007700">.  </span><span style="color: #0000BB">$a</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$output    </span><span style="color: #007700">= </span><span style="color: #DD0000">"Welcome, </span><span style="color: #007700">{</span><span style="color: #0000BB">$a</span><span style="color: #007700">}</span><span style="color: #DD0000"> !!!"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$var       </span><span style="color: #007700">= </span><span style="color: #DD0000">"output"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$sql       </span><span style="color: #007700">= </span><span style="color: #DD0000">"Select *  from " </span><span style="color: #007700">. </span><span style="color: #0000BB">$a</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$sql      </span><span style="color: #007700">.= </span><span style="color: #DD0000">"ooxx"</span><span style="color: #007700">;<br /><br />echo </span><span style="color: #0000BB">$output</span><span style="color: #007700">;<br /><br />print $</span><span style="color: #0000BB">$var</span><span style="color: #007700">;<br /><br />include </span><span style="color: #0000BB">$file_name</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">mysql_query</span><span style="color: #007700">(</span><span style="color: #0000BB">$sql</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

   <div class="example-contents"><p>Il precedente esempio visualizzerà
qualcosa simile a:</p></div>
   <div class="example-contents screen">
<div class="cdata"><pre>
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
</pre></div>
   </div>
  </div>
 </div>

 






 
 





 
 






<ul class="chunklist chunklist_book"><li><a href="taint.setup.php">Installazione/Configurazione</a><ul class="chunklist chunklist_book chunklist_children"><li><a href="taint.installation.php">Installazione</a></li><li><a href="taint.configuration.php">Configurazione di Runtime</a></li></ul></li><li><a href="taint.detail.php">More Details</a><ul class="chunklist chunklist_book chunklist_children"><li><a href="taint.detail.basic.php">Functions and Statements which will spread the tainted mark of a
   tainted string</a></li><li><a href="taint.detail.taint.php">Functions and statements which will check tainted string</a></li><li><a href="taint.detail.untaint.php">Functions which untaint the tainted string</a></li></ul></li><li><a href="ref.taint.php">Taint Funzioni</a><ul class="chunklist chunklist_book chunklist_children"><li><a href="function.is-tainted.php">is_tainted</a> — Controlla se una stringa &egrave; contaminata</li><li><a href="function.taint.php">taint</a> — Contamina una stringa</li><li><a href="function.untaint.php">untaint</a> — Decontamina stringhe</li></ul></li></ul></div><?php manual_footer($setup); ?>