SlideShare a Scribd company logo
Trust No Input
Application Security Fundamentals
by Secure Code Warrior Limited is licensed under CC BY-ND 4.0
The service or application should
not accept input without further
validation. This avoids
performing the next execution
steps with possibly outdated,
malformed, or malicious data.
What could happen?
All kinds of input-based attacks, such as
SQL injection, cross-site scripting, cross-
site request forgery, command execution,
and local file access. Additionally,
improper validation of input coming from
files, databases, or the network can result
in system failure or compromise.
How to implement it?
Limit the user’s liberty when
providing input to the application.
Validate all input before execution by
using a secure validation scheme,
including input coming from files,
other services, or databases.
What’s the concept
about?
An application allows users to
make calculations based on
values in a database. The user
wants to calculate “7*height”.
Because of a mistake, ”height” was
set to -5 in the database. However,
the application expects height and
the result of the calculation to be a
positive number.
The application does not
proceed with the calculation,
but instead shows the user
an error message.
To protect against
unexpected errors, the
application validates the input
before further processing.
Bad database
value
Trust No Input
Understanding the concept
Calculat
e:
7 x
height
7 x -5 = An error occurred.
Application
height = -5
If height <= 0
Then show_error()
Calculate:
7 x height
An application allows users to
make calculations based on
values in a database. The user
wants to calculate “7*height”.
Because of a mistake, ”height” was
set to -5 in the database. However,
the application expects height and
the result of the calculation to be a
positive number.
The result is -45, which
causes an exception
because of the negative sign
and crashes the application.
The application does not check
the value received from the
database before doing the
calculation.
Bad database
value
Trust No Input
What could happen with the concept?
Application
height = -5
Calculate:
7 x height
An application could
potentially be vulnerable to
command injection. A GET
parameter ‘fileToDelete’ is
passed to the system shell.
An attacker crafts a malicious
URL: he appends a shell
command to the parameter
value of a request.
The application matches
the / to the blacklist and
does not execute the
command. Instead the
attacker is presented an
error message.
The application validates the input
before executing the command. It
has a blacklist of characters that
aborts the execution.
OS command
injection
Trust No Input
Understanding the concept
Blacklist: /:*?”<>|
Error: Blacklisted
character!http://site.com/action/delete? fileToDelete=oldFile.txt; rm -
rf /var/www
file = request.getParameter(‘fileToDelete’);
validatedFile = validate(file);
execShellCommand(“rm ”+ validatedFile)
Application Serverhttp://site.com/action/delete? fileToDelete=aFile.txt
This time, the application is
vulnerable to command
injection. The 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.
OS command
injection
Trust No Input
What could happen with the concept?
http://site.com/action/delete? fileToDelete=oldFile.txt; rm -
rf /var/www
Application Serverhttp://site.com/action/delete? fileToDelete=aFile.txt
file =
request.getParameter(‘fileToDelete’);
execShellCommand(“rm ”+ file)
rm –rf /var/www
! NEVER trust user input !
Limit a user’s options when providing input.
Example: drop-down list using an index number instead of full context.
Perform server-side validation using one of the following
schemes:
Exact match
Whitelisting
Blacklisting
If possible, reject invalid data. Otherwise, clean or escape it.
Consider input coming from all types of sources.
Users, files, database, network, external services.
Trust No Input
Typical controls
1
2
3

More Related Content

PDF
Security Testing Mobile Applications
PPTX
PPT on Phishing
PPTX
Cyber crime.pptx
PPTX
Web Security Attacks
PPTX
Cloud with Cyber Security
PPTX
Mobile Application Security
PPSX
Cyber crime and cyber security
PDF
Owasp Top 10 (M-10 : Lack of Binary Protection) | Null Meet
Security Testing Mobile Applications
PPT on Phishing
Cyber crime.pptx
Web Security Attacks
Cloud with Cyber Security
Mobile Application Security
Cyber crime and cyber security
Owasp Top 10 (M-10 : Lack of Binary Protection) | Null Meet

What's hot (20)

PDF
Mobile Application Security
PDF
CHFI v10
PDF
Lior rotkovitch ASM WAF unified learning – building policy with asm v12
PDF
Overview of the Cyber Kill Chain [TM]
PPTX
Dark wed
PDF
Cyber Security Extortion: Defending Against Digital Shakedowns
PDF
Types of Threat Actors and Attack Vectors
PPTX
Cyber crime-140128140443-phpapp02 (1)
PDF
Introduction to Metasploit
PPTX
Android Security
PPTX
The Zero Trust Model of Information Security
PPTX
Cyber crime
PPTX
Cyber crime and security
PDF
Cyber Crime
PPTX
Latest Top 10 Types of Cyber Security Threats
PPTX
Cyber crime
PPTX
Metasploit
PPTX
Cyber Kill Chain.pptx
PDF
BATbern48_How Zero Trust can help your organisation keep safe.pdf
PPTX
Threat Modeling In 2021
Mobile Application Security
CHFI v10
Lior rotkovitch ASM WAF unified learning – building policy with asm v12
Overview of the Cyber Kill Chain [TM]
Dark wed
Cyber Security Extortion: Defending Against Digital Shakedowns
Types of Threat Actors and Attack Vectors
Cyber crime-140128140443-phpapp02 (1)
Introduction to Metasploit
Android Security
The Zero Trust Model of Information Security
Cyber crime
Cyber crime and security
Cyber Crime
Latest Top 10 Types of Cyber Security Threats
Cyber crime
Metasploit
Cyber Kill Chain.pptx
BATbern48_How Zero Trust can help your organisation keep safe.pdf
Threat Modeling In 2021
Ad

Viewers also liked (15)

PPTX
Secure Code Warrior - Cookies and sessions
PPTX
Secure Code Warrior - Local storage
PPTX
Secure Code Warrior - XQuery injection
PPTX
Secure Code Warrior - Robust error checking
PPTX
Secure Code Warrior - Unrestricted file upload
PPTX
Secure Code Warrior - Insufficient data encoding
PPTX
Secure Code Warrior - Client side injection
PPTX
Secure Code Warrior - Least privilege
PPTX
Secure Code Warrior - CRLF injection
PPTX
Secure Code Warrior - Issues with origins
PPTX
Secure Code Warrior - Fail securely
PPTX
Secure Code Warrior - Logging
PPTX
Secure Code Warrior - Secure by default
PPTX
Secure Code Warrior - Privacy
PPTX
Secure Code Warrior - Defense in depth
Secure Code Warrior - Cookies and sessions
Secure Code Warrior - Local storage
Secure Code Warrior - XQuery injection
Secure Code Warrior - Robust error checking
Secure Code Warrior - Unrestricted file upload
Secure Code Warrior - Insufficient data encoding
Secure Code Warrior - Client side injection
Secure Code Warrior - Least privilege
Secure Code Warrior - CRLF injection
Secure Code Warrior - Issues with origins
Secure Code Warrior - Fail securely
Secure Code Warrior - Logging
Secure Code Warrior - Secure by default
Secure Code Warrior - Privacy
Secure Code Warrior - Defense in depth
Ad

Similar to Secure Code Warrior - Trust no input (20)

PDF
Top 10 Web App Security Risks
PPTX
Secure Code Warrior - Os command injection
PDF
Web PenTest Sample Report
PPTX
Web and Mobile Application Security
PPT
Bank One App Sec Training
PPT
Secure code practices
PPTX
Securing the Web @RivieraDev2016
PDF
Web Application Penetration Tests - Vulnerability Identification and Details ...
PPT
Avoiding Application Attacks: A Guide to Preventing the OWASP Top 10 from Hap...
PPTX
Hackers versus Developers and Secure Web Programming
PDF
Developing Web Applications Securely - How to Fix Common Code Vulnerabilities...
PPT
Security 101
PDF
Comptia security+ (sy0-601) exam dumps 2022
PDF
Common Web Application Attacks
PPT
Web 20 Security - Vordel
PPTX
Security Testing Training With Examples
PPT
PPTX
Php security
PPTX
Application security [appsec]
PDF
Lets Make our Web Applications Secure
Top 10 Web App Security Risks
Secure Code Warrior - Os command injection
Web PenTest Sample Report
Web and Mobile Application Security
Bank One App Sec Training
Secure code practices
Securing the Web @RivieraDev2016
Web Application Penetration Tests - Vulnerability Identification and Details ...
Avoiding Application Attacks: A Guide to Preventing the OWASP Top 10 from Hap...
Hackers versus Developers and Secure Web Programming
Developing Web Applications Securely - How to Fix Common Code Vulnerabilities...
Security 101
Comptia security+ (sy0-601) exam dumps 2022
Common Web Application Attacks
Web 20 Security - Vordel
Security Testing Training With Examples
Php security
Application security [appsec]
Lets Make our Web Applications Secure

Recently uploaded (20)

PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Electronic commerce courselecture one. Pdf
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPT
Teaching material agriculture food technology
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Machine learning based COVID-19 study performance prediction
PPTX
Programs and apps: productivity, graphics, security and other tools
PPTX
Big Data Technologies - Introduction.pptx
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Network Security Unit 5.pdf for BCA BBA.
“AI and Expert System Decision Support & Business Intelligence Systems”
NewMind AI Weekly Chronicles - August'25 Week I
Chapter 3 Spatial Domain Image Processing.pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Review of recent advances in non-invasive hemoglobin estimation
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Electronic commerce courselecture one. Pdf
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Unlocking AI with Model Context Protocol (MCP)
Advanced methodologies resolving dimensionality complications for autism neur...
Teaching material agriculture food technology
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
MIND Revenue Release Quarter 2 2025 Press Release
Reach Out and Touch Someone: Haptics and Empathic Computing
Machine learning based COVID-19 study performance prediction
Programs and apps: productivity, graphics, security and other tools
Big Data Technologies - Introduction.pptx
Understanding_Digital_Forensics_Presentation.pptx
Network Security Unit 5.pdf for BCA BBA.

Secure Code Warrior - Trust no input

  • 1. Trust No Input Application Security Fundamentals by Secure Code Warrior Limited is licensed under CC BY-ND 4.0
  • 2. The service or application should not accept input without further validation. This avoids performing the next execution steps with possibly outdated, malformed, or malicious data. What could happen? All kinds of input-based attacks, such as SQL injection, cross-site scripting, cross- site request forgery, command execution, and local file access. Additionally, improper validation of input coming from files, databases, or the network can result in system failure or compromise. How to implement it? Limit the user’s liberty when providing input to the application. Validate all input before execution by using a secure validation scheme, including input coming from files, other services, or databases. What’s the concept about?
  • 3. An application allows users to make calculations based on values in a database. The user wants to calculate “7*height”. Because of a mistake, ”height” was set to -5 in the database. However, the application expects height and the result of the calculation to be a positive number. The application does not proceed with the calculation, but instead shows the user an error message. To protect against unexpected errors, the application validates the input before further processing. Bad database value Trust No Input Understanding the concept Calculat e: 7 x height 7 x -5 = An error occurred. Application height = -5 If height <= 0 Then show_error() Calculate: 7 x height
  • 4. An application allows users to make calculations based on values in a database. The user wants to calculate “7*height”. Because of a mistake, ”height” was set to -5 in the database. However, the application expects height and the result of the calculation to be a positive number. The result is -45, which causes an exception because of the negative sign and crashes the application. The application does not check the value received from the database before doing the calculation. Bad database value Trust No Input What could happen with the concept? Application height = -5 Calculate: 7 x height
  • 5. An application could potentially be vulnerable to command injection. A GET parameter ‘fileToDelete’ is passed to the system shell. An attacker crafts a malicious URL: he appends a shell command to the parameter value of a request. The application matches the / to the blacklist and does not execute the command. Instead the attacker is presented an error message. The application validates the input before executing the command. It has a blacklist of characters that aborts the execution. OS command injection Trust No Input Understanding the concept Blacklist: /:*?”<>| Error: Blacklisted character!http://site.com/action/delete? fileToDelete=oldFile.txt; rm - rf /var/www file = request.getParameter(‘fileToDelete’); validatedFile = validate(file); execShellCommand(“rm ”+ validatedFile) Application Serverhttp://site.com/action/delete? fileToDelete=aFile.txt
  • 6. This time, the application is vulnerable to command injection. The 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. OS command injection Trust No Input What could happen with the concept? http://site.com/action/delete? fileToDelete=oldFile.txt; rm - rf /var/www Application Serverhttp://site.com/action/delete? fileToDelete=aFile.txt file = request.getParameter(‘fileToDelete’); execShellCommand(“rm ”+ file) rm –rf /var/www
  • 7. ! NEVER trust user input ! Limit a user’s options when providing input. Example: drop-down list using an index number instead of full context. Perform server-side validation using one of the following schemes: Exact match Whitelisting Blacklisting If possible, reject invalid data. Otherwise, clean or escape it. Consider input coming from all types of sources. Users, files, database, network, external services. Trust No Input Typical controls 1 2 3