🌐
Semgrep
semgrep.dev › write rules › secure coding › javascript › command injection in javascript
Command Injection in JavaScript | Semgrep
const {exec} = require('child_process') const userInput = "$(dangerous command)" // Value supplied by user input // Vulnerable exec(`cat *.js ${userInput}`, (error, stdout, stderr) => { console.log(stdout) }) ... Always try to use internal ...
🌐
Amazon S3
0xn3va.gitbook.io › cheat-sheets › web-application › command-injection
Command Injection | Application Security Cheat Sheet - GitBook
# you can inject arbitrary parameters to <injection here> part $ command --user username --token SECRET_TOKEN <injection here> # send the vulnerable command to background with & # and catch the parameters with ps x -w $ command --user username ...
Discussions

Injection Attacks 101: SQL Injection, Code Injection, and XSS
there are countless hours of tutorials, documentation, examples, practical excercises on any search engine for all of these topics. how is this one different? More on reddit.com
🌐 r/programming
20
70
October 16, 2024
5 ways to prevent code injection in JavaScript and Node.js, an article I wrote on the Snyk blog
That setTimeout/setInterval bit is interesting, I have never considered passing a string into one... it's usually always running some function defined inside. Not sure of the likelihood of this happening. That is a good tip about scanning packages (seems obvious) just something that was handled for me/by platform. Static analysis is nice just another process to add to the pipeline More on reddit.com
🌐 r/javascript
6
89
June 22, 2022
Javascript Injection into a form
That could be very bad. What kind of site was it? A web store, blog,etc... More on reddit.com
🌐 r/hacking
7
3
January 11, 2019
ELI5: How does code injection work? How can something be ran by user input, can't you just avoid letting user input run code?
It can only happen from user input, and you should never need to run it, but in the some cases, like SQL injection, one error in the dev's code can make an entire site vulnerable. Have a look at this Computerphile video. More on reddit.com
🌐 r/explainlikeimfive
13
0
February 3, 2015
🌐
Semgrep
docs.semgrep.dev › cheat-sheets › javascript-command-injection
Prevent Command Injection for JavaScript - Semgrep
Avoid non-literal values for the command string. Strip everything except alphanumeric characters from an input provided for the command string and arguments. javascript.lang.security.detect-child-process.detect-child-process
🌐
Abricto Security
abrictosecurity.com › home › web application injection cheat sheet
Web Application Injection Cheat sheet - Abricto Security
October 25, 2022 - There are many types of web application injection attacks, such as Cross Site Scripting (XSS), SQL Injection, OS Command Injection, and others. Cross Site Scripting is an injection attack by inserting JavaScript code into a vulnerable application either through a text box, parameter value, URL, cookie value, or other variables that can be controlled by the attacker.
🌐
Gitbooks
ckarande.gitbooks.io › owasp-nodegoat-tutorial › content › tutorial › a1_-_server_side_js_injection.html
Server Side JS Injection | OWASP NodeGoat Tutorial
//Fix for A1 -1 SSJS Injection attacks - uses alternate method to eval var preTax = parseInt(req.body.preTax); var afterTax = parseInt(req.body.afterTax); var roth = parseInt(req.body.roth); In addition, all functions begin with use strictpragma. “ServerSide JavaScript Injection: Attacking ...
🌐
StackHawk
stackhawk.com › stackhawk, inc. › vulnerabilities and remediation › nodejs command injection guide: examples and prevention
NodeJS Command Injection Guide: Examples and Prevention
January 10, 2025 - The goal of a command injection attack is to manipulate a legitimate command so that the attacker can run arbitrary commands against the operating system. This input can come from any user-modifiable source, such as forms, cookies, HTTP headers, and so on. ... code injection attack .
🌐
Cobalt
cobalt.io › blog › a-pentesters-guide-to-command-injection
A Pentester’s Guide to Command Injection | Cobalt
November 21, 2025 - Perform proper input validation when taking user input into a shell execution command. Use a safe API when accepting user input into the application. Escape special characters in the case where a safe API is not available.
🌐
HackTricks
book.hacktricks.xyz › home › pentesting web › command injection
Command Injection - HackTricks
6 days ago - #Both Unix and Windows supported ls||id; ls ||id; ls|| id; ls || id # Execute both ls|id; ls |id; ls| id; ls | id # Execute both (using a pipe) ls&&id; ls &&id; ls&& id; ls && id # Execute 2º if 1º finish ok ls&id; ls &id; ls& id; ls & id # Execute both but you can only see the output of the 2º ls id # Execute both (RECOMMENDED) ls bash -c "id" # (Combining new lines and tabs) #Only unix supported `ls` # `` $(ls) # $() ls; id # ; Chain commands ls${LS_COLORS:10:1}${IFS}id # Might be useful #Not executed but may be interesting > /var/www/html/out.txt #Try to redirect the output to a file < /
Find elsewhere
🌐
Hackers Online Club
hackersonlineclub.com › home › command injection cheatsheet
Command Injection Cheatsheet
June 14, 2023 - This attack differs from Code ... In Command Injection, the attacker extends the default functionality of the application, which execute system commands, without the necessity of injecting code....
🌐
Amazon S3
0xn3va.gitbook.io › cheat-sheets › web-application › html-injection
HTML Injection | Application Security Cheat Sheet - GitBook
Application Security Cheat Sheet · ⌘Ctrlk · Android Application · Overview · Intent Vulnerabilities · WebView Vulnerabilities · CI/CD · Dependency
🌐
OWASP Cheat Sheet Series
cheatsheetseries.owasp.org › cheatsheets › OS_Command_Injection_Defense_Cheat_Sheet.html
OS Command Injection Defense - OWASP Cheat Sheet Series
Command injection (or OS Command Injection) is a type of injection where software that constructs a system command using externally influenced input does not correctly neutralize the input from special elements that can modify the initially intended command.
🌐
Scribd
scribd.com › document › 736026794 › Command-Injections-Module-Cheat-Sheet
Command Injection Cheat Sheet | PDF | Computer Science | Software
Command Injections Module Cheat Sheet - Free download as PDF File (.pdf), Text File (.txt) or read online for free.
🌐
Security Journey
securityjourney.com › post › owasp-top-10-mini-series-command-injection
OWASP Top 10 Mini Series - Command Injection Cheat Sheet
September 16, 2024 - OWASP Top 10 Mini Series - Command Injection Cheat Sheet · Published on December 27, 2019 · Command injection is similar to SQL injection, but instead of injecting into a SQL query, you are injecting a command into the Operating System.
🌐
Nodejs-security
nodejs-security.com › blog › introduction-command-injection-vulnerabilities-nodejs-javascript
An Introduction to Command Injection Vulnerabilities in Node.js and JavaScript
June 23, 2023 - In the case of Node.js and JavaScript, this vulnerability can arise when user-supplied input is directly concatenated into a command executed by the underlying operating system, hence it is a form of injection.
🌐
Gosecure
gosecure.github.io › security-cheat-sheet
Security Cheat Sheet
Generate a cheat sheet specific for the technologies your development team used. .NET: Manual XML construction Razor (.cshtml/.vbhtml) Web Forms (.aspx) HTML Sanitization SQL - ADO.net SQL - LINQ OS Command LDAP Queries XPath XPath - MvpXml XML parsing (XXE) Java: Coming soon Javascript: Angular Ember.js DOMPurify PHP: Coming soon Python: Coming soon
🌐
Snyk Learn
learn.snyk.io › home › security education › what is code injection? | tutorial & examples
What is code injection? | Tutorial & examples | Snyk Learn
October 28, 2025 - We're able to inject an additional command in order to get a peak at the file system. Imagine we're presented with a prompt to change the name of an image. In the input, instead of naming your image something benign like “my dog” try injecting some JavaScript.
🌐
OWASP Foundation
owasp.org › www-community › attacks › Command_Injection
Command Injection | OWASP Foundation
This attack differs from Code ... In Command Injection, the attacker extends the default functionality of the application, which execute system commands, without the necessity of injecting code....
🌐
Gitbook
gabb4r.gitbook.io › oscp-notes › cheatsheet › command-injection-cheatsheet
Command injection Cheatsheet | OSCP Notes
September 29, 2021 - ; ls -laR /etc & ls -laR /etc && ls -laR /etc | ls -laR /var/www ; ls -laR /var/www & ls -laR /var/www && ls -laR /var/www | ls -l /etc/ ; ls -l /etc/ & ls -l /etc/ && ls -l /etc/ ls -l /etc/ ls -lh /etc/ | ls -l /home/* ; ls -l /home/* & ls ...