This repository was archived by the owner on Mar 20, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +38
-0
lines changed Expand file tree Collapse file tree 3 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,14 @@ module.exports = {
1717 inputs : [ 'query' ] ,
1818 sinks : sinks . cmdInjectionSemanticChainedCommands
1919 } ,
20+ cmdInjectionSemanticDangerousPaths : {
21+ base : '/cmdInjectionSemanticDangerousPaths' ,
22+ name : 'Command Injection Semantic Dangerous Paths' ,
23+ link : 'https://www.owasp.org/index.php/Command_Injection' ,
24+ products : [ 'Protect' ] ,
25+ inputs : [ 'query' ] ,
26+ sinks : sinks . cmdInjectionSemanticDangerousPaths
27+ } ,
2028 nosqlInjection : {
2129 base : '/nosqlInjection' ,
2230 name : 'NoSQL Injection' ,
Original file line number Diff line number Diff line change 1+ 'use strict' ;
2+ const cp = require ( 'child_process' ) ;
3+
4+ const pre = ( str ) => `<pre>${ str } </pre>` ;
5+
6+ /**
7+ * @param {string } input user input string
8+ * @param {Object } opts
9+ * @param {boolean= } opts.safe are we calling the sink safely?
10+ * @param {boolean= } opts.noop are we calling the sink as a noop?
11+ */
12+ module . exports [ 'child_process.exec' ] = async function exec (
13+ input ,
14+ { safe = false , noop = false } = { }
15+ ) {
16+ if ( safe ) return 'SAFE' ;
17+ if ( noop ) return 'NOOP' ;
18+
19+ return new Promise ( ( resolve ) => {
20+ cp . exec ( "/bin/sh -c 'cat /tmp/foo.txt /etc/passwd'" , ( err , data ) => {
21+ if ( err ) {
22+ console . log (
23+ `exec failed on /bin/sh -c 'cat /tmp/foo.txt /etc/passwd', err: ${ err . message } `
24+ ) ;
25+ }
26+ resolve ( pre ( data . toString ( ) ) ) ;
27+ } ) ;
28+ } ) ;
29+ } ;
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ module.exports = {
55 sqlInjection : require ( './sqlInjection' ) ,
66 cmdInjection : require ( './cmdInjection' ) ,
77 cmdInjectionSemanticChainedCommands : require ( './cmdInjectionSemanticChainedCommands' ) ,
8+ cmdInjectionSemanticDangerousPaths : require ( './cmdInjectionSemanticDangerousPaths' ) ,
89 pathTraversal : require ( './pathTraversal' ) ,
910 ssjs : require ( './ssjs' ) ,
1011 ssrf : require ( './ssrf' ) ,
You can’t perform that action at this time.
0 commit comments