SlideShare a Scribd company logo
SESSION MANAGEMENT
Security Mechanism:
Authentication
Authorization
Session Management
Data Validation
Error Handling
Logging
Encryption
Session Management Core Concepts
A session identifier becomes a “something you have” method of authentication.
Options for passing
data between browser
and web or app server.
Session lifetimes become a critical part of your application security.
The need to track state in a stateless protocol = Session Management
Session Management Words to Live By
 Enforce a reasonable session lifespan
 Leverage existing session management solutions
 Force a change of session ID after a successful login
Session Words to Live By: #1
 The problem
– The lack of proper session expiration may improve the likely
success of certain attacks. For example, an attacker may intercept
a session ID, possibly via a network sniffer or Cross-site Scripting
attack. Although short session expiration times do not help if a
stolen token is immediately used, they will protect against ongoing
replaying of the session ID. In another scenario, a user might
access a web site from a shared computer (such as at a library,
Internet cafe, or open work environment). Insufficient Session
Expiration could allow an attacker to use the browser's back button
to access web pages previously accessed by the victim.
Enforce a reasonable session lifespan
Real World – Session Lifetimes
Secure Coding …
 General rule of thumb
– 30 minute timeout for inactivity
– 12 hour hard time out
 Session management setting are usually part of the
application server configuration
– As developers we need to understand how these options affect our
application and verify that the system admin has configured the
server correctly
Session Words to Live By: #2
– The lack of proper session expiration may improve the likely
success of certain attacks.
Leverage existing session management solutions
It’s easier and generally more secure to use a vetted session management
solution that has already been tested for these types of flaws.
Real World – Session ID Weakness
Just because it looks random…
Timestamp goes up predictably, session count just increments, IP is
static, and the 2 random bytes at the end are fixed at server start time.
Secure Coding …
 As developers …
– We need to recognized when we need session management
– We know not to roll our own
Session Words to Live By: #3
 The problem
– Authenticating a user, or otherwise establishing a new user session,
without invalidating any existing session identifier gives an attacker
the opportunity to steal authenticated sessions.
Force a change of session ID after a successful login
Real World – Session Fixation
Secure Coding …
1 public int authenticate (HttpSession session)
2 {
3 string username = GetInput("Enter Username");
4 string password = GetInput("Enter Password");
5
6 // Check maximum logins attempts
7 if (session.getValue("loginAttempts") > MAX_LOGIN_ATTEMPTS)
8 {
9 lockAccount(username);
10 return(FAILURE);
11 }
12
13 if (ValidUser(username, password) == SUCCESS)
14 {
15 // Kill the current session so it can no longer be used
16 session.invalidate();
17
18 // Create an entirely new session for the logged in user
19 HttpSession newSession = request.getSession(true);
20
21 newSession.putValue("login", TRUE);
22 return(SUCCESS);
23 }
24 else return(FAILURE);
25 }

More Related Content

PPTX
05 application security fundamentals - part 2 - security mechanisms - autho...
PPTX
Secure Code Warrior - Logging
PDF
The hacker playbook: How to think and act like a cybercriminal to reduce risk...
PPT
Security Testing
PPTX
12 Crucial Windows Security Skills for 2018
PDF
30 Cybersecurity Skills You Need To Become a Windows Security Pro
PPTX
Microsoft Ignite session: Explore adventures in the underland: forensic techn...
PPTX
RSA Conference 2017 session: Hacker’s Perspective on Your Windows Infrastruct...
05 application security fundamentals - part 2 - security mechanisms - autho...
Secure Code Warrior - Logging
The hacker playbook: How to think and act like a cybercriminal to reduce risk...
Security Testing
12 Crucial Windows Security Skills for 2018
30 Cybersecurity Skills You Need To Become a Windows Security Pro
Microsoft Ignite session: Explore adventures in the underland: forensic techn...
RSA Conference 2017 session: Hacker’s Perspective on Your Windows Infrastruct...

What's hot (20)

PDF
Web application sec_3
PPTX
Secure Code Warrior - Defense in depth
PPTX
12 Crucial Windows Security Skills for 2017
PDF
Deltecs Services for Vulnerability Assessment and penetration testing
PDF
Avoiding the 10 Deadliest and Most Common Sins for Securing Windows
PDF
Broken access control
PDF
Client /server security overview
PDF
Hacker techniques for bypassing existing antivirus solutions & how to build a...
PPTX
Security Testing for Web Application
PDF
Security-testing presentation
PPTX
Security testing
PPTX
Network security
PDF
Chapter 3 security principals
PPT
Bitrix Software Security
PPTX
Security & Protection in Operating System
PDF
OWASP Top 10 Vulnerabilities - A5-Broken Access Control; A6-Security Misconfi...
PPTX
What's new in​ CEHv11?
PPTX
Next-Gen Security Solution: Gateway Protection
PDF
Security testing presentation
PPTX
Top 10 ways to make hackers excited: All about the shortcuts not worth taking
Web application sec_3
Secure Code Warrior - Defense in depth
12 Crucial Windows Security Skills for 2017
Deltecs Services for Vulnerability Assessment and penetration testing
Avoiding the 10 Deadliest and Most Common Sins for Securing Windows
Broken access control
Client /server security overview
Hacker techniques for bypassing existing antivirus solutions & how to build a...
Security Testing for Web Application
Security-testing presentation
Security testing
Network security
Chapter 3 security principals
Bitrix Software Security
Security & Protection in Operating System
OWASP Top 10 Vulnerabilities - A5-Broken Access Control; A6-Security Misconfi...
What's new in​ CEHv11?
Next-Gen Security Solution: Gateway Protection
Security testing presentation
Top 10 ways to make hackers excited: All about the shortcuts not worth taking
Ad

Viewers also liked (10)

PDF
Web Application Security 101 - 07 Session Management
PPT
Web Application Security
PPTX
Attacking Session Management
PDF
Microsoft Lync & Acme Packet Session Management Solutions
PDF
Secure Authentication and Session Management in Java EE
PPTX
A2 - broken authentication and session management(OWASP thailand chapter Apri...
PPTX
Automated API pentesting using fuzzapi
ODP
Session Management & Cookies In Php
PPTX
Cryptography
PPTX
Cryptography
Web Application Security 101 - 07 Session Management
Web Application Security
Attacking Session Management
Microsoft Lync & Acme Packet Session Management Solutions
Secure Authentication and Session Management in Java EE
A2 - broken authentication and session management(OWASP thailand chapter Apri...
Automated API pentesting using fuzzapi
Session Management & Cookies In Php
Cryptography
Cryptography
Ad

Similar to 06 application security fundamentals - part 2 - security mechanisms - session management (20)

PDF
S8-Session Managment
PDF
Session fixation
PPTX
Uwvwwbwbwbwbwbwbwbnit-4 - web security.pptx
PPTX
Introduccion a la seguridad Windows 7
PDF
Tips to Remediate your Vulnerability Management Program
PPTX
Secure Code Warrior - Authentication
PDF
wapt lab 6 - converted (2).pdfwaptLab09 tis lab is used for college lab exam
PDF
Hitachi ID Password Manager Security Analysis
PDF
Privileged Access Manager Product Q&A
PPTX
Mobile Application Security - Broken Authentication & Management
PPT
OWASP Serbia - A3 broken authentication and session management
PDF
Module 4 (enumeration)
PDF
Tales of modern day data breaches - a web security guide for developers
PPT
Andrews whitakrer lecture18-security.ppt
PDF
PPTX
Magento security best practices magento's approach to pci compliance
PPTX
Session Hijacking: Understanding and Preventing Online Attacks
PDF
AN INNOVATIVE PATTERN BASED PASSWORD METHOD USING TIME VARIABLE WITH ARITHMET...
PPTX
Web security
PDF
Financial Safety and Security in the Cyber World.pdf
S8-Session Managment
Session fixation
Uwvwwbwbwbwbwbwbwbnit-4 - web security.pptx
Introduccion a la seguridad Windows 7
Tips to Remediate your Vulnerability Management Program
Secure Code Warrior - Authentication
wapt lab 6 - converted (2).pdfwaptLab09 tis lab is used for college lab exam
Hitachi ID Password Manager Security Analysis
Privileged Access Manager Product Q&A
Mobile Application Security - Broken Authentication & Management
OWASP Serbia - A3 broken authentication and session management
Module 4 (enumeration)
Tales of modern day data breaches - a web security guide for developers
Andrews whitakrer lecture18-security.ppt
Magento security best practices magento's approach to pci compliance
Session Hijacking: Understanding and Preventing Online Attacks
AN INNOVATIVE PATTERN BASED PASSWORD METHOD USING TIME VARIABLE WITH ARITHMET...
Web security
Financial Safety and Security in the Cyber World.pdf

More from appsec (11)

PPTX
23 owasp top 10 - resources
PPTX
15 owasp top 10 - a3-xss
PPTX
12 owasp top 10 - introduction
PPTX
10 application security fundamentals - part 2 - security mechanisms - encry...
PPTX
11 application security fundamentals - part 2 - security mechanisms - summary
PPTX
09 application security fundamentals - part 2 - security mechanisms - logging
PPTX
08 application security fundamentals - part 2 - security mechanisms - error...
PPTX
07 application security fundamentals - part 2 - security mechanisms - data ...
PPTX
04 application security fundamentals - part 2 - security mechanisms - authe...
PPTX
02 application security fundamentals - part 1 - security priciples
PPTX
01 Application Security Fundamentals - part 1 - introduction and goals
23 owasp top 10 - resources
15 owasp top 10 - a3-xss
12 owasp top 10 - introduction
10 application security fundamentals - part 2 - security mechanisms - encry...
11 application security fundamentals - part 2 - security mechanisms - summary
09 application security fundamentals - part 2 - security mechanisms - logging
08 application security fundamentals - part 2 - security mechanisms - error...
07 application security fundamentals - part 2 - security mechanisms - data ...
04 application security fundamentals - part 2 - security mechanisms - authe...
02 application security fundamentals - part 1 - security priciples
01 Application Security Fundamentals - part 1 - introduction and goals

Recently uploaded (20)

PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Approach and Philosophy of On baking technology
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
Big Data Technologies - Introduction.pptx
PDF
Encapsulation theory and applications.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPT
Teaching material agriculture food technology
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Empathic Computing: Creating Shared Understanding
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
sap open course for s4hana steps from ECC to s4
Reach Out and Touch Someone: Haptics and Empathic Computing
Advanced methodologies resolving dimensionality complications for autism neur...
Approach and Philosophy of On baking technology
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Diabetes mellitus diagnosis method based random forest with bat algorithm
Network Security Unit 5.pdf for BCA BBA.
Review of recent advances in non-invasive hemoglobin estimation
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Big Data Technologies - Introduction.pptx
Encapsulation theory and applications.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
Teaching material agriculture food technology
Understanding_Digital_Forensics_Presentation.pptx
The Rise and Fall of 3GPP – Time for a Sabbatical?
Empathic Computing: Creating Shared Understanding
Dropbox Q2 2025 Financial Results & Investor Presentation
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
sap open course for s4hana steps from ECC to s4

06 application security fundamentals - part 2 - security mechanisms - session management

  • 1. SESSION MANAGEMENT Security Mechanism: Authentication Authorization Session Management Data Validation Error Handling Logging Encryption
  • 2. Session Management Core Concepts A session identifier becomes a “something you have” method of authentication. Options for passing data between browser and web or app server. Session lifetimes become a critical part of your application security. The need to track state in a stateless protocol = Session Management
  • 3. Session Management Words to Live By  Enforce a reasonable session lifespan  Leverage existing session management solutions  Force a change of session ID after a successful login
  • 4. Session Words to Live By: #1  The problem – The lack of proper session expiration may improve the likely success of certain attacks. For example, an attacker may intercept a session ID, possibly via a network sniffer or Cross-site Scripting attack. Although short session expiration times do not help if a stolen token is immediately used, they will protect against ongoing replaying of the session ID. In another scenario, a user might access a web site from a shared computer (such as at a library, Internet cafe, or open work environment). Insufficient Session Expiration could allow an attacker to use the browser's back button to access web pages previously accessed by the victim. Enforce a reasonable session lifespan
  • 5. Real World – Session Lifetimes
  • 6. Secure Coding …  General rule of thumb – 30 minute timeout for inactivity – 12 hour hard time out  Session management setting are usually part of the application server configuration – As developers we need to understand how these options affect our application and verify that the system admin has configured the server correctly
  • 7. Session Words to Live By: #2 – The lack of proper session expiration may improve the likely success of certain attacks. Leverage existing session management solutions It’s easier and generally more secure to use a vetted session management solution that has already been tested for these types of flaws.
  • 8. Real World – Session ID Weakness Just because it looks random… Timestamp goes up predictably, session count just increments, IP is static, and the 2 random bytes at the end are fixed at server start time.
  • 9. Secure Coding …  As developers … – We need to recognized when we need session management – We know not to roll our own
  • 10. Session Words to Live By: #3  The problem – Authenticating a user, or otherwise establishing a new user session, without invalidating any existing session identifier gives an attacker the opportunity to steal authenticated sessions. Force a change of session ID after a successful login
  • 11. Real World – Session Fixation
  • 12. Secure Coding … 1 public int authenticate (HttpSession session) 2 { 3 string username = GetInput("Enter Username"); 4 string password = GetInput("Enter Password"); 5 6 // Check maximum logins attempts 7 if (session.getValue("loginAttempts") > MAX_LOGIN_ATTEMPTS) 8 { 9 lockAccount(username); 10 return(FAILURE); 11 } 12 13 if (ValidUser(username, password) == SUCCESS) 14 { 15 // Kill the current session so it can no longer be used 16 session.invalidate(); 17 18 // Create an entirely new session for the logged in user 19 HttpSession newSession = request.getSession(true); 20 21 newSession.putValue("login", TRUE); 22 return(SUCCESS); 23 } 24 else return(FAILURE); 25 }