SlideShare a Scribd company logo
1 of 44
Insecure Implementation of
     Security Practices
        Karmendra Kohli
      Director, Co-founder
Agenda
• Talk about insecure implementation of
  security practices for
  – Salted Hashing
  – CAPTCHA
  – Browser Caching
Why do we need authentication
• Abstraction of Lock and Key
  – Humans are used to and comfortable with the
    concept
• Explicit Authentication happens only once
  – Implicit authentication with each request
Threats to passwords
• In the Host
  – Can be found in Memory or Browser History
• Network
  – Can be sniffed or found in proxy logs
• Database
  – If stored in clear-text, compromise of DB leads to
    complete compromise
  – Backup tapes etc
Securing Credentials
• Denote password by ******** in the form field
  – Can be guessed
• Implement strong password policy
  – Can be stolen
• Base64 Encoding
  – Can be decoded
• Encrypting the password
  – Can be decrypted
• Hashing the password
  – Our story begins from here…
Hashing
• Cryptographic Hash Function is a
  transformation that takes an input and returns
  a fixed-size string, which is called the hash
  value. – From Wikipedia
• One way hashes cannot be reversed, they can
  only be compared
  – Just like finger prints
• A strong one-way hash will have minute
  probability of collision
Use of hashing
• Authentication
• Message Integrity
• Digital Signatures
Is just a hash secure?
• Hash can be stolen from the
  – memory
  – browser history
  – network by sniffing
  – proxy logs
• We can replay the hash instead of the clear
  text password
  – Does not need to be reversed for authentication
Hash with a pinch of salt
• Salted hash
  – Aims at implementing a one time password
    scheme
  – Each time the password of the user transmitted
    from the client is different
  – Even if stolen cannot be reused/replayed
  Well That Is The Aim!!
The Working Steps
1. With each request to the login page by the user,
   the server generates a random number, the salt,
   and sends it to the client along with the login
   page.
2. A JavaScript code on the client computes the
   hash of the password entered by the user.
3. The salt is concatenated with the computed
   hash of the password to re-compute the hash of
   the concatenated string (let this salted hash be
   ‘A’).
4. The result i.e. ‘A’ generated in the previous step
   is sent to the server along with the username.
The Working Steps
5. On the server side - the application retrieves the
   hashed password for the corresponding
   username from the database.
6. The hashed password fetched from the database
   is concatenated with the salt (which was earlier
   sent to the client) stored at the server. Hash of
   the concatenated string is calculated at the
   server (let this salted hash be B).
7. If the user entered the correct password then
   these two hashes (A & B) should match. The
   server compares these two hashes and if they
   match, the user is authenticated.
8. The salt is then deleted from the server side
Insecure Implementations
1. Generating salt on client side
Generating salt on client side
Generating salt on client side
• So we have all values that server needs to
  calculate the salted hash
• It is enough to replay the values
• Beats goal of using salts
2. Using a limited set of salts
• The number of salts being used by the server
  is fixed
• Above replay technique works
  – We just need to try multiple number of times
3. Using same salt for same user
• In this case the salted hash was stored by the
  developer in the DB
  – Gives a ‘feeling’ of more security
• If salted hash is stored as password, then salt
  too needs to be stored ☺
• Hence same salt is sent each time - replay
4. Not re-initializing the salt for login
                  pages
• Multiple logins from the same browser
  resulted in same salt being used
• Salt not deleted from the server side on
  successful or unsuccessful authentication
• Problem is also related to not re-initializing
  the session after successful or unsuccessful
  authentication
• Attack window is small, but still…
5. Transmitting clear text password
         along with salted hash
• Many implementations observed
• The salted hash is sent along with clear text
  form input fields
• The salted hash is computed using different
  set of hidden variables
Transmitting clear text along with
           salted hash
6. Not re-initializing the java script
                 variables
• Uname = Document.form1.textbox1.value
• Pwd = Document.form1.textbox2.value
• Use the and ‘pwd’ variable for salted hash
  calculation
  – Hash = Hfx (pwd)
  – Hash = Hfx (Hash + salt)
• The uname and pwd can be found as clear text
  in memory
Not re-initializing the java script
            variables
7. Storing password in clear text in
                database
• Hash = hash (password + salt)
• Server does not store salt in the database
• Clearly implies that server also does not store
  hash of password in database
Salted Hash Best Practices
• Salt
  – Generated on server side
  – Must be highly random. Must use cryptographically
    strong PRNG algorithm
  – Must never be stored in the database
  – Must be re-generated after each successful
    /unsuccessful attempt
  – All temporary Form Field or JS variables must be set to
    null before submitting the request
• Passwords must be stored in hashed format in
  the database
CAPTCHA
• Completely Automated Public Turing Tests to Tell
  Computers and Humans Apart




• Aim is to introduce an entity that requires human
  intervention
• Protection against DOS or Brute force or Misuse
  – Avoiding automating submissions
Typical uses
• Public Forms
  – Registration
  – Feedback / Rating
  – Survey
  – Blog post
  – Appointment/Slot booking
CAPTCHA - Implementation
• Initiate a session for the page rendered
• Request for image
• Generate unique string randomly on server side
• Generate image with string embedded
• Remember the string in Session Object and send
  CAPTCHA to client
• For each client request, validate the sent value with the
  one in the session object
• Invalidate session after each attempt
    – Both successful and unsuccessful
• Generate new CAPTCHA for each new page request
Insecure Implementation
• We are not focusing weakness of CAPTCHA
  generation
  – It’s a different ball game
• We will discuss common implementation
  flaws of using CAPTCHA’s
1. Verifying CAPTCHA on client side
• The client side JavaScript verifies the CAPTCHA
  value
• Server trusts the decision of client
  strPassFlag=True;
• Completely bypass enforcement
• Automate submission
2. Having a limited set words
• Small fixed pool of CAPTCHA words
• Automated tools will have high probability of
  hits
• Bypass goal of implementing CAPTCHA
What better than a COMBO




                   Limited pool of
               CAPTCHA values with
               client side verification
3. Validate CAPTCHA on server but
         value sent from client
• Actual value of CAPTCHA sent as hidden
  variable
  – Hmmmmm, “hidden” does not mean “secure”
• Replay request with value of our choice
4. Session is not re-initialized
• Session not re-initialized after form
  submission
• Refresh on submitted page works
• Automate replay of requests using assigned
  session ID
• Multiple registrations
  – Treasure trove for spammers
5. Image ID can be replayed
• The request for image is of the form
• <img src =
  http://www.testserver.com/image_draw.jsp?I
  D=23erdfret45ffrsd4g3fd3sa3a4d5a
• The image_draw.jsp decrypts the value to get
  the word
• For the same value the same word is rendered
  ALWAYS
• Replay image request
Image ID can be replayed
                                                    Server
 Client
          Step#1: Request for Public FORM



          Step#2: Form with
          <img src=http://…/image_draw.php?id=X1>

                                                     Step#4: Generate an image
          Step#3: Request for Image                  based on unique token (X1) &
                                                     store in the session object.

          Step#5: Form rendered with image


                                                     Step#7: Validation with string
          Step#6: FORM Submission                    stored in the session object.




• Step 2 can be replayed
6. CAPTCHA is not an image
• One application had a ‘feeling’ of an image
• Java Script used for rendering the text on the
  page in a “different” font
• Tools can read such text easily


                                    Text can be selected ☺
CAPTCHA implementation best
             practices
CAPTCHA:
  – Generated on server side
  – Verified on server side
  – Strings must be randomly generated
  – Images must not be generated based on token
    from ‘hidden’ client side
  – Must be bound to a session
  – Must be re-generated after each successful
    /unsuccessful attempt
Caching Issues
• Unauthorized access to information


                                                    User
                         CC No
  User Name
                         SB Account No              Logged off
                                          Back
  Password

              Submit                     Submit
   Sign In
                                         Sign Out

                                                    Thank You
                       Account Details
    Login
Browser Cache
• A local store
  – Aims to improve performance
  – Renders pages locally, fast user experience
  – Support across browsers
• Controlled by a lot many directives
  – Pragma: no-cache
  – Cache-control: no-cache
  – Expires: Mon, 03 Jul 2000 9:30:41 GMT
Caching
• Relevant HTTP fields
  •   Request
      o If-Modified-Since
      o Pragma: no-cache

      Response
  •
      o Last-Modified
      o Expires: Mon, 03 Apr 2009 9:30:41 GMT
      o Cache-Control: no-cache, no-store
Caching
• Relevant HTTP fields
  •   Request
      o If-Modified-Since – Recheck for fresh content
      o Pragma: no-cache – HTTP 1.0

      Response
  •
      o Last-Modified – Confirm fresh content
      o Expires: ………… – HTTP 1.0
      o Cache-Control: no-cache – Pages will not be
         displayed, but will still be stored
      o Cache-Control: no-store – Pages will not be stored
Caching best practice
• For critical applications
   • Cache-Control: no-cache and Cache-
     Control: no-store must be set for ALL pages
Example Implementation flaw
• Banking application
   – Ideally all pages must be fetched fresh
   – Clicking on ‘back’ must not render page
   – All pages set with Cache-Control: no-cache,
     no-store
      – excepting logout page
   – On logout, an intermediate proxy used to
     serve logout page
   – Session was not invalidated as request did
     not reach server
karmendra.kohli@secureyes.net

More Related Content

What's hot

BCON22: oneAPI backend - Blender Cycles on Intel GPUs
BCON22: oneAPI backend - Blender Cycles on Intel GPUsBCON22: oneAPI backend - Blender Cycles on Intel GPUs
BCON22: oneAPI backend - Blender Cycles on Intel GPUsXavier Hallade
 
Akka Actor presentation
Akka Actor presentationAkka Actor presentation
Akka Actor presentationGene Chang
 
P4, EPBF, and Linux TC Offload
P4, EPBF, and Linux TC OffloadP4, EPBF, and Linux TC Offload
P4, EPBF, and Linux TC OffloadOpen-NFP
 
Computing Performance: On the Horizon (2021)
Computing Performance: On the Horizon (2021)Computing Performance: On the Horizon (2021)
Computing Performance: On the Horizon (2021)Brendan Gregg
 
Asterisk High Availability Design Guide
Asterisk High Availability Design GuideAsterisk High Availability Design Guide
Asterisk High Availability Design GuideMichelle Dupuis
 
Linux Networking Explained
Linux Networking ExplainedLinux Networking Explained
Linux Networking ExplainedThomas Graf
 
Android for Embedded Linux Developers
Android for Embedded Linux DevelopersAndroid for Embedded Linux Developers
Android for Embedded Linux DevelopersOpersys inc.
 
API Security Best Practices and Guidelines
API Security Best Practices and GuidelinesAPI Security Best Practices and Guidelines
API Security Best Practices and GuidelinesWSO2
 
The BlackBox Project: Safely store secrets in Git/Mercurial (originally for P...
The BlackBox Project: Safely store secrets in Git/Mercurial (originally for P...The BlackBox Project: Safely store secrets in Git/Mercurial (originally for P...
The BlackBox Project: Safely store secrets in Git/Mercurial (originally for P...Tom Limoncelli
 
Kafka at half the price with JBOD setup
Kafka at half the price with JBOD setupKafka at half the price with JBOD setup
Kafka at half the price with JBOD setupDong Lin
 
Prerequisite knowledge for shared memory concurrency
Prerequisite knowledge for shared memory concurrencyPrerequisite knowledge for shared memory concurrency
Prerequisite knowledge for shared memory concurrencyViller Hsiao
 
BugBounty Roadmap with Mohammed Adam
BugBounty Roadmap with Mohammed AdamBugBounty Roadmap with Mohammed Adam
BugBounty Roadmap with Mohammed AdamMohammed Adam
 
Apache Camel - The integration library
Apache Camel - The integration libraryApache Camel - The integration library
Apache Camel - The integration libraryClaus Ibsen
 
Troubleshooting common oslo.messaging and RabbitMQ issues
Troubleshooting common oslo.messaging and RabbitMQ issuesTroubleshooting common oslo.messaging and RabbitMQ issues
Troubleshooting common oslo.messaging and RabbitMQ issuesMichael Klishin
 
FreeSWITCH Modules for Asterisk Developers
FreeSWITCH Modules for Asterisk DevelopersFreeSWITCH Modules for Asterisk Developers
FreeSWITCH Modules for Asterisk DevelopersMoises Silva
 
제3회난공불락 오픈소스 인프라세미나 - Pacemaker
제3회난공불락 오픈소스 인프라세미나 - Pacemaker제3회난공불락 오픈소스 인프라세미나 - Pacemaker
제3회난공불락 오픈소스 인프라세미나 - PacemakerTommy Lee
 
Introduction To RabbitMQ
Introduction To RabbitMQIntroduction To RabbitMQ
Introduction To RabbitMQKnoldus Inc.
 

What's hot (20)

BCON22: oneAPI backend - Blender Cycles on Intel GPUs
BCON22: oneAPI backend - Blender Cycles on Intel GPUsBCON22: oneAPI backend - Blender Cycles on Intel GPUs
BCON22: oneAPI backend - Blender Cycles on Intel GPUs
 
Hping, TCP/IP Paket Üretici
Hping, TCP/IP Paket ÜreticiHping, TCP/IP Paket Üretici
Hping, TCP/IP Paket Üretici
 
Akka Actor presentation
Akka Actor presentationAkka Actor presentation
Akka Actor presentation
 
P4, EPBF, and Linux TC Offload
P4, EPBF, and Linux TC OffloadP4, EPBF, and Linux TC Offload
P4, EPBF, and Linux TC Offload
 
Computing Performance: On the Horizon (2021)
Computing Performance: On the Horizon (2021)Computing Performance: On the Horizon (2021)
Computing Performance: On the Horizon (2021)
 
Asterisk High Availability Design Guide
Asterisk High Availability Design GuideAsterisk High Availability Design Guide
Asterisk High Availability Design Guide
 
Linux Networking Explained
Linux Networking ExplainedLinux Networking Explained
Linux Networking Explained
 
Android for Embedded Linux Developers
Android for Embedded Linux DevelopersAndroid for Embedded Linux Developers
Android for Embedded Linux Developers
 
API Security Best Practices and Guidelines
API Security Best Practices and GuidelinesAPI Security Best Practices and Guidelines
API Security Best Practices and Guidelines
 
The BlackBox Project: Safely store secrets in Git/Mercurial (originally for P...
The BlackBox Project: Safely store secrets in Git/Mercurial (originally for P...The BlackBox Project: Safely store secrets in Git/Mercurial (originally for P...
The BlackBox Project: Safely store secrets in Git/Mercurial (originally for P...
 
Kafka at half the price with JBOD setup
Kafka at half the price with JBOD setupKafka at half the price with JBOD setup
Kafka at half the price with JBOD setup
 
Prerequisite knowledge for shared memory concurrency
Prerequisite knowledge for shared memory concurrencyPrerequisite knowledge for shared memory concurrency
Prerequisite knowledge for shared memory concurrency
 
BugBounty Roadmap with Mohammed Adam
BugBounty Roadmap with Mohammed AdamBugBounty Roadmap with Mohammed Adam
BugBounty Roadmap with Mohammed Adam
 
Apache Camel - The integration library
Apache Camel - The integration libraryApache Camel - The integration library
Apache Camel - The integration library
 
淺談探索 Linux 系統設計之道
淺談探索 Linux 系統設計之道 淺談探索 Linux 系統設計之道
淺談探索 Linux 系統設計之道
 
Troubleshooting common oslo.messaging and RabbitMQ issues
Troubleshooting common oslo.messaging and RabbitMQ issuesTroubleshooting common oslo.messaging and RabbitMQ issues
Troubleshooting common oslo.messaging and RabbitMQ issues
 
FreeSWITCH Modules for Asterisk Developers
FreeSWITCH Modules for Asterisk DevelopersFreeSWITCH Modules for Asterisk Developers
FreeSWITCH Modules for Asterisk Developers
 
Second Level Cache in JPA Explained
Second Level Cache in JPA ExplainedSecond Level Cache in JPA Explained
Second Level Cache in JPA Explained
 
제3회난공불락 오픈소스 인프라세미나 - Pacemaker
제3회난공불락 오픈소스 인프라세미나 - Pacemaker제3회난공불락 오픈소스 인프라세미나 - Pacemaker
제3회난공불락 오픈소스 인프라세미나 - Pacemaker
 
Introduction To RabbitMQ
Introduction To RabbitMQIntroduction To RabbitMQ
Introduction To RabbitMQ
 

Viewers also liked

Reverse Engineering for exploit writers
Reverse Engineering for exploit writersReverse Engineering for exploit writers
Reverse Engineering for exploit writersamiable_indian
 
No Substitute for Ongoing Data, Quantification, Visualization, and Story-Telling
No Substitute for Ongoing Data, Quantification, Visualization, and Story-TellingNo Substitute for Ongoing Data, Quantification, Visualization, and Story-Telling
No Substitute for Ongoing Data, Quantification, Visualization, and Story-Tellingamiable_indian
 
Cisco IOS Attack & Defense - The State of the Art
Cisco IOS Attack & Defense - The State of the Art Cisco IOS Attack & Defense - The State of the Art
Cisco IOS Attack & Defense - The State of the Art amiable_indian
 
Phishing As Tragedy of the Commons
Phishing As Tragedy of the CommonsPhishing As Tragedy of the Commons
Phishing As Tragedy of the Commonsamiable_indian
 
A Human Factors Perspective on Alarm System Research & Development 2000 to 2010
A Human Factors Perspective on Alarm System Research & Development 2000 to 2010A Human Factors Perspective on Alarm System Research & Development 2000 to 2010
A Human Factors Perspective on Alarm System Research & Development 2000 to 2010Eric Shaver, PhD
 
Workshop on Wireless Security
Workshop on Wireless SecurityWorkshop on Wireless Security
Workshop on Wireless Securityamiable_indian
 
Secrets of Top Pentesters
Secrets of Top PentestersSecrets of Top Pentesters
Secrets of Top Pentestersamiable_indian
 
Workshop on BackTrack live CD
Workshop on BackTrack live CDWorkshop on BackTrack live CD
Workshop on BackTrack live CDamiable_indian
 

Viewers also liked (8)

Reverse Engineering for exploit writers
Reverse Engineering for exploit writersReverse Engineering for exploit writers
Reverse Engineering for exploit writers
 
No Substitute for Ongoing Data, Quantification, Visualization, and Story-Telling
No Substitute for Ongoing Data, Quantification, Visualization, and Story-TellingNo Substitute for Ongoing Data, Quantification, Visualization, and Story-Telling
No Substitute for Ongoing Data, Quantification, Visualization, and Story-Telling
 
Cisco IOS Attack & Defense - The State of the Art
Cisco IOS Attack & Defense - The State of the Art Cisco IOS Attack & Defense - The State of the Art
Cisco IOS Attack & Defense - The State of the Art
 
Phishing As Tragedy of the Commons
Phishing As Tragedy of the CommonsPhishing As Tragedy of the Commons
Phishing As Tragedy of the Commons
 
A Human Factors Perspective on Alarm System Research & Development 2000 to 2010
A Human Factors Perspective on Alarm System Research & Development 2000 to 2010A Human Factors Perspective on Alarm System Research & Development 2000 to 2010
A Human Factors Perspective on Alarm System Research & Development 2000 to 2010
 
Workshop on Wireless Security
Workshop on Wireless SecurityWorkshop on Wireless Security
Workshop on Wireless Security
 
Secrets of Top Pentesters
Secrets of Top PentestersSecrets of Top Pentesters
Secrets of Top Pentesters
 
Workshop on BackTrack live CD
Workshop on BackTrack live CDWorkshop on BackTrack live CD
Workshop on BackTrack live CD
 

Similar to Insecure Implementation of Security Best Practices: of hashing, CAPTCHA's and Caching

Karmendra - Hashing, CAPTCHA's and Caching - ClubHack2008
Karmendra - Hashing, CAPTCHA's and Caching - ClubHack2008Karmendra - Hashing, CAPTCHA's and Caching - ClubHack2008
Karmendra - Hashing, CAPTCHA's and Caching - ClubHack2008ClubHack
 
Redesigning Password Authentication for the Modern Web
Redesigning Password Authentication for the Modern WebRedesigning Password Authentication for the Modern Web
Redesigning Password Authentication for the Modern WebCliff Smith
 
Be Afraid. Be Very Afraid. Javascript security, XSS & CSRF
Be Afraid. Be Very Afraid. Javascript security, XSS & CSRFBe Afraid. Be Very Afraid. Javascript security, XSS & CSRF
Be Afraid. Be Very Afraid. Javascript security, XSS & CSRFMark Stanton
 
Ch 7: Attacking Session Management
Ch 7: Attacking Session ManagementCh 7: Attacking Session Management
Ch 7: Attacking Session ManagementSam Bowne
 
Authentication in Node.js
Authentication in Node.jsAuthentication in Node.js
Authentication in Node.jsJason Pearson
 
Serverless Authentication and Authorisation for Your APIs on AWS
Serverless Authentication and Authorisation for Your APIs on AWS Serverless Authentication and Authorisation for Your APIs on AWS
Serverless Authentication and Authorisation for Your APIs on AWS Amazon Web Services
 
How LinkedIn changed its security model in order to offer an API
How LinkedIn changed its security model  in order to offer an APIHow LinkedIn changed its security model  in order to offer an API
How LinkedIn changed its security model in order to offer an APILinkedIn
 
Comet from JavaOne 2008
Comet from JavaOne 2008Comet from JavaOne 2008
Comet from JavaOne 2008Joe Walker
 
CIS14: Authentication: Who are You? You are What You Eat
CIS14: Authentication: Who are You? You are What You EatCIS14: Authentication: Who are You? You are What You Eat
CIS14: Authentication: Who are You? You are What You EatCloudIDSummit
 
CIS14: Authentication: Who are You? You are What You Eat
CIS14: Authentication: Who are You? You are What You EatCIS14: Authentication: Who are You? You are What You Eat
CIS14: Authentication: Who are You? You are What You EatCloudIDSummit
 
How to implement PassKeys in your application
How to implement PassKeys in your applicationHow to implement PassKeys in your application
How to implement PassKeys in your applicationMarian Marinov
 
Presentation 3 1 1 1
Presentation 3 1 1 1Presentation 3 1 1 1
Presentation 3 1 1 1Ashwin Kumar
 
CNIT 129S: Ch 7: Attacking Session Management
CNIT 129S: Ch 7: Attacking Session Management CNIT 129S: Ch 7: Attacking Session Management
CNIT 129S: Ch 7: Attacking Session Management Sam Bowne
 
When Crypto Attacks! (Yahoo 2009)
When Crypto Attacks! (Yahoo 2009)When Crypto Attacks! (Yahoo 2009)
When Crypto Attacks! (Yahoo 2009)Nate Lawson
 
Token Authentication for Java Applications
Token Authentication for Java ApplicationsToken Authentication for Java Applications
Token Authentication for Java ApplicationsStormpath
 
Ntu workshop : REST, PayPal APIs & Async
Ntu workshop : REST, PayPal APIs & AsyncNtu workshop : REST, PayPal APIs & Async
Ntu workshop : REST, PayPal APIs & AsyncAeshan Wijetunge
 
Advance WAF bot mitigations V13.1
Advance WAF bot mitigations V13.1 Advance WAF bot mitigations V13.1
Advance WAF bot mitigations V13.1 Lior Rotkovitch
 
Top 10 Web Application vulnerabilities
Top 10 Web Application vulnerabilitiesTop 10 Web Application vulnerabilities
Top 10 Web Application vulnerabilitiesTerrance Medina
 

Similar to Insecure Implementation of Security Best Practices: of hashing, CAPTCHA's and Caching (20)

Karmendra - Hashing, CAPTCHA's and Caching - ClubHack2008
Karmendra - Hashing, CAPTCHA's and Caching - ClubHack2008Karmendra - Hashing, CAPTCHA's and Caching - ClubHack2008
Karmendra - Hashing, CAPTCHA's and Caching - ClubHack2008
 
Redesigning Password Authentication for the Modern Web
Redesigning Password Authentication for the Modern WebRedesigning Password Authentication for the Modern Web
Redesigning Password Authentication for the Modern Web
 
2600 Thailand #50 From 0day to CVE
2600 Thailand #50 From 0day to CVE2600 Thailand #50 From 0day to CVE
2600 Thailand #50 From 0day to CVE
 
Be Afraid. Be Very Afraid. Javascript security, XSS & CSRF
Be Afraid. Be Very Afraid. Javascript security, XSS & CSRFBe Afraid. Be Very Afraid. Javascript security, XSS & CSRF
Be Afraid. Be Very Afraid. Javascript security, XSS & CSRF
 
Ch 7: Attacking Session Management
Ch 7: Attacking Session ManagementCh 7: Attacking Session Management
Ch 7: Attacking Session Management
 
Authentication in Node.js
Authentication in Node.jsAuthentication in Node.js
Authentication in Node.js
 
Serverless Authentication and Authorisation for Your APIs on AWS
Serverless Authentication and Authorisation for Your APIs on AWS Serverless Authentication and Authorisation for Your APIs on AWS
Serverless Authentication and Authorisation for Your APIs on AWS
 
How LinkedIn changed its security model in order to offer an API
How LinkedIn changed its security model  in order to offer an APIHow LinkedIn changed its security model  in order to offer an API
How LinkedIn changed its security model in order to offer an API
 
Comet from JavaOne 2008
Comet from JavaOne 2008Comet from JavaOne 2008
Comet from JavaOne 2008
 
CIS14: Authentication: Who are You? You are What You Eat
CIS14: Authentication: Who are You? You are What You EatCIS14: Authentication: Who are You? You are What You Eat
CIS14: Authentication: Who are You? You are What You Eat
 
CIS14: Authentication: Who are You? You are What You Eat
CIS14: Authentication: Who are You? You are What You EatCIS14: Authentication: Who are You? You are What You Eat
CIS14: Authentication: Who are You? You are What You Eat
 
How to implement PassKeys in your application
How to implement PassKeys in your applicationHow to implement PassKeys in your application
How to implement PassKeys in your application
 
Presentation 3 1 1 1
Presentation 3 1 1 1Presentation 3 1 1 1
Presentation 3 1 1 1
 
CNIT 129S: Ch 7: Attacking Session Management
CNIT 129S: Ch 7: Attacking Session Management CNIT 129S: Ch 7: Attacking Session Management
CNIT 129S: Ch 7: Attacking Session Management
 
When Crypto Attacks! (Yahoo 2009)
When Crypto Attacks! (Yahoo 2009)When Crypto Attacks! (Yahoo 2009)
When Crypto Attacks! (Yahoo 2009)
 
Token Authentication for Java Applications
Token Authentication for Java ApplicationsToken Authentication for Java Applications
Token Authentication for Java Applications
 
Authentication techniques
Authentication techniquesAuthentication techniques
Authentication techniques
 
Ntu workshop : REST, PayPal APIs & Async
Ntu workshop : REST, PayPal APIs & AsyncNtu workshop : REST, PayPal APIs & Async
Ntu workshop : REST, PayPal APIs & Async
 
Advance WAF bot mitigations V13.1
Advance WAF bot mitigations V13.1 Advance WAF bot mitigations V13.1
Advance WAF bot mitigations V13.1
 
Top 10 Web Application vulnerabilities
Top 10 Web Application vulnerabilitiesTop 10 Web Application vulnerabilities
Top 10 Web Application vulnerabilities
 

More from amiable_indian

State of Cyber Law in India
State of Cyber Law in IndiaState of Cyber Law in India
State of Cyber Law in Indiaamiable_indian
 
AntiSpam - Understanding the good, the bad and the ugly
AntiSpam - Understanding the good, the bad and the uglyAntiSpam - Understanding the good, the bad and the ugly
AntiSpam - Understanding the good, the bad and the uglyamiable_indian
 
Reverse Engineering v/s Secure Coding
Reverse Engineering v/s Secure CodingReverse Engineering v/s Secure Coding
Reverse Engineering v/s Secure Codingamiable_indian
 
Network Vulnerability Assessments: Lessons Learned
Network Vulnerability Assessments: Lessons LearnedNetwork Vulnerability Assessments: Lessons Learned
Network Vulnerability Assessments: Lessons Learnedamiable_indian
 
Economic offenses through Credit Card Frauds Dissected
Economic offenses through Credit Card Frauds DissectedEconomic offenses through Credit Card Frauds Dissected
Economic offenses through Credit Card Frauds Dissectedamiable_indian
 
Immune IT: Moving from Security to Immunity
Immune IT: Moving from Security to ImmunityImmune IT: Moving from Security to Immunity
Immune IT: Moving from Security to Immunityamiable_indian
 
Reverse Engineering for exploit writers
Reverse Engineering for exploit writersReverse Engineering for exploit writers
Reverse Engineering for exploit writersamiable_indian
 
Hacking Client Side Insecurities
Hacking Client Side InsecuritiesHacking Client Side Insecurities
Hacking Client Side Insecuritiesamiable_indian
 
Web Exploit Finder Presentation
Web Exploit Finder PresentationWeb Exploit Finder Presentation
Web Exploit Finder Presentationamiable_indian
 
Network Security Data Visualization
Network Security Data VisualizationNetwork Security Data Visualization
Network Security Data Visualizationamiable_indian
 
Enhancing Computer Security via End-to-End Communication Visualization
Enhancing Computer Security via End-to-End Communication Visualization Enhancing Computer Security via End-to-End Communication Visualization
Enhancing Computer Security via End-to-End Communication Visualization amiable_indian
 
Top Network Vulnerabilities Over Time
Top Network Vulnerabilities Over TimeTop Network Vulnerabilities Over Time
Top Network Vulnerabilities Over Timeamiable_indian
 
What are the Business Security Metrics?
What are the Business Security Metrics? What are the Business Security Metrics?
What are the Business Security Metrics? amiable_indian
 
Advanced Ajax Security
Advanced Ajax SecurityAdvanced Ajax Security
Advanced Ajax Securityamiable_indian
 
Network Performance Forecasting System
Network Performance Forecasting SystemNetwork Performance Forecasting System
Network Performance Forecasting Systemamiable_indian
 
Leading Indicators in Information Security
Leading Indicators in Information SecurityLeading Indicators in Information Security
Leading Indicators in Information Securityamiable_indian
 
Security Considerations in Process Control and SCADA Environments
Security Considerations in Process Control and SCADA EnvironmentsSecurity Considerations in Process Control and SCADA Environments
Security Considerations in Process Control and SCADA Environmentsamiable_indian
 
Fast flux hosting and DNS
Fast flux hosting and DNSFast flux hosting and DNS
Fast flux hosting and DNSamiable_indian
 

More from amiable_indian (20)

State of Cyber Law in India
State of Cyber Law in IndiaState of Cyber Law in India
State of Cyber Law in India
 
AntiSpam - Understanding the good, the bad and the ugly
AntiSpam - Understanding the good, the bad and the uglyAntiSpam - Understanding the good, the bad and the ugly
AntiSpam - Understanding the good, the bad and the ugly
 
Reverse Engineering v/s Secure Coding
Reverse Engineering v/s Secure CodingReverse Engineering v/s Secure Coding
Reverse Engineering v/s Secure Coding
 
Network Vulnerability Assessments: Lessons Learned
Network Vulnerability Assessments: Lessons LearnedNetwork Vulnerability Assessments: Lessons Learned
Network Vulnerability Assessments: Lessons Learned
 
Economic offenses through Credit Card Frauds Dissected
Economic offenses through Credit Card Frauds DissectedEconomic offenses through Credit Card Frauds Dissected
Economic offenses through Credit Card Frauds Dissected
 
Immune IT: Moving from Security to Immunity
Immune IT: Moving from Security to ImmunityImmune IT: Moving from Security to Immunity
Immune IT: Moving from Security to Immunity
 
Reverse Engineering for exploit writers
Reverse Engineering for exploit writersReverse Engineering for exploit writers
Reverse Engineering for exploit writers
 
Hacking Client Side Insecurities
Hacking Client Side InsecuritiesHacking Client Side Insecurities
Hacking Client Side Insecurities
 
Web Exploit Finder Presentation
Web Exploit Finder PresentationWeb Exploit Finder Presentation
Web Exploit Finder Presentation
 
Network Security Data Visualization
Network Security Data VisualizationNetwork Security Data Visualization
Network Security Data Visualization
 
Enhancing Computer Security via End-to-End Communication Visualization
Enhancing Computer Security via End-to-End Communication Visualization Enhancing Computer Security via End-to-End Communication Visualization
Enhancing Computer Security via End-to-End Communication Visualization
 
Top Network Vulnerabilities Over Time
Top Network Vulnerabilities Over TimeTop Network Vulnerabilities Over Time
Top Network Vulnerabilities Over Time
 
What are the Business Security Metrics?
What are the Business Security Metrics? What are the Business Security Metrics?
What are the Business Security Metrics?
 
Advanced Ajax Security
Advanced Ajax SecurityAdvanced Ajax Security
Advanced Ajax Security
 
Network Performance Forecasting System
Network Performance Forecasting SystemNetwork Performance Forecasting System
Network Performance Forecasting System
 
Leading Indicators in Information Security
Leading Indicators in Information SecurityLeading Indicators in Information Security
Leading Indicators in Information Security
 
Ferret - Data Seepage
Ferret - Data SeepageFerret - Data Seepage
Ferret - Data Seepage
 
SCADA Security
SCADA SecuritySCADA Security
SCADA Security
 
Security Considerations in Process Control and SCADA Environments
Security Considerations in Process Control and SCADA EnvironmentsSecurity Considerations in Process Control and SCADA Environments
Security Considerations in Process Control and SCADA Environments
 
Fast flux hosting and DNS
Fast flux hosting and DNSFast flux hosting and DNS
Fast flux hosting and DNS
 

Recently uploaded

ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...FIDO Alliance
 
A Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System StrategyA Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System StrategyUXDXConf
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfFIDO Alliance
 
Buy Epson EcoTank L3210 Colour Printer Online.pdf
Buy Epson EcoTank L3210 Colour Printer Online.pdfBuy Epson EcoTank L3210 Colour Printer Online.pdf
Buy Epson EcoTank L3210 Colour Printer Online.pdfEasyPrinterHelp
 
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekCzechDreamin
 
PLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsPLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsStefano
 
UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2DianaGray10
 
Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Patrick Viafore
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...CzechDreamin
 
The Metaverse: Are We There Yet?
The  Metaverse:    Are   We  There  Yet?The  Metaverse:    Are   We  There  Yet?
The Metaverse: Are We There Yet?Mark Billinghurst
 
UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1DianaGray10
 
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...CzechDreamin
 
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxUnpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxDavid Michel
 
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Julian Hyde
 
Syngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdfSyngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdfSyngulon
 
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi IbrahimzadeFree and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi IbrahimzadeCzechDreamin
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfFIDO Alliance
 
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfWhere to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfFIDO Alliance
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyJohn Staveley
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlPeter Udo Diehl
 

Recently uploaded (20)

ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
 
A Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System StrategyA Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System Strategy
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
 
Buy Epson EcoTank L3210 Colour Printer Online.pdf
Buy Epson EcoTank L3210 Colour Printer Online.pdfBuy Epson EcoTank L3210 Colour Printer Online.pdf
Buy Epson EcoTank L3210 Colour Printer Online.pdf
 
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří Karpíšek
 
PLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsPLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. Startups
 
UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2
 
Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
 
The Metaverse: Are We There Yet?
The  Metaverse:    Are   We  There  Yet?The  Metaverse:    Are   We  There  Yet?
The Metaverse: Are We There Yet?
 
UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1
 
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
 
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxUnpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
 
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
 
Syngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdfSyngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdf
 
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi IbrahimzadeFree and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
 
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfWhere to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John Staveley
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
 

Insecure Implementation of Security Best Practices: of hashing, CAPTCHA's and Caching

  • 1. Insecure Implementation of Security Practices Karmendra Kohli Director, Co-founder
  • 2. Agenda • Talk about insecure implementation of security practices for – Salted Hashing – CAPTCHA – Browser Caching
  • 3. Why do we need authentication • Abstraction of Lock and Key – Humans are used to and comfortable with the concept • Explicit Authentication happens only once – Implicit authentication with each request
  • 4. Threats to passwords • In the Host – Can be found in Memory or Browser History • Network – Can be sniffed or found in proxy logs • Database – If stored in clear-text, compromise of DB leads to complete compromise – Backup tapes etc
  • 5. Securing Credentials • Denote password by ******** in the form field – Can be guessed • Implement strong password policy – Can be stolen • Base64 Encoding – Can be decoded • Encrypting the password – Can be decrypted • Hashing the password – Our story begins from here…
  • 6. Hashing • Cryptographic Hash Function is a transformation that takes an input and returns a fixed-size string, which is called the hash value. – From Wikipedia • One way hashes cannot be reversed, they can only be compared – Just like finger prints • A strong one-way hash will have minute probability of collision
  • 7. Use of hashing • Authentication • Message Integrity • Digital Signatures
  • 8. Is just a hash secure? • Hash can be stolen from the – memory – browser history – network by sniffing – proxy logs • We can replay the hash instead of the clear text password – Does not need to be reversed for authentication
  • 9. Hash with a pinch of salt • Salted hash – Aims at implementing a one time password scheme – Each time the password of the user transmitted from the client is different – Even if stolen cannot be reused/replayed Well That Is The Aim!!
  • 10. The Working Steps 1. With each request to the login page by the user, the server generates a random number, the salt, and sends it to the client along with the login page. 2. A JavaScript code on the client computes the hash of the password entered by the user. 3. The salt is concatenated with the computed hash of the password to re-compute the hash of the concatenated string (let this salted hash be ‘A’). 4. The result i.e. ‘A’ generated in the previous step is sent to the server along with the username.
  • 11. The Working Steps 5. On the server side - the application retrieves the hashed password for the corresponding username from the database. 6. The hashed password fetched from the database is concatenated with the salt (which was earlier sent to the client) stored at the server. Hash of the concatenated string is calculated at the server (let this salted hash be B). 7. If the user entered the correct password then these two hashes (A & B) should match. The server compares these two hashes and if they match, the user is authenticated. 8. The salt is then deleted from the server side
  • 13. 1. Generating salt on client side
  • 14. Generating salt on client side
  • 15. Generating salt on client side • So we have all values that server needs to calculate the salted hash • It is enough to replay the values • Beats goal of using salts
  • 16. 2. Using a limited set of salts • The number of salts being used by the server is fixed • Above replay technique works – We just need to try multiple number of times
  • 17. 3. Using same salt for same user • In this case the salted hash was stored by the developer in the DB – Gives a ‘feeling’ of more security • If salted hash is stored as password, then salt too needs to be stored ☺ • Hence same salt is sent each time - replay
  • 18. 4. Not re-initializing the salt for login pages • Multiple logins from the same browser resulted in same salt being used • Salt not deleted from the server side on successful or unsuccessful authentication • Problem is also related to not re-initializing the session after successful or unsuccessful authentication • Attack window is small, but still…
  • 19. 5. Transmitting clear text password along with salted hash • Many implementations observed • The salted hash is sent along with clear text form input fields • The salted hash is computed using different set of hidden variables
  • 20. Transmitting clear text along with salted hash
  • 21. 6. Not re-initializing the java script variables • Uname = Document.form1.textbox1.value • Pwd = Document.form1.textbox2.value • Use the and ‘pwd’ variable for salted hash calculation – Hash = Hfx (pwd) – Hash = Hfx (Hash + salt) • The uname and pwd can be found as clear text in memory
  • 22. Not re-initializing the java script variables
  • 23. 7. Storing password in clear text in database • Hash = hash (password + salt) • Server does not store salt in the database • Clearly implies that server also does not store hash of password in database
  • 24. Salted Hash Best Practices • Salt – Generated on server side – Must be highly random. Must use cryptographically strong PRNG algorithm – Must never be stored in the database – Must be re-generated after each successful /unsuccessful attempt – All temporary Form Field or JS variables must be set to null before submitting the request • Passwords must be stored in hashed format in the database
  • 25. CAPTCHA • Completely Automated Public Turing Tests to Tell Computers and Humans Apart • Aim is to introduce an entity that requires human intervention • Protection against DOS or Brute force or Misuse – Avoiding automating submissions
  • 26. Typical uses • Public Forms – Registration – Feedback / Rating – Survey – Blog post – Appointment/Slot booking
  • 27. CAPTCHA - Implementation • Initiate a session for the page rendered • Request for image • Generate unique string randomly on server side • Generate image with string embedded • Remember the string in Session Object and send CAPTCHA to client • For each client request, validate the sent value with the one in the session object • Invalidate session after each attempt – Both successful and unsuccessful • Generate new CAPTCHA for each new page request
  • 28. Insecure Implementation • We are not focusing weakness of CAPTCHA generation – It’s a different ball game • We will discuss common implementation flaws of using CAPTCHA’s
  • 29. 1. Verifying CAPTCHA on client side • The client side JavaScript verifies the CAPTCHA value • Server trusts the decision of client strPassFlag=True; • Completely bypass enforcement • Automate submission
  • 30. 2. Having a limited set words • Small fixed pool of CAPTCHA words • Automated tools will have high probability of hits • Bypass goal of implementing CAPTCHA
  • 31. What better than a COMBO Limited pool of CAPTCHA values with client side verification
  • 32. 3. Validate CAPTCHA on server but value sent from client • Actual value of CAPTCHA sent as hidden variable – Hmmmmm, “hidden” does not mean “secure” • Replay request with value of our choice
  • 33. 4. Session is not re-initialized • Session not re-initialized after form submission • Refresh on submitted page works • Automate replay of requests using assigned session ID • Multiple registrations – Treasure trove for spammers
  • 34. 5. Image ID can be replayed • The request for image is of the form • <img src = http://www.testserver.com/image_draw.jsp?I D=23erdfret45ffrsd4g3fd3sa3a4d5a • The image_draw.jsp decrypts the value to get the word • For the same value the same word is rendered ALWAYS • Replay image request
  • 35. Image ID can be replayed Server Client Step#1: Request for Public FORM Step#2: Form with <img src=http://…/image_draw.php?id=X1> Step#4: Generate an image Step#3: Request for Image based on unique token (X1) & store in the session object. Step#5: Form rendered with image Step#7: Validation with string Step#6: FORM Submission stored in the session object. • Step 2 can be replayed
  • 36. 6. CAPTCHA is not an image • One application had a ‘feeling’ of an image • Java Script used for rendering the text on the page in a “different” font • Tools can read such text easily Text can be selected ☺
  • 37. CAPTCHA implementation best practices CAPTCHA: – Generated on server side – Verified on server side – Strings must be randomly generated – Images must not be generated based on token from ‘hidden’ client side – Must be bound to a session – Must be re-generated after each successful /unsuccessful attempt
  • 38. Caching Issues • Unauthorized access to information User CC No User Name SB Account No Logged off Back Password Submit Submit Sign In Sign Out Thank You Account Details Login
  • 39. Browser Cache • A local store – Aims to improve performance – Renders pages locally, fast user experience – Support across browsers • Controlled by a lot many directives – Pragma: no-cache – Cache-control: no-cache – Expires: Mon, 03 Jul 2000 9:30:41 GMT
  • 40. Caching • Relevant HTTP fields • Request o If-Modified-Since o Pragma: no-cache Response • o Last-Modified o Expires: Mon, 03 Apr 2009 9:30:41 GMT o Cache-Control: no-cache, no-store
  • 41. Caching • Relevant HTTP fields • Request o If-Modified-Since – Recheck for fresh content o Pragma: no-cache – HTTP 1.0 Response • o Last-Modified – Confirm fresh content o Expires: ………… – HTTP 1.0 o Cache-Control: no-cache – Pages will not be displayed, but will still be stored o Cache-Control: no-store – Pages will not be stored
  • 42. Caching best practice • For critical applications • Cache-Control: no-cache and Cache- Control: no-store must be set for ALL pages
  • 43. Example Implementation flaw • Banking application – Ideally all pages must be fetched fresh – Clicking on ‘back’ must not render page – All pages set with Cache-Control: no-cache, no-store – excepting logout page – On logout, an intermediate proxy used to serve logout page – Session was not invalidated as request did not reach server