<?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 => 'tr',
  ),
  'this' => 
  array (
    0 => 'book.taint.php',
    1 => 'Taint',
    2 => 'Taint',
  ),
  'up' => 
  array (
    0 => 'refs.basic.other.php',
    1 => 'Diğer Temel Eklentiler',
  ),
  'prev' => 
  array (
    0 => 'yaconf.has.php',
    1 => 'Yaconf::has',
  ),
  'next' => 
  array (
    0 => 'taint.setup.php',
    1 => 'Yapılandırma/Kurulum',
  ),
  '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">Giriş</h1>
  <p class="simpara">
   Taint is an extension for detecting XSS code (tainted strings). It can
   also be used to spot SQL injection, command injection, file path
   injection and similar vulnerabilities.
  </p>
  <p class="simpara">
   When taint is enabled, strings received from user input —
   <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> and
   <var class="varname"><a href="reserved.variables.cookies.php" class="classname">$_COOKIE</a></var> — are marked as tainted at request startup,
   and the mark is tracked through string operations. When a tainted
   string reaches a dangerous sink (output, SQL query, shell command,
   file path, ...), taint raises a warning pointing at that spot. See
   <a href="taint.detail.php" class="link">Propagation and Checked Sinks</a> for
   the complete lists.
  </p>
  <p class="simpara">
   Taint is a development and auditing tool, not a runtime defense: it
   only reports possible problems and never blocks or alters data. It is
   deliberately conservative and may over-report, so a clean run means
   only &quot;nothing taint could see&quot;, never &quot;provably secure&quot;. Do not enable
   it in production environments.
  </p>
  <div class="example" id="example-1">
   <p><strong>Örnek 1 Taint example</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>
Yukarıdaki örnek şuna benzer bir çıktı üretir:</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">Yapılandırma/Kurulum</a><ul class="chunklist chunklist_book chunklist_children"><li><a href="taint.requirements.php">Gereksinimler</a></li><li><a href="taint.installation.php">Kurulum</a></li><li><a href="taint.configuration.php">&Ccedil;alışma Anı Yapılandırması</a></li><li><a href="taint.resources.php">&Ouml;zkaynak T&uuml;rleri</a></li></ul></li><li><a href="taint.detail.php">Propagation and Checked Sinks</a><ul class="chunklist chunklist_book chunklist_children"><li><a href="taint.detail.basic.php">How the taint mark is propagated</a></li><li><a href="taint.detail.sinks.php">Where taint raises warnings</a></li></ul></li><li><a href="ref.taint.php">Taint İşlevleri</a><ul class="chunklist chunklist_book chunklist_children"><li><a href="function.is-tainted.php">is_tainted</a> — Check whether a string is tainted</li><li><a href="function.taint.php">taint</a> — Mark strings as tainted</li><li><a href="function.untaint.php">untaint</a> — Remove the taint mark from strings</li></ul></li></ul></div><?php manual_footer($setup); ?>