JS: js/shell-command-injection-from-environment#2092
JS: js/shell-command-injection-from-environment#2092semmle-qlci merged 2 commits intomasterfrom unknown repository
Conversation
|
If you include |
|
The properties of |
|
LGTM. But someone else should also take a look. (The build fails due to mixed tabs and spaces). |
xiemaisi
left a comment
There was a problem hiding this comment.
Mostly LGTM, a number of minor suggestions and comments.
javascript/ql/src/Security/CWE-078/ShellCommandInjectionFromEnvironment.qhelp
Outdated
Show resolved
Hide resolved
javascript/ql/src/Security/CWE-078/ShellCommandInjectionFromEnvironment.qhelp
Outdated
Show resolved
Hide resolved
javascript/ql/src/Security/CWE-078/ShellCommandInjectionFromEnvironment.qhelp
Outdated
Show resolved
Hide resolved
javascript/ql/src/Security/CWE-078/ShellCommandInjectionFromEnvironment.qhelp
Outdated
Show resolved
Hide resolved
javascript/ql/src/Security/CWE-078/ShellCommandInjectionFromEnvironment.ql
Outdated
Show resolved
Hide resolved
...c/semmle/javascript/security/dataflow/ShellCommandInjectionFromEnvironmentCustomizations.qll
Outdated
Show resolved
Hide resolved
...c/semmle/javascript/security/dataflow/ShellCommandInjectionFromEnvironmentCustomizations.qll
Outdated
Show resolved
Hide resolved
...c/semmle/javascript/security/dataflow/ShellCommandInjectionFromEnvironmentCustomizations.qll
Outdated
Show resolved
Hide resolved
...c/semmle/javascript/security/dataflow/ShellCommandInjectionFromEnvironmentCustomizations.qll
Show resolved
Hide resolved
mchammer01
left a comment
There was a problem hiding this comment.
@esben-semmle - first editorial review completed. One minor suggestion (and I agree with @xiemaisi's comments too). LGTM apart from that.
Have we lost the HTML previews?
javascript/ql/src/Security/CWE-078/ShellCommandInjectionFromEnvironment.qhelp
Outdated
Show resolved
Hide resolved
|
All comments addressed. |
No, it is there now. Maybe it was not produced because of the merge conflict (I did not check). |
mchammer01
left a comment
There was a problem hiding this comment.
Hi @esben-semmle - thanks for the quick fixes. I checked the fixes on the preview and noticed a typo and a punctuation minor issue (sorry for not reporting them before) - see inline suggestions for more detail.
javascript/ql/src/Security/CWE-078/ShellCommandInjectionFromEnvironment.qhelp
Outdated
Show resolved
Hide resolved
javascript/ql/src/Security/CWE-078/ShellCommandInjectionFromEnvironment.qhelp
Outdated
Show resolved
Hide resolved
|
Thanks. I have applied the suggestions. |
javascript/ql/src/Security/CWE-078/ShellCommandInjectionFromEnvironment.qhelp
Outdated
Show resolved
Hide resolved
|
This looks good to go; could you squash the fixups? |
|
Done |
|
@mchammer01, could you re-approve this PR? |
|
done 😉 |
Adds a query for command line injections caused by the inclusion of unsanitized values from the execution environment, specifically file and directory names. Depending on the threat model, dynamically obtained path values should be regarded as being potentially malicious, in practice a TP from this query probably just means that a command line execution will fail when the user has spaces in his paths.
Misc. build/test scripts are particularly prone to TPs due to their missing handling of spaces in absolute paths, other results are practically safe as they quote the file names.
Additional sources of absolute paths and environment values that should be sanitized are welcome.
Results are plenty, but none seem worth a vulnerability report, the best result is
exec('rm -rf ' + __dirname + '/screenshots', ..., which may remove too many files if there are spaces in the path of the currently executing file (inspires the qhelp).Standalone performance is unsurprisingly comparable to js/command-line-injection.
I have started a slightly more precise performance evaluationPerformance when evaluated with the two other command-injection queries seems to be in line with a new taint query.