SlideShare a Scribd company logo
Web Application Security (PHP)
Zakieh Alizadeh
zakiehalizadeh@gmail.com
APA Laboratory – Ferdowsi University of Mashhad
Session 4
Authentication
Authentication
 Scenarios :
 Providing An Appropriate Authentication for CollegeAuthentication Library Website
Table of Content
 Common Web Authentication Threats
 Common Weak Web Authentication Strategies
 Strategies For Strong Authentication
Authentication
Common Web Authentication Threats
Common Weak Web Authentication Strategies
Strategies For Strong Authentication
Authentication
Defenition
 Authentication and authorization are required for a Web page that should be
limited to certain users.
 Authentication is the process of determining whether someone or something
is, in fact, who or what it is declared to be.
o the ownership factors: ID card,phone
o the knowledge factors: password, personal identification number (PIN)
o the inherence factors: Something the user is or does (e.g., fingerprint,
DNA
Authentication
Forms based authentication
 Forms based authentication provides the web application designer the
most control over theuser interface, and thus it is widely used.
 Forms based authentication suffers from:
o Clear text credentials
o Weak password controls
o Man in the middle attacks
Authentication
 Threat Categorization
STRIDE ::adversarial perspectiev
Spoofing Tampering Repudition Information
disclosure
Elevation of
privilage
Denial
of service
ASF :: defensive perspective
Data
Protection in
Storage and
Transit
Exception
Management
Data
Validation
Configuration
Management
Authorization Authentication Auditing &
Logging
Authentication
Attacker Testing Autentication
Threats Desc
Testing for Credentials
transport over an
encrypted channel
 using secure protocols that protect them from an attacker or not
Testing for user
enumeration
there are default user accounts
Testing for bypassing
authentication schema
 by recognizing that not all of the application‘s resources are
adequately protected.
(-Session ID Prediction—sql injection )
Authentication
Attacker Testing Autentication
Threats Desc
Testing for vulnerable
Remember Password &
pwd reset
 best security is achieved if the password reset is done via an email
how the application manages those process shows you the password
Testing for CAPTCHA  questions have a very limited set of possible answers
Testing for LOGOUT &
Browser Cache
Management
 logout button is present and well visible
 destroys all session token, or at least renders them unusable
 A timeout is enforced and it is properly checked by the server
Authentication
Weak Authentication Functionality
 Failure to drop privileges when reasonable
 Weak Passwords and password functionality
 Using referer field for authentication or authorization
 Using single-factor authentication in important systems
 Transactions to be replayed or authorization tokens to be reused
Authentication
UserName Management Vulnerability
 Predictable Usernames : attackers can perform a denial of service
o Firstname.Lastname
o Any monotonically increasing number
o E-mail address (unless the users are random enough)
o Semi-public data, such as employee number, or simila
 Don’t validate for HTML, SQL and LDAP Injection
Authentication
Password Management Vulnerability
 Weak Passwords
 Empty String Password
 Allowing password aging
 Not allowing password aging
 Weak Password Storage Strategies
 Allows previous passwords to be chosen
 Weak Cryptography-- Reversible password encryption
Authentication
 Weak Passwords and password functionality
 Passwords should be complex in composition
 checks should be done on the backend/server side of the application
 Simply checking that a password is not NULL is not sufficient:
 Tip : operator == casts between two different types if they are different, while the === operator
performs a 'typesafe comparison'.
$pass=$_GET[‘pass’]
If($pass===null)
// echo error
1 === 1: true
1 == 1: true
1 === "1": false // 1 is an integer, "1" is a string
1 == "1": true // "1" gets casted to an integer, which is
Authentication
Good Passwords
Rules Reg ExP
at least: 1 Uppercase character (A-Z) ^[a-z]$
at least: 1 Lowercase character (a-z) ^[A-Z]$
at least: 1 digit (0-9) ^[0-9]$
at least one special character (!"£$%&...) [!"£$%^&*()]
a defined minimum length (8 chars) ^[a-z]{3,5}$
a defined maximum length (as with all external input) ^[a-z]{3,5}$
no contiguous characters (123abcd)
not more than 2 identical characters in a row (1111) ^(([a-z0-9])2?(?!2))+$
Authentication
Weak Password Storage Strategies
 Passwords should be stored using a one-way hash algorithm.
 Once passwords are persisted, there is not reason why they should be
human-readable. The
 Storing a hash of a password, which can not be reversed, makes it more
difficult to recover the plain text passwords.
 ensures that administration staff for an application does not have access
to other users’ passwords.
Authentication
Weak Password Storage Strategies
 Salting:
o A salt is a random number of a fixed length.
o Storing simply hashed passwords has its issues
o stored as clear text next to the hashed password:
Authentication
 Code Reviw For Vulnerabilities Related To Autentication
Threats Desc
SQL Injection  bypass authentication functionality
 add a malicious user to a system for future use.
Data Validation  This also goes for authentication fields.
XSS issues  to perform identity, Phishing, and session hijacking attacks
Error Handling  Insight into valid and invalid user IDs
 Giving insight into the database structure
Hashing  Weak hash algorithms such as MD5
Brute Force/Dictionary Attack Determined brute force attacks cannot easily be defeated
Authentication
Best Practices :
 Passwords are trivially broken and are unsuitable for high value systems.
 Re-authenticate the user for high value transactions and access to protected areas
 Authentication is only as strong as your user management processes
o non-repudiation, the more expensive the process.
Authentication
 Passwords Best Practices :
 Train your users as to suitable password construction
 Encourage users to use pass phrases instead of passwords
 Allow your users to write down their passwords as long as they keep them safe
 passwords between 8 and 16 that cannot be easily cracked(expiry no less than 30 days
 pass phrases above 16 characters probably do not need a hard expiry limit, but a
gentle reminder after (say) 90 days instead.
Authentication
 Change passwords :
 Ensure your application has a change password function.
 Use AUTOCOMPLETE=off to prevent browsers from caching the password locally
 The form must include the old password, the new password and a confirmation of the
new password
 If the user gets the old password wrong too many times, lock the account and kill the
session
Authentication
Brute Force
 Applications should be robust in the face of determined automated brute
force and dictionary attack, such as from Brutus or custom scripts.
Determined brute force attacks cannot easily be defeated, only delayed.
 If the application allows more than five attempts from a single IP address,
or a collection rate in excess of 10 requests a second, it’s likely that the
application will fall to determined brute force attack.
Authentication
 Brute Force Countermeasure
 logs failed authentication attempts
 A delay of three seconds can make automated brute force attacks almost infeasible.
 Error message that does not disclose which part of the application credentials are
incorrect.
 for applications requiring stronger controls, blocking access from abusive IP addresses
(accessing more than three accounts from the same IP address, or attempting to lock
outmore than one account)
Authentication
Browser remembers passwords
 Modern browsers offer users the ability to manage their multitude of
credentials by storing them insecurely on their computer.
 In the rendered HTTP, send the following in any sensitive input fields,
such as usernames,passwords, password re-validation, credit card and
CCV fields, and so on:
<form … AUTOCOMPLETE="off"> - for all form fields
<input … AUTOCOMPLETE="off"> - for just one field
Authentication

More Related Content

PDF
Session3 data-validation-sql injection
PDF
S5-Authorization
PDF
S8-Session Managment
PDF
Session2-Application Threat Modeling
PDF
Session10-PHP Misconfiguration
PDF
Session7-XSS & CSRF
PPT
Application Security Part 1 Threat Defense In Client Server Applications ...
PDF
Session9-File Upload Security
Session3 data-validation-sql injection
S5-Authorization
S8-Session Managment
Session2-Application Threat Modeling
Session10-PHP Misconfiguration
Session7-XSS & CSRF
Application Security Part 1 Threat Defense In Client Server Applications ...
Session9-File Upload Security

What's hot (20)

PDF
OWASP Secure Coding Practices - Quick Reference Guide
PPTX
Web application security
PPTX
Owasp web security
PPT
Owasp Top 10 And Security Flaw Root Causes
ODP
Top 10 Web Security Vulnerabilities
PPSX
Session3 data-validation
PPT
Introduction to Web Application Penetration Testing
PPT
Intro to Web Application Security
PPTX
A7 Missing Function Level Access Control
PDF
Common Web Application Attacks
PPTX
Owasp first5 presentation
PPT
Secure code practices
PPT
Owasp Top 10 - Owasp Pune Chapter - January 2008
PDF
Security Awareness
DOC
Attackers Vs Programmers
PPTX
OWASP Top 10 Proactive Controls
PPTX
Web application attacks
PDF
2013 OWASP Top 10
PPT
Top 10 Web Security Vulnerabilities (OWASP Top 10)
OWASP Secure Coding Practices - Quick Reference Guide
Web application security
Owasp web security
Owasp Top 10 And Security Flaw Root Causes
Top 10 Web Security Vulnerabilities
Session3 data-validation
Introduction to Web Application Penetration Testing
Intro to Web Application Security
A7 Missing Function Level Access Control
Common Web Application Attacks
Owasp first5 presentation
Secure code practices
Owasp Top 10 - Owasp Pune Chapter - January 2008
Security Awareness
Attackers Vs Programmers
OWASP Top 10 Proactive Controls
Web application attacks
2013 OWASP Top 10
Top 10 Web Security Vulnerabilities (OWASP Top 10)
Ad

Similar to Session4-Authentication (20)

PDF
CNIT 129S - Ch 6a: Attacking Authentication
PDF
CNIT 129S: Ch 6: Attacking Authentication
PDF
CNIT 129S: Securing Web Applications Ch 1-2
PDF
Ch 6: Attacking Authentication
PDF
Ch 1: Web Application (In)security & Ch 2: Core Defense Mechanisms
PDF
Ch 1: Web Application (In)security & Ch 2: Core Defense Mechanisms
PPTX
Web security for app developers
PPTX
Defending web applications v.1.0
PPTX
Core defense mechanisms against security attacks on web applications
PDF
OWASPTop 10
PDF
Web security and OWASP
ODP
OWASP Secure Coding
PPTX
Authentication and session v4
PPT
Web Application Security - "In theory and practice"
PPT
Defcon9 Presentation2001
PPTX
Secure coding - Balgan - Tiago Henriques
PDF
wapt lab 6 - converted (2).pdfwaptLab09 tis lab is used for college lab exam
PPT
performing security testing of web applications.web-and- -hacking.ppt
PDF
A security note for web developers
PPTX
Owasp security testing methodlogies –part2
CNIT 129S - Ch 6a: Attacking Authentication
CNIT 129S: Ch 6: Attacking Authentication
CNIT 129S: Securing Web Applications Ch 1-2
Ch 6: Attacking Authentication
Ch 1: Web Application (In)security & Ch 2: Core Defense Mechanisms
Ch 1: Web Application (In)security & Ch 2: Core Defense Mechanisms
Web security for app developers
Defending web applications v.1.0
Core defense mechanisms against security attacks on web applications
OWASPTop 10
Web security and OWASP
OWASP Secure Coding
Authentication and session v4
Web Application Security - "In theory and practice"
Defcon9 Presentation2001
Secure coding - Balgan - Tiago Henriques
wapt lab 6 - converted (2).pdfwaptLab09 tis lab is used for college lab exam
performing security testing of web applications.web-and- -hacking.ppt
A security note for web developers
Owasp security testing methodlogies –part2
Ad

More from zakieh alizadeh (7)

PDF
Session11-NoSQL InjectionPHP Injection
PDF
Session6-Protecct Sensetive Data
PDF
Session1-Introduce Http-HTTP Security headers
PDF
yii framework
PDF
Web security Contents
PDF
Validating and Sanitizing User Data
PDF
Introduce Yii
Session11-NoSQL InjectionPHP Injection
Session6-Protecct Sensetive Data
Session1-Introduce Http-HTTP Security headers
yii framework
Web security Contents
Validating and Sanitizing User Data
Introduce Yii

Recently uploaded (20)

PDF
How to Ensure Data Integrity During Shopify Migration_ Best Practices for Sec...
PDF
Paper PDF World Game (s) Great Redesign.pdf
PPTX
Introuction about ICD -10 and ICD-11 PPT.pptx
PDF
RPKI Status Update, presented by Makito Lay at IDNOG 10
PDF
Decoding a Decade: 10 Years of Applied CTI Discipline
PDF
💰 𝐔𝐊𝐓𝐈 𝐊𝐄𝐌𝐄𝐍𝐀𝐍𝐆𝐀𝐍 𝐊𝐈𝐏𝐄𝐑𝟒𝐃 𝐇𝐀𝐑𝐈 𝐈𝐍𝐈 𝟐𝟎𝟐𝟓 💰
PPTX
Introduction to Information and Communication Technology
PDF
Best Practices for Testing and Debugging Shopify Third-Party API Integrations...
PPTX
Job_Card_System_Styled_lorem_ipsum_.pptx
PDF
Sims 4 Historia para lo sims 4 para jugar
PDF
WebRTC in SignalWire - troubleshooting media negotiation
PDF
Introduction to the IoT system, how the IoT system works
PPTX
E -tech empowerment technologies PowerPoint
PDF
SASE Traffic Flow - ZTNA Connector-1.pdf
PDF
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
PPTX
Power Point - Lesson 3_2.pptx grad school presentation
PDF
FINAL CALL-6th International Conference on Networks & IOT (NeTIOT 2025)
PPTX
Introduction about ICD -10 and ICD11 on 5.8.25.pptx
PPTX
522797556-Unit-2-Temperature-measurement-1-1.pptx
PPTX
Digital Literacy And Online Safety on internet
How to Ensure Data Integrity During Shopify Migration_ Best Practices for Sec...
Paper PDF World Game (s) Great Redesign.pdf
Introuction about ICD -10 and ICD-11 PPT.pptx
RPKI Status Update, presented by Makito Lay at IDNOG 10
Decoding a Decade: 10 Years of Applied CTI Discipline
💰 𝐔𝐊𝐓𝐈 𝐊𝐄𝐌𝐄𝐍𝐀𝐍𝐆𝐀𝐍 𝐊𝐈𝐏𝐄𝐑𝟒𝐃 𝐇𝐀𝐑𝐈 𝐈𝐍𝐈 𝟐𝟎𝟐𝟓 💰
Introduction to Information and Communication Technology
Best Practices for Testing and Debugging Shopify Third-Party API Integrations...
Job_Card_System_Styled_lorem_ipsum_.pptx
Sims 4 Historia para lo sims 4 para jugar
WebRTC in SignalWire - troubleshooting media negotiation
Introduction to the IoT system, how the IoT system works
E -tech empowerment technologies PowerPoint
SASE Traffic Flow - ZTNA Connector-1.pdf
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
Power Point - Lesson 3_2.pptx grad school presentation
FINAL CALL-6th International Conference on Networks & IOT (NeTIOT 2025)
Introduction about ICD -10 and ICD11 on 5.8.25.pptx
522797556-Unit-2-Temperature-measurement-1-1.pptx
Digital Literacy And Online Safety on internet

Session4-Authentication

  • 1. Web Application Security (PHP) Zakieh Alizadeh zakiehalizadeh@gmail.com APA Laboratory – Ferdowsi University of Mashhad
  • 3. Authentication  Scenarios :  Providing An Appropriate Authentication for CollegeAuthentication Library Website Table of Content  Common Web Authentication Threats  Common Weak Web Authentication Strategies  Strategies For Strong Authentication
  • 4. Authentication Common Web Authentication Threats Common Weak Web Authentication Strategies Strategies For Strong Authentication
  • 5. Authentication Defenition  Authentication and authorization are required for a Web page that should be limited to certain users.  Authentication is the process of determining whether someone or something is, in fact, who or what it is declared to be. o the ownership factors: ID card,phone o the knowledge factors: password, personal identification number (PIN) o the inherence factors: Something the user is or does (e.g., fingerprint, DNA
  • 6. Authentication Forms based authentication  Forms based authentication provides the web application designer the most control over theuser interface, and thus it is widely used.  Forms based authentication suffers from: o Clear text credentials o Weak password controls o Man in the middle attacks
  • 7. Authentication  Threat Categorization STRIDE ::adversarial perspectiev Spoofing Tampering Repudition Information disclosure Elevation of privilage Denial of service ASF :: defensive perspective Data Protection in Storage and Transit Exception Management Data Validation Configuration Management Authorization Authentication Auditing & Logging
  • 8. Authentication Attacker Testing Autentication Threats Desc Testing for Credentials transport over an encrypted channel  using secure protocols that protect them from an attacker or not Testing for user enumeration there are default user accounts Testing for bypassing authentication schema  by recognizing that not all of the application‘s resources are adequately protected. (-Session ID Prediction—sql injection )
  • 9. Authentication Attacker Testing Autentication Threats Desc Testing for vulnerable Remember Password & pwd reset  best security is achieved if the password reset is done via an email how the application manages those process shows you the password Testing for CAPTCHA  questions have a very limited set of possible answers Testing for LOGOUT & Browser Cache Management  logout button is present and well visible  destroys all session token, or at least renders them unusable  A timeout is enforced and it is properly checked by the server
  • 10. Authentication Weak Authentication Functionality  Failure to drop privileges when reasonable  Weak Passwords and password functionality  Using referer field for authentication or authorization  Using single-factor authentication in important systems  Transactions to be replayed or authorization tokens to be reused
  • 11. Authentication UserName Management Vulnerability  Predictable Usernames : attackers can perform a denial of service o Firstname.Lastname o Any monotonically increasing number o E-mail address (unless the users are random enough) o Semi-public data, such as employee number, or simila  Don’t validate for HTML, SQL and LDAP Injection
  • 12. Authentication Password Management Vulnerability  Weak Passwords  Empty String Password  Allowing password aging  Not allowing password aging  Weak Password Storage Strategies  Allows previous passwords to be chosen  Weak Cryptography-- Reversible password encryption
  • 13. Authentication  Weak Passwords and password functionality  Passwords should be complex in composition  checks should be done on the backend/server side of the application  Simply checking that a password is not NULL is not sufficient:  Tip : operator == casts between two different types if they are different, while the === operator performs a 'typesafe comparison'. $pass=$_GET[‘pass’] If($pass===null) // echo error 1 === 1: true 1 == 1: true 1 === "1": false // 1 is an integer, "1" is a string 1 == "1": true // "1" gets casted to an integer, which is
  • 14. Authentication Good Passwords Rules Reg ExP at least: 1 Uppercase character (A-Z) ^[a-z]$ at least: 1 Lowercase character (a-z) ^[A-Z]$ at least: 1 digit (0-9) ^[0-9]$ at least one special character (!"£$%&...) [!"£$%^&*()] a defined minimum length (8 chars) ^[a-z]{3,5}$ a defined maximum length (as with all external input) ^[a-z]{3,5}$ no contiguous characters (123abcd) not more than 2 identical characters in a row (1111) ^(([a-z0-9])2?(?!2))+$
  • 15. Authentication Weak Password Storage Strategies  Passwords should be stored using a one-way hash algorithm.  Once passwords are persisted, there is not reason why they should be human-readable. The  Storing a hash of a password, which can not be reversed, makes it more difficult to recover the plain text passwords.  ensures that administration staff for an application does not have access to other users’ passwords.
  • 16. Authentication Weak Password Storage Strategies  Salting: o A salt is a random number of a fixed length. o Storing simply hashed passwords has its issues o stored as clear text next to the hashed password:
  • 17. Authentication  Code Reviw For Vulnerabilities Related To Autentication Threats Desc SQL Injection  bypass authentication functionality  add a malicious user to a system for future use. Data Validation  This also goes for authentication fields. XSS issues  to perform identity, Phishing, and session hijacking attacks Error Handling  Insight into valid and invalid user IDs  Giving insight into the database structure Hashing  Weak hash algorithms such as MD5 Brute Force/Dictionary Attack Determined brute force attacks cannot easily be defeated
  • 18. Authentication Best Practices :  Passwords are trivially broken and are unsuitable for high value systems.  Re-authenticate the user for high value transactions and access to protected areas  Authentication is only as strong as your user management processes o non-repudiation, the more expensive the process.
  • 19. Authentication  Passwords Best Practices :  Train your users as to suitable password construction  Encourage users to use pass phrases instead of passwords  Allow your users to write down their passwords as long as they keep them safe  passwords between 8 and 16 that cannot be easily cracked(expiry no less than 30 days  pass phrases above 16 characters probably do not need a hard expiry limit, but a gentle reminder after (say) 90 days instead.
  • 20. Authentication  Change passwords :  Ensure your application has a change password function.  Use AUTOCOMPLETE=off to prevent browsers from caching the password locally  The form must include the old password, the new password and a confirmation of the new password  If the user gets the old password wrong too many times, lock the account and kill the session
  • 21. Authentication Brute Force  Applications should be robust in the face of determined automated brute force and dictionary attack, such as from Brutus or custom scripts. Determined brute force attacks cannot easily be defeated, only delayed.  If the application allows more than five attempts from a single IP address, or a collection rate in excess of 10 requests a second, it’s likely that the application will fall to determined brute force attack.
  • 22. Authentication  Brute Force Countermeasure  logs failed authentication attempts  A delay of three seconds can make automated brute force attacks almost infeasible.  Error message that does not disclose which part of the application credentials are incorrect.  for applications requiring stronger controls, blocking access from abusive IP addresses (accessing more than three accounts from the same IP address, or attempting to lock outmore than one account)
  • 23. Authentication Browser remembers passwords  Modern browsers offer users the ability to manage their multitude of credentials by storing them insecurely on their computer.  In the rendered HTTP, send the following in any sensitive input fields, such as usernames,passwords, password re-validation, credit card and CCV fields, and so on: <form … AUTOCOMPLETE="off"> - for all form fields <input … AUTOCOMPLETE="off"> - for just one field