<?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 => 'es',
  ),
  'this' => 
  array (
    0 => 'book.taint.php',
    1 => 'Taint',
    2 => 'Taint',
  ),
  'up' => 
  array (
    0 => 'refs.basic.other.php',
    1 => 'Otras extensiones b&aacute;sicas',
  ),
  'prev' => 
  array (
    0 => 'yaconf.has.php',
    1 => 'Yaconf::has',
  ),
  'next' => 
  array (
    0 => 'taint.setup.php',
    1 => 'Instalaci&oacute;n/Configuraci&oacute;n',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'es',
    '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">Introducción</h1>
  <p class="para">
   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.
  </p>
  <p class="para">
   Si taint está habilitada, advertirá de si se ha proporcionado una cadena corrompida
   (que venga de <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>
   o <var class="varname"><a href="reserved.variables.cookies.php" class="classname">$_COOKIE</a></var>) a alguna función.
  </p>
  <div class="example" id="example-1">
   <p><strong>Ejemplo #1 Ejemplo de <span class="function"><a href="function.taint.php" class="function">taint()</a></span></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">$nombre_fichero </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">$salida    </span><span style="color: #007700">= </span><span style="color: #DD0000">"¡¡¡Bienvenido, </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">"salida"</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">$salida</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">$nombre_fichero</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>Resultado del ejemplo anterior es similar 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">Instalaci&oacute;n/Configuraci&oacute;n</a><ul class="chunklist chunklist_book chunklist_children"><li><a href="taint.installation.php">Instalaci&oacute;n</a></li><li><a href="taint.configuration.php">Configuraci&oacute;n en tiempo de ejecuci&oacute;n</a></li></ul></li><li><a href="taint.detail.php">M&aacute;s detalles</a><ul class="chunklist chunklist_book chunklist_children"><li><a href="taint.detail.basic.php">Funciones y sentencias que propagar&aacute;n la marca de corrupci&oacute;n de una
   cadena corrupta</a></li><li><a href="taint.detail.taint.php">Funciones y sentencias que comprobar&aacute;n cadenas corrompidas</a></li><li><a href="taint.detail.untaint.php">Funciones que sanean cadenas corruptas</a></li></ul></li><li><a href="ref.taint.php">Funciones de taint</a><ul class="chunklist chunklist_book chunklist_children"><li><a href="function.is-tainted.php">is_tainted</a> — Comprobar si un string est&aacute; corrompido</li><li><a href="function.taint.php">taint</a> — Corrompe un string</li><li><a href="function.untaint.php">untaint</a> — Sanea un string</li></ul></li></ul></div><?php manual_footer($setup); ?>