合肥seo网站推广外包,体育网站建设的必要性,城乡建设官方网站,曲靖做网站需要多少钱前言#xff1a;今天学习了重定向漏洞#xff0c;这个漏洞比较好理解漏洞名#xff1a;URL重定向漏洞威胁#xff1a;低漏洞的来源#xff1a;开发者对head头做好对应的过滤和限制例子#xff1a;有漏洞的网站#xff1a;http://a.com/x.php?urlhttp://a.com/login.php…前言今天学习了重定向漏洞这个漏洞比较好理解漏洞名URL重定向漏洞威胁低漏洞的来源开发者对head头做好对应的过滤和限制例子有漏洞的网站http://a.com/x.php?urlhttp://a.com/login.php这时我们通过写个url后面的链接让其跳转到指定的页面。例http;//a.com/x.php?urlhttp://www.baidu.com可搭配使用的漏洞CSRF 当一个网站存在CSRF漏洞的时候而你知道了创建后台管理员的链接。修改链接运用URL重定向漏洞。在进行短链生成储存型XSS 当一个网站存在储存型XSS漏洞的时候你插入了一个盗取cookie的js。配合URL重定向漏洞让受害者直接跳转到该页面正文这里我们使用BWAPP这个漏洞网站来进行URL重定向测试。http://192.168.3.41/bWAPP/unvalidated_redir_fwd_1.php未过滤的重定向与转发点击Beam按钮跳转到打开Burpsuite抓包一看发现参数是这样的urlxxxxformsubmit发送到repeater修改urlhttp://www.baidu.com产生302跳转。跳转页面为http://www.baidu.com回到刚刚的位置放包一看跳转中级尝试一样抓包直接进行改链发现跳回到登录页面。仔细对比发现中级防御通过cookie的设置来判断将其改为0在改其url后面的参数直接跳转高级尝试高级和中级防御没区别。只是将cookie后面的值改为2。直接改0将其链接设置跳转成博客园的链接博客园这里要经过两次跳转验证URl重定向的漏洞脚的本代码importrequests,timedefpoc():userinput(Please enter the web site to be tested:)user2input(Please enter the parameters you want to bring in:)valuesuser2.strip().split(?)[-1]params{}for line in values.split():key,valueline.split(,1)params[key]valueprint(URL:,user)print(The parameters you have taken are:,params)time.sleep(0.2)print(If you want to change the parameters, please enter y)print(Do not need to change to enter n)user3input(Do you want to change your parameters[y/n]:)if user3 y:whileTrue:print(Please enter the name of the parameter you want to change{name: value})print(params)user4input(Please fill in the name:)user5input(Please enter the value you want to change:)params[{}.format(user4)]{}.format(user5)print(The change is done, and your current parameter is,params)user6input(Do you want to continue to love the parameters more[y/n]?:)if user6 y:continueelif user6 n:breakelif user6 :breakurluser.strip()headers{User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36}restrequests.get(urlurl,headersheaders,timeout6,paramsparams, allow_redirectsFalse)print(Http_code:,rest.status_code)print(rest.headers)try:print(rest.headers[Location])if rest.headers[Location] http://www.baidu.com:print([*]There is a URL redirection vulnerability in this link)else:print([]There is no URL redirection vulnerability in this link)except:print([-]not Location head)poc()运行结果如下总结虽然漏洞威胁不高但还是要防御。防御方法有以下几种可利用state参数进行防跨站攻击验证302跳转回来带code参数的这个请求是否是攻击者伪造的防止攻击者伪造请求。对于外链攻击可在支持HTML5浏览器的环境下给所有外部链接加上relnoreferrer属性对于老版本IE的处理方案是利用一个HTTPS进行跳转达到抹去referer的效果PHP获取retferer判断来路防止非法访问http://www.90tec.com/iwork/20.html第二种我不喜欢其他都还好