Web injection and scripting
Command injection
Running your own operating-system commands by sending input a web app pastes into a shell command line.
Command injection is running your own operating-system commands through input a web app pastes into a shell command line. If the app runs ping -c 1 <host> through a shell, ;, | and && start a second command, so 127.0.0.1; id runs ping and then id, as the server's user, often root. The fix: run the program directly with its arguments as a list, never through a shell.
Read next
- HTTP The web's request and response protocol: plain text over TCP unless wrapped in TLS.
- SQL injection Changing what a database query does by sending input that is pasted into the query as code, not data.
- Unrestricted file upload Letting a user upload any file with no check on its type, so attacker code can be stored on the server.
- Instance metadata & SSRF Every cloud instance reads its role's short-term keys from a link-local metadata service; an app with an SSRF can be made to read them for an attacker.
- Serverless injection A serverless function that folds untrusted input into a template or format string can be driven to reflect its own environment — where its role credentials live.