Some more on user- authentication. A web-page which requires that the user be logged-in Page is here:

Slides:



Advertisements
Similar presentations
MFA for Business Banking – Security Code Multifactor Authentication: Quick Tip Sheets Note to Financial Institutions: We are providing these QT sheets.
Advertisements

E-books and E-journals Off-campus This presentation will show you how to log in and access Oxford Brookes Library e-books and e-journals when youre off.
E-books and E-journals Off-campus This presentation will show you how to log in and access Oxford Brookes Library e-books and e-journals when youre off.
Installation & User Guide
CSC 386 – Computer Security Scott Heggen. Agenda Authentication Passwords Reducing the probability of a password being guessed Reducing the probability.
Digital Signatures and Hash Functions. Digital Signatures.
ATTACKING AUTHENTICATION The Web Application Hacker’s Handbook, Ch. 6 Presenter: Jie Huang 10/31/2012.
Chapter User authorization & safety Maciej Mensfeld Presented by: Maciej Mensfeld User authorization & safety dev.mensfeld.pl.
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation.
V 1.0 OE NIK 2013 PHP+SQL 5. Password management (password hashing) Stateless HTTP, storage methods Login form 1.
 Key exchange o Kerberos o Digital certificates  Certificate authority structure o PGP, hierarchical model  Recovery from exposed keys o Revocation.
Hashing (Message Digest) Hello There.
Cooperating Teachers: How to Reset Your Password in Tk20 Use this after your initial account set up if you cannot remember your TK20 password.
Cryptography and Network Security Chapter 11 Fifth Edition by William Stallings Lecture slides by Lawrie Brown.
Strong Password Protocols
Public Key Cryptography July Topics  Symmetric and Asymmetric Cryptography  Public Key Cryptography  Digital Signatures  Digital Certificates.
MS systems use one of the following: LanManager Hash (LM) LanManager Hash (LM) NT LanManager (NTLM) NT LanManager (NTLM) Cached passwords Cached passwords.
Lecture 6 – Form processing (Part 1) SFDV3011 – Advanced Web Development 1.
.Net Security and Performance -has security slowed down the application By Krishnan Ganesh Madras.
Lecture 7 – Form processing (Part 2) SFDV3011 – Advanced Web Development 1.
Session 11: Security with ASP.NET
Website Security ISYS 475. Authentication Authentication is the process that determines the identity of a user.
Create an online booking system (login/registration)
VPN AND SECURITY FLAWS Rajesh Perumal Clemson University.
Lecture 14 – Web Security SFDV3011 – Advanced Web Development 1.
8-1Network Security Chapter 8 roadmap 8.1 What is network security? 8.2 Principles of cryptography 8.3 Message integrity, authentication.
Dan Johnson. What is a hashing function? Fingerprint for a given piece of data Typically generated by a mathematical algorithm Produces a fixed length.
Dangers of the Internet CEL : C O M P U T E R S I N E V E R Y D A Y L I F E CEL 1 Dangers of the Internet Name: ____________________ Class: ________________.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 Securing a Microsoft ASP.NET Web Application.
David Evans CS150: Computer Science University of Virginia Computer Science Class 31: Cookie Monsters and Semi-Secure.
Sayed Ahmed Computer Engineering, BUET, Bangladesh MSc., Computer Science, Canada
Accessing MySQL with PHP IDIA 618 Fall 2014 Bridget M. Blodgett.
Encryption and Security Dylan Anderson Michael Huffman Julie Rothacher Dylan Anderson Michael Huffman Julie Rothacher.
Feedback #2 (under assignments) Lecture Code:
Chapter 6: Authentications. Training Course, CS, NCTU 2 Overview  Getting Username and Password  Verifying Username and Password  Keeping The Verification.
ITM © Port, Kazman1 ITM 352 More on Forms Processing.
SEC835 Runtime authentication Secure session management Secure use of cryptomaterials.
Broken Authentication & Session Management. What is it ? Bad implementation of authentication and session management. If an attacker can get your session.
6fb52297e004844aa81be d50cc3545bc Hashing!. Hashing  Group Activity 1:  Take the message you were given, and create your own version of hashing.  You.
Module 11: Securing a Microsoft ASP.NET Web Application.
Cookies and Sessions IDIA 618 Fall 2014 Bridget M. Blodgett.
CS 4244: Internet Programming Security 1.0. Introduction Client identification and cookies Basic Authentication Digest Authentication Secure HTTP.
MD5 ALGORITHM past and present. History Initial checking of integrity – checksums, then CRC These are only good at detecting lost information due to hardware.
Authentication Issues and Solutions CSCI 5857: Encoding and Encryption.
Authentication. Goal: Bob wants Alice to “prove” her identity to him Protocol ap1.0: Alice says “I am Alice” Failure scenario?? “I am Alice”
MEMBERSHIP AND IDENTITY Active server pages (ASP.NET) 1 Chapter-4.
ITM © Port, Kazman1 ITM 352 More on Forms Processing.
Identification Authentication. 2 Authentication Allows an entity (a user or a system) to prove its identity to another entity Typically, the entity whose.
PHP Secure Communications Web Technologies Computing Science Thompson Rivers University.
By Sandeep Gadi 12/20/  Design choices for securing a system affect performance, scalability and usability. There is usually a tradeoff between.
PPP Configuration.
Wireless Network Security By Simon Langford. About… This oral presentation is on wireless networks and the methods of security in use on them, in order.
© Copyright 2009 SSLPost 01. © Copyright 2009 SSLPost 02 a recipient is sent an encrypted that contains data specific to that recipient the data.
MD5 & Hash Encryption By Alex Buzak. Overview Purpose of MD5 and Hash Encryptions Examples MD5 Algorithm Explanation of Possible Security Risks Practical.
Dos and Don’ts of Client Authentication on the Web Kevin Fu, Emil Sit, Kendra Smith, Nick Feamster Presented: Jesus F. Morales.
COEN 350: Network Security E-Commerce Issues. Table of Content HTTP Authentication Cookies.
CSCI 530 Lab Passwords. Overview Authentication Passwords Hashing Breaking Passwords Dictionary Hybrid Brute-Force Rainbow Tables Detection.
Secure Transactions Chapter 17. The user's machine No control over security of user's machine –Might be in very insecure: library, school, &c. Users disable.
COOKIES AND SESSIONS.
LOGIN FORMS.
Unit 4 Working with data. Form Element HTML forms are used to pass data to a server. A form can contain input elements like text fields, checkboxes, radio-buttons,
Srinivas Balivada USC CSCE548 07/22/2016.  Cookies are generally set server-side using the ‘Set-Cookie’ HTTP header and sent to the client  In PHP to.
PPP – Point to Point Protocol
Using SSL – Secure Socket Layer
Web Systems Development (CSC-215)
PHP: Security issues FdSc Module 109 Server side scripting and
Outline Using cryptography in networks IPSec SSL and TLS.
Cookies and sessions Saturday, February 23, 2019Saturday, February 23,
CS5220 Advanced Topics in Web Programming Secure REST API
Chapter 8 roadmap 8.1 What is network security?
Presentation transcript:

Some more on user- authentication

A web-page which requires that the user be logged-in Page is here: User's login status is verified by sending a cookie <?php if ($_COOKIE["loginCookie"]) {?> This is secured content You can only see this content because you are logged in <?php } else {?> Access forbidden You cannot see secure content unless you are logged in. Login <?php } ?>

When user tries to see this page without being logged-in:

Suppose user clicks Login hotlink:

Suppose required username is bob and required password is dylan. Suppose user logs in correctly

User is told he has logged-in correctly and can now click on a link to go to the desired page

Suppose user clicks on link to front page He can now see the secured content

The login.php program In this simple program, only one user- name and password are accepted In reality, –there would be a database of user-names and passwords –different users would have different login cookies

The login.php program <?php ob_start(); if ((!$_POST["userName"]) || (!$_POST["password"])) {?> "> User name: Password: Login <?php } else {$userName=$_POST["userName"]; $password=$_POST["password"]; if (($userName=='bob') && ($password=='dylan')) {setcookie("loginCookie","$userName",time()+3600); ?> You are logged in for 60 minutes Click here for front page <?php } else {?> Incorrect username or password <?php } ob_end_flush(); ?>

What the cookie looks like in the cookie jar:

Danger with previous scheme Users' passwords are sent in the clear Somebody sniffing packets on the internet could steal a user's password Indeed, somebody could forge a cookie

Protecting passwords First, we will address the issue of protecting passwords Later, we will address the issue of protecting cookies

Encrypting passwords To avoid theft of passwords, we could require that, when they are sent over the internet, they are passed in encrypted form One commonly-user encryption technique is called MD5 We could send the MD5 encryptions of passwords over the internet For this, the login page would have to use MD5

MD5 MD5 is a hashing algorithm developed in 1991, when its predecessor, MD4, was found to be insecure In 1996, a flaw was found with the design of MD5; While it was not a clearly fatal weakness, cryptographers began to recommend using other algorithms, such as SHA-1 –recent claims suggest that SHA-1 has been broken, however) In 2004, more serious flaws were discovered making further use of the MD5 algorithm for security purposes questionable At present, however, MD5 is still widely used But expect it to be replaced in the near future

MD5 continued MD5 takes a string and returns a 128-bit hash value which is derived from the string Usually, these 128 bits are represented as 32 hex-digits MD5("The quick brown fox jumps over the lazy dog") = 9e107d9d372bb6826bd81d3542a419d6 Even a small change in the message will (with overwhelming probability) result in a completely different hash For example changing d to c in the above message produces MD5("The quick brown fox jumps over the lazy cog") = 1055d3e698d289f2af bd4b

Implementations of MD5 PHP –an implementation of MD5 is provided in the PHP library of string functions: string md5 ( string str ) Javascript: –no implementation of MD5 is built into the language; –however, an implementation is available in this file The function is called string hex_md5( string str )

login2.php (part 1) function encodePassword() {loginForm.password.value=hex_md5(loginForm.password.value); } <?php if ( (!$_POST["userName"]) || (!$_POST["password"]) ) {?> " > User name: Password: Login <?php }

login2.php (part 2) else {$userName=$_POST["userName"]; $password=$_POST["password"]; if ( ($userName=="bob") && ( $password== md5("dylan") ) ) { setcookie("loginCookie","bob",time()+3600); ?> You are logged in for 60 minutes Click here for front page <?php } else {?>Incorrect login <?php } } ob_end_flush(); ?>

This is better, but... Somebody who is sniffing packets could simply steal the MD5-encrypted password and use that

dec 2005

Make theft pointless There will always be packet-sniffing thieves The only defence against them is to make what they can steal worthless to them We can do this by making encoded passwords valid for only a short time We do this by using a nonce-word in such messages –a nonce word is 'a word coined and used only for a particular occasion'

login3.php (part 1) function encodePassword() {loginForm.password.value= hex_md5(loginForm.password.value+loginForm.nonceWord.value); } <?php if ( (!$_POST["userName"]) || (!$_POST["password"]) ) {$now=getdate(); $now=$now["year"].$now["month"].$now["mday"].$now["hours"].$now["minutes"]; $nonceWord=md5("someSecretWord".$now); ?><form name=loginForm method="post" action=" "> "> User name: Password: Login <?php }

login3.php (part 2) else { $userName=$_POST["userName"]; $password=$_POST["password"]; $nonceWord=$_POST["nonceWord"]; if ( ($userName=="bob") && ($password== md5("dylan".$nonceWord)) ) { setcookie("loginCookie","bob",time()+3600); ?> You are logged in for 60 minutes Click here for front page <?php } else {?>Incorrect login <?php } } ob_end_flush(); ?>

Can't someone just steal the nonce-word as well as the encrypted password ? Yes, but... The trick is to impose a time-limit on the acceptability of each nonce-word

login4.php (part 1) function encodePassword() {loginForm.password.value= hex_md5(loginForm.password.value+loginForm.nonceWord.value); } <?php function fresh($nonceWord) {$now=getdate(); $now=$now["year"].$now["month"].$now["mday"].$now["hours"].$now["minutes"]; $currentNonceWord=md5("someSecretWord".$now); if ($nonceWord == $currentNonceWord) { return 1; } else { return false; } }

login4.php (part 2) if ( (!$_POST["userName"]) || (!$_POST["password"]) ) {$now=getdate(); $now=$now["year"].$now["month"].$now["mday"].$now["hours"].$now["minutes"]; $nonceWord=md5("someSecretWord".$now); ?> <form name=loginForm method="post" action=" "> "> You have one minute to login User name: Password: <button type=button onClick="encodePassword();loginForm.submit();">Login <?php }

login4.php (part 3) else {$userName=$_POST["userName"]; $password=$_POST["password"]; $nonceWord=$_POST["nonceWord"]; if (fresh($nonceWord)) { if ( ($userName=="bob") && ($password== md5("dylan".$nonceWord)) ) { setcookie("loginCookie","bob",time()+3600); ?> You are logged in for 60 minutes Click here for front page <?php } else {?>Incorrect login <?php } } else {?> Unacceptable delay You took too long to fill in the login form ">Try again <?php } } ob_end_flush();?>

Login form produced by login4.php

User completes, within 1 minute, the form produced by login4.php

Because he filled form in correctly and quickly, user's credentials are accepted

A different, slower, user

He fills in form correctly, but too slowly

User's credentials are not accepted because the nonce word had become stale

But, couldn't someone just steal the cookie? Yes, but similarly MD5 encryption and nonce-words can be used to reduce the usefulness of stealing cookies However, at this stage, it might be worthwhile considering the use of SSL

Back to HTTP user- authentication

What’s wrong with Basic authentication? Basic authentication is insecure The username and password are sent unencrypted across the internet Anybody who is “sniffing” packets can steal this information

Digest Authentication In this technique, the password is never sent “in the clear” It is always sent in an encrypted form At present, the form of encryption used is called MD5 The technique is similar to that which we have just seen used in our home-made login system