SlideShare a Scribd company logo
Fail Securely
Application Security Fundamentals
by Secure Code Warrior Limited is licensed under CC BY-ND 4.0
What’s the concept
about?
Fail securely is about how an
application should behave in
case an unexpected situation
occurs. All exceptions should
be handled in a secure way.
What could happen?
Run time errors could interrupt
execution thereby causing failures that
impact the application’s security. A
failure during authentication or
authorization could grant a user
higher privileges than allowed.
How to implement it?
Unless a user explicitly received
permission to a certain part of the
application, he/she should be
denied access. All actions should
have a determined outcome and
exceptions must be handled using
generic error messages.
login(password){
if password correct
redirect to token;
else
redirect to error;
}
tokenRequest(token){
if token correct
user.loggedIn=true;
redirect to profile
else
redirect to error;
}
Fail Securely
Understanding the concept
A user wants to log in to
his web mail that uses 2
factor authentication.
This means the user has
to provide his password
and a valid one time
token to receive access.
As a first step, the user
successfully enters his
password.
In case a correct token is
provided, the user is redirected
to his profile page. In case of a
wrong token, the user is
presented with an error page
and is not logged in.
Next, the user is required to enter
a valid one time token that is sent
to his mobile phone number.
Security control failure
My Web Mail
LOG IN
User: H4x0r
Pass: ***
login failed
Log In
User: JohnDoe
Pass: ********
Log In
User: JohnDoe
Token: ****
Error!
Wrong token
My profile
Welcome, John
Doe!
Correct token
Wrong token
login(password){
if password correct
user.loggedIn=true;
redirect to token;
else
redirect to error;
}
tokenRequest(token){
if token correct
redirect to profile
else
redirect to error;
}
Fail Securely
What could happen with the concept
An attacker was able to
determine another user’s
password and wants to
access that user’s web mail.
The attacker successfully
enters the password and
continues to the next step.
The attacker is redirected to
an error screen. However,
because of a faulty login
failure mechanism, the
attacker can forcefully
browse to the profile page.
The attacker is requested to enter
a one time token, which he does
not possess. The provided token is
wrong.
Security control failure
My Web Mail
LOG IN
User: H4x0r
Pass: ***
login failed
Log In
User: JohnDoe
Pass: ********
Log In
User: JohnDoe
Token: ****
Error!
Wrong token
My Profile
Welcome, John
Doe!
/myprofile
Fail Securely
Understanding the concept
A user wants to browse
his bank’s mobile
application while using
free WiFi.
An attacker has been able
to position himself as a
man-in-the-middle and
intercepts the user’s
communications.
The failure is correctly
handled and the user is
presented with a warning
and cannot continue
using the app.
The application performs SSL pinning
and cannot verify the authenticity of
the server’s certificate.
TLS verification failure
Check certificate
Application
Server
HTTPS
Warning:
Cannot
connect
Fail Securely
What could happen with the concept
A user wants to browse
his bank’s mobile
application while using
free WiFi.
An attacker has been able
to position himself as a
man-in-the-middle and
intercepts the user’s
communications.
The failure is not correctly
handled. The application
continues communication using
HTTP allowing the attacker full
control over the traffic.
The application performs
SSL pinning and cannot
verify the authenticity of
the server’s certificate.
TLS verification failure
Check certificate
Application
ServerHTTPS
HTTP
Fail Securely
Typical controls
Identify areas of failure at design time.
Every block of code should only have three determined
outcomes:
• User is authorized Execute actions
• User is NOT authorized Don’t execute actions
• Exception happens Roll back actions & show
error message
Implement robust error handling.
Use a generic error message in case of an exception.
Make sure the system is in a secure state after failure.
Also review global exception handling behavior.
Secure state
 Rolled back
transactions
 Released resources
 Invalidated session

More Related Content

PDF
Secure Coding and Threat Modeling
PDF
OWASP API Security Top 10 Examples
PPTX
Ethical hacking : Its methodologies and tools
ODP
OWASP Secure Coding
PDF
Web Application Security 101
PPTX
Ethical hacking
PPTX
Secure coding practices
PDF
Web Application Security and Awareness
Secure Coding and Threat Modeling
OWASP API Security Top 10 Examples
Ethical hacking : Its methodologies and tools
OWASP Secure Coding
Web Application Security 101
Ethical hacking
Secure coding practices
Web Application Security and Awareness

What's hot (20)

PPTX
Penetration testing reporting and methodology
PPT
Application Security
PPTX
VAPT - Vulnerability Assessment & Penetration Testing
PPTX
Password Attack
PPTX
PPT on Phishing
PDF
ATTACKers Think in Graphs: Building Graphs for Threat Intelligence
PDF
Ceh v5 module 05 system hacking
PPTX
Social engineering
PPTX
Vulnerability assessment and penetration testing
PPTX
OWASP TOP 10 VULNERABILITIS
PDF
ATT&CK Updates- Defensive ATT&CK
PPTX
The CIA triad.pptx
PPT
Phishing attacks ppt
PPTX
Security testing
PPTX
Social Engineering
PDF
PHDays 2018 Threat Hunting Hands-On Lab
PDF
The importance of Cybersecurity
PPTX
Basic concepts in computer security
PPTX
Web application security
Penetration testing reporting and methodology
Application Security
VAPT - Vulnerability Assessment & Penetration Testing
Password Attack
PPT on Phishing
ATTACKers Think in Graphs: Building Graphs for Threat Intelligence
Ceh v5 module 05 system hacking
Social engineering
Vulnerability assessment and penetration testing
OWASP TOP 10 VULNERABILITIS
ATT&CK Updates- Defensive ATT&CK
The CIA triad.pptx
Phishing attacks ppt
Security testing
Social Engineering
PHDays 2018 Threat Hunting Hands-On Lab
The importance of Cybersecurity
Basic concepts in computer security
Web application security
Ad

Viewers also liked (15)

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

Similar to Secure Code Warrior - Fail securely (20)

PPTX
08 application security fundamentals - part 2 - security mechanisms - error...
PDF
Ch 6: Attacking Authentication
PPT
Web application development_dos_and_donts
PDF
Web security uploadv1
PPTX
Uwvwwbwbwbwbwbwbwbnit-4 - web security.pptx
PDF
Ch 1: Web Application (In)security & Ch 2: Core Defense Mechanisms
PPTX
Security Hole #12 Lviv SoftServe-Symphony Solutions "Lockpicking Authentication"
PPTX
Cm4 secure code_training_1day_error handling and logging
PPTX
Defcon Crypto Village - OPSEC Concerns in Using Crypto
PDF
CNIT 129S: Securing Web Applications Ch 1-2
PDF
CNIT 129S: Ch 6: Attacking Authentication
PPTX
Core defense mechanisms against security attacks on web applications
PPT
Top Ten Proactive Web Security Controls v5
PPTX
OWASP Top 10 Proactive Controls
PDF
Application Security - Your Success Depends on it
PDF
CNIT 129S - Ch 6a: Attacking Authentication
PPT
Survey Presentation About Application Security
PDF
Making Web Development "Secure By Default"
PDF
CNIT 129: 6. Attacking Authentication
PDF
owasp-top-10 presentation dhs ad health .
08 application security fundamentals - part 2 - security mechanisms - error...
Ch 6: Attacking Authentication
Web application development_dos_and_donts
Web security uploadv1
Uwvwwbwbwbwbwbwbwbnit-4 - web security.pptx
Ch 1: Web Application (In)security & Ch 2: Core Defense Mechanisms
Security Hole #12 Lviv SoftServe-Symphony Solutions "Lockpicking Authentication"
Cm4 secure code_training_1day_error handling and logging
Defcon Crypto Village - OPSEC Concerns in Using Crypto
CNIT 129S: Securing Web Applications Ch 1-2
CNIT 129S: Ch 6: Attacking Authentication
Core defense mechanisms against security attacks on web applications
Top Ten Proactive Web Security Controls v5
OWASP Top 10 Proactive Controls
Application Security - Your Success Depends on it
CNIT 129S - Ch 6a: Attacking Authentication
Survey Presentation About Application Security
Making Web Development "Secure By Default"
CNIT 129: 6. Attacking Authentication
owasp-top-10 presentation dhs ad health .

Recently uploaded (20)

PDF
Encapsulation theory and applications.pdf
PDF
cuic standard and advanced reporting.pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
KodekX | Application Modernization Development
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Spectroscopy.pptx food analysis technology
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
Big Data Technologies - Introduction.pptx
PDF
Empathic Computing: Creating Shared Understanding
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
Cloud computing and distributed systems.
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Encapsulation theory and applications.pdf
cuic standard and advanced reporting.pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Network Security Unit 5.pdf for BCA BBA.
KodekX | Application Modernization Development
The Rise and Fall of 3GPP – Time for a Sabbatical?
Spectroscopy.pptx food analysis technology
Review of recent advances in non-invasive hemoglobin estimation
Diabetes mellitus diagnosis method based random forest with bat algorithm
Big Data Technologies - Introduction.pptx
Empathic Computing: Creating Shared Understanding
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Cloud computing and distributed systems.
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Programs and apps: productivity, graphics, security and other tools
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Encapsulation_ Review paper, used for researhc scholars
sap open course for s4hana steps from ECC to s4
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf

Secure Code Warrior - Fail securely

  • 1. Fail Securely Application Security Fundamentals by Secure Code Warrior Limited is licensed under CC BY-ND 4.0
  • 2. What’s the concept about? Fail securely is about how an application should behave in case an unexpected situation occurs. All exceptions should be handled in a secure way. What could happen? Run time errors could interrupt execution thereby causing failures that impact the application’s security. A failure during authentication or authorization could grant a user higher privileges than allowed. How to implement it? Unless a user explicitly received permission to a certain part of the application, he/she should be denied access. All actions should have a determined outcome and exceptions must be handled using generic error messages.
  • 3. login(password){ if password correct redirect to token; else redirect to error; } tokenRequest(token){ if token correct user.loggedIn=true; redirect to profile else redirect to error; } Fail Securely Understanding the concept A user wants to log in to his web mail that uses 2 factor authentication. This means the user has to provide his password and a valid one time token to receive access. As a first step, the user successfully enters his password. In case a correct token is provided, the user is redirected to his profile page. In case of a wrong token, the user is presented with an error page and is not logged in. Next, the user is required to enter a valid one time token that is sent to his mobile phone number. Security control failure My Web Mail LOG IN User: H4x0r Pass: *** login failed Log In User: JohnDoe Pass: ******** Log In User: JohnDoe Token: **** Error! Wrong token My profile Welcome, John Doe! Correct token Wrong token
  • 4. login(password){ if password correct user.loggedIn=true; redirect to token; else redirect to error; } tokenRequest(token){ if token correct redirect to profile else redirect to error; } Fail Securely What could happen with the concept An attacker was able to determine another user’s password and wants to access that user’s web mail. The attacker successfully enters the password and continues to the next step. The attacker is redirected to an error screen. However, because of a faulty login failure mechanism, the attacker can forcefully browse to the profile page. The attacker is requested to enter a one time token, which he does not possess. The provided token is wrong. Security control failure My Web Mail LOG IN User: H4x0r Pass: *** login failed Log In User: JohnDoe Pass: ******** Log In User: JohnDoe Token: **** Error! Wrong token My Profile Welcome, John Doe! /myprofile
  • 5. Fail Securely Understanding the concept A user wants to browse his bank’s mobile application while using free WiFi. An attacker has been able to position himself as a man-in-the-middle and intercepts the user’s communications. The failure is correctly handled and the user is presented with a warning and cannot continue using the app. The application performs SSL pinning and cannot verify the authenticity of the server’s certificate. TLS verification failure Check certificate Application Server HTTPS Warning: Cannot connect
  • 6. Fail Securely What could happen with the concept A user wants to browse his bank’s mobile application while using free WiFi. An attacker has been able to position himself as a man-in-the-middle and intercepts the user’s communications. The failure is not correctly handled. The application continues communication using HTTP allowing the attacker full control over the traffic. The application performs SSL pinning and cannot verify the authenticity of the server’s certificate. TLS verification failure Check certificate Application ServerHTTPS HTTP
  • 7. Fail Securely Typical controls Identify areas of failure at design time. Every block of code should only have three determined outcomes: • User is authorized Execute actions • User is NOT authorized Don’t execute actions • Exception happens Roll back actions & show error message Implement robust error handling. Use a generic error message in case of an exception. Make sure the system is in a secure state after failure. Also review global exception handling behavior. Secure state  Rolled back transactions  Released resources  Invalidated session