burpsuite设置宏绕过csrf token

为了防止csrf和表单重复提交,有些系统使用了Token机制,具体机制可自行研究,这对我们的个别测试造成了一定的不便。

解决思路:

1、将获取token的操作设置为宏,自动完成每次重新获取token的操作(最为省时,但比较麻烦)

2、测试阶段让开发将token设为一个定值(最为方便)

3、全部测试均使用proxy模块(最为简单,但最为耗时,且无法完成高级自动化测试功能)

针对思路1,百度了一下,发现答案同质化严重,基本均参考外国博客:

https://labs.asteriskinfosec.com.au/fuzzing-and-sqlmap-inside-csrf-protected-locations-part-1/

实际试了下,发现还是英文原版的看的明白,中文的写的都太简略

如下为burpsuite绕过token的方法:

1、进入options选项、选择sessions

2、添加一个session handing rules,在弹出的session handing rules editor中输入rule的名字,并添加一个action

3、在点击Add弹出的菜单中选择run a macro(设置一个宏)

4、之后选择添加一个宏(点击Add)

5、此时会弹出两个页面:macro recorder和macro editor

首先看macro recorder页面,使用方式和proxy模块中http history一样

具体操作方式(以最简单的登录为例):

(1)设置好浏览器,关闭burpsuite的拦截器

(2)清掉之前的请求记录,开启一个新的浏览器(防止之前请求的影响)

(3)访问登录页面,此时可以看到响应中有_csrf参数,目的达到

(4)ctrl选中刚才的get请求,点击OK

6、此时macro recorder页面会关闭,进入macro editor页面

可以在此页面测试宏(对于比较复杂的宏)

7、点击OK,回到action editor界面,选择只替换token参数

8、回到rule editor界面,选择scope页,选择此宏的作用域

9、如下我们就绕过了登陆页面的token,即可以拿一个请求重复发送,每次重新登陆获取token的步骤burpsuite自动帮我们做了。

在intruder里验证,好的,我们发现我们可以对密码进行爆破了~

但是实际使用中遇到了一些问题:

如果token不是位于参数里而是位于header里,即X-CSRF-TOKEN,目前无法替换,不知道可有好的方法。

时间: 2024-08-01 05:56:32

burpsuite设置宏绕过csrf token的相关文章

sqlmap和burpsuite绕过csrf token进行SQL注入检测

利用sqlmap和burpsuite绕过csrf token进行SQL注入 转载请注明来源:http://www.cnblogs.com/phoenix--/archive/2013/04/12/3016332.html 问题:post方式的注入验证时遇到了csrf token的阻止,原因是csrf是一次性的,失效导致无法测试. 解决方案:Sqlmap配合burpsuite,以下为详细过程,参照国外牛人的blog(不过老外讲的不是很细致,不适合我等小白). 1.打开burpsuite(以1.5为

Invalid CSRF Token 'null' was found on the request parameter '_csrf' or header 'X-CSRF-TOKEN'

Spring Security :HTTP Status 403-Invalid CSRF Token 'null' was found on the request parameter '_csrf' or header 'X-CSRF-TOKEN'. 原因:1.Spring Security 4.0之后,引入了CSRF,默认是开启.CSRF默认支持的方法: GET|HEAD|TRACE|OPTIONS,不支持POST. Spring Security 3默认关闭csrf,Spring Sec

使用Ajax (put delete ) django原生CBV 出现csrf token解决办法

原文地址: https://blog.csdn.net/weixin_35993084/article/details/80778921 修改ajax中type方式并设置header,同时对put重新构建数据字典 在对views中的方法进行类对象封装时,发现django并不支持像post和get一样将数据封装. 由于网页端无法设置method方法,在用postman和ajax开启pycharm对接口进行debug测试时发现:提交数据后并没有进入代码逻辑. 查阅资料得知,django支持put和d

关于 DjangoUeditor 上传图片图片失败,csrf token missing or incorrect 的解决办法

Forbidden (CSRF token missing or incorrect.): /ueditor/controller/ [27/Jun/2017 23:49:25] "POST /ueditor/controller/?imagePathFormat=courses%2Fueditor%2F&filePathFormat=courses%2Fueditor%2F&action=uploadvideo&encode=utf-8 HTTP/1.1" 4

What is the best way to handle Invalid CSRF token found in the request when session times out in Spring security

18.5.1 Timeouts One issue is that the expected CSRF token is stored in the HttpSession, so as soon as the HttpSession expires your configured AccessDeniedHandler will receive a InvalidCsrfTokenException. If you are using the default AccessDeniedHandl

Django后台post请求中的csrf token

使用Requests库操作自己的Django站点,post登陆admin页面返回403,serverlog显示csrf token not set. csrf token是get登陆页面时服务器放在cookies中返回的. 所以完整的登陆应该是这样的: import requests s = requests.Session() r = s.get("http://serveraddr/admin") s.cookies = r.cookies loginpage = s.post(a

CodeIgniter中使用CSRF TOKEN的一个坑

事情的经过是这样的,一个自动化扫描工具说我的代码中存在XSS漏洞,什么是XSS不懂的朋友可以看这里 我的代码里面开启CodeIgniter框架的CSRF Token,如下: 很简单,更多详情参考CI官方文档,主要用法就是在form_open时候自动插入一个隐藏的token值,当然还可以直接用php echo security->csrf_hash来配合其他一些用法,这里不多说. 接下来说说我的代码,Controller中代码如下: 视图层代码这里页写得比较简单: 代码中只是生成一个form里面带

"CSRF token missing or incorrect."的解决方法.

现象: Forbidden (403)CSRF verification failed. Request aborted.HelpReason given for failure:CSRF token missing or incorrect. In general, this can occur when there is a genuine Cross Site Request Forgery, or when Django's CSRF mechanism has not been use

Forbidden (CSRF token missing or incorrect.):错误解决办法

在JS中,使用post方法提交数据到后台,出现错误: Forbidden (CSRF token missing or incorrect.):.........; 解决办法: 在页面导入JS的位置,补上以下代码即可: 1 <script> 2 $.ajaxSetup({ 3 data:{csrfmiddlewaretoken:'{{ csrf_token }}'} 4 }) 5 </script> 原文地址:https://www.cnblogs.com/lhb-alan/p/1