SlideShare a Scribd company logo
2
Most read
3
Most read
OS Command Injection
OWASP Web App Top 10
by Secure Code Warrior Limited is licensed under CC BY-ND 4.0
What is it?
“OS Command injection” is a
vulnerability that allows arbitrary
commands to be executed on the
operating system of the application.
What causes it?
This vulnerability happens because
user controlled input (form
parameters, cookies, HTTP headers, …)
is being passed to the system shell
without any prior validation.
What could happen?
Injected commands will run with the
privileges of the vulnerable application.
User passwords or other sensitive data
could be displayed on the application
output. Files or database records could
be manipulated or deleted. Services
could be started/stopped.
How to prevent it?
Use framework specific API calls
instead of OS commands. If not
possible, validate all user
supplied data against a white-list
before passing it to the OS.
OS Command Injection
Understanding the security vulnerability
An application vulnerable to
command injection. A GET
parameter ‘fileToDelete’ is
passed to the system shell
without prior validation.
An attacker crafts a malicious
URL: he appends a shell
command to the parameter
value of a request.
All the web application
files are deleted. The
web application
becomes unavailable.
The application appends the
GET parameter to the command
string and the malicious
command is executed.
Application Server
file = request.getParameter(‘fileToDelete’);
execShellCommand(“rm ”+ file)
http://site.com/action/delete? fileToDelete=oldFile.txt; rm -rf /var/www
usr@server$ rm oldFile.txt; rm –rf /
http://site.com/action/delete? fileToDelete=aFile.txt
OS Command Injection
Realizing the impact
Commands executed as the application owner
could lead to repudiation issues.
All the files of your application could be
deleted, denying service and causing
reputation loss and financial damages.
Customer data could get exposed leading to
privacy issues, reputational and financial data.
OS Command Injection
Preventing the mistake
Use framework API functions instead of OS Commands.
Validate all user controlled input against a
white-list before passing it to the shell.
POST & GET parameter, cookies and other HTTP headers.
Apply principle of least privilege to the application

More Related Content

What's hot (20)

PPTX
Cross Site Scripting Defense Presentation
Ikhade Maro Igbape
 
PPTX
Introduction To Exploitation & Metasploit
Raghav Bisht
 
PDF
OWASP Top 10 Vulnerabilities - A5-Broken Access Control; A6-Security Misconfi...
Lenur Dzhemiliev
 
PDF
Privilege escalation from 1 to 0 Workshop
Hossam .M Hamed
 
PPT
Ip Spoofing
arpit.arp
 
PDF
Cross site scripting
n|u - The Open Security Community
 
PPTX
Vulnerabilities in modern web applications
Niyas Nazar
 
PPTX
Web application attacks
hruth
 
PPTX
OWASP Top 10 - Day 1 - A1 injection attacks
Mohamed Talaat
 
PPTX
Introduction to Snort
Hossein Yavari
 
PDF
Sql Injection - Vulnerability and Security
Sandip Chaudhari
 
PPTX
Denial of Service Attacks (DoS/DDoS)
Gaurav Sharma
 
PDF
Broken access controls
Akansha Kesharwani
 
PDF
Footprinting
Duah John
 
PPTX
SSRF exploit the trust relationship
n|u - The Open Security Community
 
PPTX
XXE - XML External Entity Attack
Cysinfo Cyber Security Community
 
PPTX
Directory Traversal & File Inclusion Attacks
Raghav Bisht
 
PPTX
Cross Site Scripting: Prevention and Detection(XSS)
Aman Singh
 
PPTX
SSRF For Bug Bounties
OWASP Nagpur
 
PDF
Broken access control
Priyanshu Gandhi
 
Cross Site Scripting Defense Presentation
Ikhade Maro Igbape
 
Introduction To Exploitation & Metasploit
Raghav Bisht
 
OWASP Top 10 Vulnerabilities - A5-Broken Access Control; A6-Security Misconfi...
Lenur Dzhemiliev
 
Privilege escalation from 1 to 0 Workshop
Hossam .M Hamed
 
Ip Spoofing
arpit.arp
 
Cross site scripting
n|u - The Open Security Community
 
Vulnerabilities in modern web applications
Niyas Nazar
 
Web application attacks
hruth
 
OWASP Top 10 - Day 1 - A1 injection attacks
Mohamed Talaat
 
Introduction to Snort
Hossein Yavari
 
Sql Injection - Vulnerability and Security
Sandip Chaudhari
 
Denial of Service Attacks (DoS/DDoS)
Gaurav Sharma
 
Broken access controls
Akansha Kesharwani
 
Footprinting
Duah John
 
SSRF exploit the trust relationship
n|u - The Open Security Community
 
XXE - XML External Entity Attack
Cysinfo Cyber Security Community
 
Directory Traversal & File Inclusion Attacks
Raghav Bisht
 
Cross Site Scripting: Prevention and Detection(XSS)
Aman Singh
 
SSRF For Bug Bounties
OWASP Nagpur
 
Broken access control
Priyanshu Gandhi
 

Similar to Secure Code Warrior - Os command injection (20)

PPTX
Secure Code Warrior - Trust no input
Secure Code Warrior
 
PDF
Attques web
Tarek MOHAMED
 
PPT
Bh Win 03 Rileybollefer
Timothy Bollefer
 
PPTX
webapplicationattacks-101005070110-phpapp02.pptx
SyedAliShahid3
 
PPTX
Secure Code Warrior - Remote file inclusion
Secure Code Warrior
 
PPT
Online Bank Hack
Caleb Sima
 
PDF
Webappcontrol for Information Technology
tiwariparivaar24
 
PDF
Application security 101
Vlad Garbuz
 
ODP
Web Security
Chatree Kunjai
 
PDF
Top 10 Web App Security Risks
Sperasoft
 
PPS
Manindra kishore _incident_handling_n_log_analysis - ClubHack2009
ClubHack
 
PPTX
QA Lab: тестирование ПО. Владимир Гарбуз: "Application Security 101"
GeeksLab Odessa
 
PPTX
Application security [appsec]
Judy Ngure
 
PPT
Positive Hack Days. Goltsev. Web Vulnerabilities: Difficult Cases
Positive Hack Days
 
PDF
OWASP Portland - OWASP Top 10 For JavaScript Developers
Lewis Ardern
 
PPT
Application Security
nirola
 
PPTX
WEB APPLICATION VULNERABILITIES: DAWN, DETECTION, EXPLOITATION AND DEFENSE
Ajith Kp
 
PPTX
Owasp Top 10 2017
SamsonMuoki
 
PDF
Mobile Application Pentest [Fast-Track]
Prathan Phongthiproek
 
PPT
Web Hacking
Information Technology
 
Secure Code Warrior - Trust no input
Secure Code Warrior
 
Attques web
Tarek MOHAMED
 
Bh Win 03 Rileybollefer
Timothy Bollefer
 
webapplicationattacks-101005070110-phpapp02.pptx
SyedAliShahid3
 
Secure Code Warrior - Remote file inclusion
Secure Code Warrior
 
Online Bank Hack
Caleb Sima
 
Webappcontrol for Information Technology
tiwariparivaar24
 
Application security 101
Vlad Garbuz
 
Web Security
Chatree Kunjai
 
Top 10 Web App Security Risks
Sperasoft
 
Manindra kishore _incident_handling_n_log_analysis - ClubHack2009
ClubHack
 
QA Lab: тестирование ПО. Владимир Гарбуз: "Application Security 101"
GeeksLab Odessa
 
Application security [appsec]
Judy Ngure
 
Positive Hack Days. Goltsev. Web Vulnerabilities: Difficult Cases
Positive Hack Days
 
OWASP Portland - OWASP Top 10 For JavaScript Developers
Lewis Ardern
 
Application Security
nirola
 
WEB APPLICATION VULNERABILITIES: DAWN, DETECTION, EXPLOITATION AND DEFENSE
Ajith Kp
 
Owasp Top 10 2017
SamsonMuoki
 
Mobile Application Pentest [Fast-Track]
Prathan Phongthiproek
 
Ad

Recently uploaded (20)

PDF
July Patch Tuesday
Ivanti
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PDF
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
PDF
Blockchain Transactions Explained For Everyone
CIFDAQ
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PDF
Biography of Daniel Podor.pdf
Daniel Podor
 
PDF
IoT-Powered Industrial Transformation – Smart Manufacturing to Connected Heal...
Rejig Digital
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
July Patch Tuesday
Ivanti
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
Blockchain Transactions Explained For Everyone
CIFDAQ
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
Biography of Daniel Podor.pdf
Daniel Podor
 
IoT-Powered Industrial Transformation – Smart Manufacturing to Connected Heal...
Rejig Digital
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
Ad

Secure Code Warrior - Os command injection

  • 1. OS Command Injection OWASP Web App Top 10 by Secure Code Warrior Limited is licensed under CC BY-ND 4.0
  • 2. What is it? “OS Command injection” is a vulnerability that allows arbitrary commands to be executed on the operating system of the application. What causes it? This vulnerability happens because user controlled input (form parameters, cookies, HTTP headers, …) is being passed to the system shell without any prior validation. What could happen? Injected commands will run with the privileges of the vulnerable application. User passwords or other sensitive data could be displayed on the application output. Files or database records could be manipulated or deleted. Services could be started/stopped. How to prevent it? Use framework specific API calls instead of OS commands. If not possible, validate all user supplied data against a white-list before passing it to the OS.
  • 3. OS Command Injection Understanding the security vulnerability An application vulnerable to command injection. A GET parameter ‘fileToDelete’ is passed to the system shell without prior validation. An attacker crafts a malicious URL: he appends a shell command to the parameter value of a request. All the web application files are deleted. The web application becomes unavailable. The application appends the GET parameter to the command string and the malicious command is executed. Application Server file = request.getParameter(‘fileToDelete’); execShellCommand(“rm ”+ file) http://site.com/action/delete? fileToDelete=oldFile.txt; rm -rf /var/www usr@server$ rm oldFile.txt; rm –rf / http://site.com/action/delete? fileToDelete=aFile.txt
  • 4. OS Command Injection Realizing the impact Commands executed as the application owner could lead to repudiation issues. All the files of your application could be deleted, denying service and causing reputation loss and financial damages. Customer data could get exposed leading to privacy issues, reputational and financial data.
  • 5. OS Command Injection Preventing the mistake Use framework API functions instead of OS Commands. Validate all user controlled input against a white-list before passing it to the shell. POST & GET parameter, cookies and other HTTP headers. Apply principle of least privilege to the application