<?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 => 'fr',
  ),
  'this' => 
  array (
    0 => 'book.taint.php',
    1 => 'Taint',
    2 => 'Taint',
  ),
  'up' => 
  array (
    0 => 'refs.basic.other.php',
    1 => 'Autres extensions basiques',
  ),
  'prev' => 
  array (
    0 => 'yaconf.has.php',
    1 => 'Yaconf::has',
  ),
  'next' => 
  array (
    0 => 'taint.setup.php',
    1 => 'Installation/Configuration',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'fr',
    '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">Introduction</h1>
  <p class="simpara">
   Taint est une extension permettant de détecter des codes XSS (chaînes
   corrompues). Elle peut également être utilisée pour repérer des injections
   SQL, des injections de commandes, des injections de chemins de fichiers et
   des vulnérabilités similaires.
  </p>
  <p class="simpara">
   Lorsque taint est activé, les chaînes reçues de l&#039;entrée utilisateur —
   <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> et
   <var class="varname"><a href="reserved.variables.cookies.php" class="classname">$_COOKIE</a></var> — sont marquées comme corrompues au démarrage
   de la requête, et la marque est propagée à travers les opérations sur les
   chaînes. Lorsqu&#039;une chaîne corrompue atteint un point de sortie dangereux
   (affichage, requête SQL, commande shell, chemin de fichier...), taint émet
   un avertissement pointant vers cet endroit. Voir
   <a href="taint.detail.php" class="link">Propagation et vérifications</a> pour les
   listes complètes.
  </p>
  <p class="simpara">
   Taint est un outil de développement et d&#039;audit, non une défense à
   l&#039;exécution : il ne fait que signaler des problèmes possibles et ne bloque
   ni n&#039;altère jamais les données. Il est délibérément conservateur et peut
   sur-rapporter, donc un passage sans erreur signifie uniquement « rien que
   taint ne pouvait voir », jamais « prouvablement sécurisé ». Ne pas
   l&#039;activer dans les environnements de production.
  </p>
  <div class="example" id="example-1">
   <p><strong>Exemple #1 Exemple avec Taint</strong></p>
   <div class="example-contents">
<div class="phpcode"><pre><code style="color: #000000"><span style="color: #0000BB">&lt;?php
$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">]);

</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">;
</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">;
</span><span style="color: #0000BB">$sql       </span><span style="color: #007700">= </span><span style="color: #DD0000">"SELECT * FROM users WHERE name = " </span><span style="color: #007700">. </span><span style="color: #0000BB">$a</span><span style="color: #007700">;

echo </span><span style="color: #0000BB">$output</span><span style="color: #007700">;
print </span><span style="color: #0000BB">$output</span><span style="color: #007700">;
include </span><span style="color: #0000BB">$file_name</span><span style="color: #007700">;
</span><span style="color: #0000BB">mysqli_query</span><span style="color: #007700">(</span><span style="color: #0000BB">$link</span><span style="color: #007700">, </span><span style="color: #0000BB">$sql</span><span style="color: #007700">);
</span><span style="color: #0000BB">?&gt;</span></code></pre></div>
   </div>

   <div class="example-contents"><p>Résultat de l&#039;exemple ci-dessus est similaire à :</p></div>
   <div class="example-contents screen">
<div class="cdata"><pre>
Warning: main() [echo]: Attempt to echo a string that might be tainted in /path/to/script.php on line 9

Warning: main() [print]: Attempt to print a string that might be tainted in /path/to/script.php on line 10

Warning: main() [include]: File path contains data that might be tainted in /path/to/script.php on line 11

Warning: main() [mysqli_query]: SQL statement contains data that might be tainted in /path/to/script.php on line 12
</pre></div>
   </div>
  </div>
 </div>

 






 






 







<ul class="chunklist chunklist_book"><li><a href="taint.setup.php">Installation/Configuration</a><ul class="chunklist chunklist_book chunklist_children"><li><a href="taint.requirements.php">Pr&eacute;-requis</a></li><li><a href="taint.installation.php">Installation</a></li><li><a href="taint.configuration.php">Configuration &agrave; l'ex&eacute;cution</a></li><li><a href="taint.resources.php">Types de ressources</a></li></ul></li><li><a href="taint.detail.php">Propagation et v&eacute;rifications</a><ul class="chunklist chunklist_book chunklist_children"><li><a href="taint.detail.basic.php">Comment la marque de corruption se propage</a></li><li><a href="taint.detail.sinks.php">O&ugrave; taint d&eacute;clenche des avertissements</a></li></ul></li><li><a href="ref.taint.php">Fonctions Taint</a><ul class="chunklist chunklist_book chunklist_children"><li><a href="function.is-tainted.php">is_tainted</a> — V&eacute;rifie si une cha&icirc;ne est corrompue</li><li><a href="function.taint.php">taint</a> — Marque des cha&icirc;nes comme corrompues</li><li><a href="function.untaint.php">untaint</a> — Retire la marque de corruption des cha&icirc;nes</li></ul></li></ul></div><?php manual_footer($setup); ?>