SlideShare una empresa de Scribd logo
1 de 73
Descargar para leer sin conexión
CNIT 129S: Securing
Web Applications
Ch 6: Attacking Authentication
Updated 2-25-2021
Authentication Technologies
• Over 90% of apps use name & password
More Secure Methods
• Two-factor authentication
(or more
)

• PIN from a token, SMS
message, or mobile ap
p

• In addition to a
passwor
d

• Submitted through an
HTML form
Cryptographic Methods
• Client-side SSL certi
fi
cat
e

• Smartcard
s

• More expensive, higher overhead
HTTP Authentication
• Basic, Digest, and Windows-integrate
d

• Rarely used on the Interne
t

• More common in intranets, especially Windows
domain
s

• So authenticated employees can easily
access secured resources
Third-Party Authentication
Third-Party Authentication
Link Ch 6b
Third-Party Authentication
Design Flaws
• Bad Passwords
Brute-Force Attacks
• Strictly, "brute force" refers to
trying every possible combination
of character
s

• Very slo
w

• In practice, attackers use lists of
common password
s

• Defense: account lockout rules
after too many failed login
attempts
Poor Attempt Counters
• Cookie containing failedlogins=
1

• Failed login counter held within the current
sessio
n

• Attacker can just withhold the session cookie
to defeat thi
s

• Sometimes a page continues to provide
information about a password's correctness
even after account lockout
Insecure Lockout
Verbose Failure Messages
• Friendly for legitimate user
s

• But helpful for attackers
Script to Find Phone #s
• echo $1,`curl -d
"customerEmailAddress=$1" "https://
www.att.com/olam/
submitSLIDEmailForgotIdSlid.myworld"
-silent| grep -Po '(?<=provided ()d*'
`

• When you run


getatt.sh john.smith@example.com


it will output a line of text that looks like:


• john.smith@example.com,678234567
8

• Link Ch 6d
Username Importance
• Attacks that reveal valid usernames are called
"username enumeration
"

• Not as bad as
fi
nding a password, but still a
privacy intrusio
n

• But could be used for social engineering
attacks, such as spearphishing emails
Similar but Non-Identical
Error Messages
• Any difference can be exploited; even response
time
Demo
• Capture Hackazon login with invalid username and
password


• In Proxy, HTTP History, right-click POST and
Send to Comparer (Response)


• Repeat with valid username and invalid password


• On Comparer tab, compare Words
No Useful Differences
A
Vulnerable Transmission of
Credentials
• Eavesdroppers may reside:
HTTPS Risks
• If credentials are sent unencrypted, the
eavesdropper's task is trivial, but even HTTPS
can't prevent these risks
:

• Credentials sent in the query string are likely
to appear in server logs, browser history, and
logs of reverse proxie
s

• Many sites take credentials from a POST and
then redirect it (302) to another page with
credentials in the query string
HTTPS Risks
• Cookie risks
:

• Web apps may store credentials in cookie
s

• Even if cookies cannot be decrypted, they can
be re-use
d

• Many pages open a login page via HTTP and
use an HTTPS request in the for
m

• This can be defeated by a man-in-the-middle
attack, like sslstrip
Password Change
Functionality
• Periodic password change mitigates the threat
of password compromise (a dubious claim
)

• Users need to change their passwords when
they believe them to be compromised
Vulnerable Password
Change Systems
• Reveal whether the requested username is vali
d

• Allow unrestricted guesses of the "existing
password"
fi
el
d

• Validate the "existing password"
fi
eld before
comparing the "new password" and "con
fi
rm
new password"
fi
eld
s

• So an attacker can test passwords without
making any actual change
Password Change Decision
Tree
• Identify the use
r

• Validate "existing password
"

• Integrate with any account lockout feature
s

• Compare the new passwords with each other
and against password quality rule
s

• Feed back any error conditions to the use
r

• Often there are subtle logic
fl
aws
Forgotten Password
Functionality
• Often the weakest lin
k

• Uses a secondary challenge, like "mother's
maiden name
"

• A small set of possible answers, can be brute-
force
d

• Often can be found from public information
Forgotten Password
Functionality
• Often users can write their own question
s

• Attackers can try a long list of username
s

• Seeking a really weak question, like "Do I own
a boat?
"

• Password "Hints" are often obvious
Forgotten Password
Functionality
• Often the mechanism used to reset the
password after a correct challenge answer is
vulnerabl
e

• Some apps disclose the forgotten password to
the user, so an attacker can use the account
without the owner knowin
g

• Some applications immediately let the user in
after the challenge--no password needed
Forgotten Password
Functionality
• Some apps allow the user to specify an email
for the password reset link at the time the
challenge is complete
d

• Or use email from a hidden
fi
eld or cooki
e

• Some apps allow a password reset and don't
notify the user with an email
"Remember Me"
• Sometimes a simple persistent cookie, like
 

• RememberUser=jsmit
h

• Session=72
8

• No need to actually log in, if username or
session ID can be guessed or found
"Remember Me"
• Even if the userid or session token is properly
encrypted, it can be stolen via XSS or by getting
access to a user's phone or PC
User Impersonation
• Sometimes help desk personnel or other
special accounts can impersonate user
s

• This may have
fl
aws lik
e

• Implemented with a "hidden" function
lacking proper access controls, such as
 

• /admin/ImpersonateUser.js
p

• A guessable session numbe
r

• A
fi
xed backdoor password
Incomplete Validation
• Some applications
truncate passwords
without telling user
s

• Also strip unusual
character
s

• Link Ch 6e
Nonunique Usernames
• Rare but it happen
s

• You may be able to create a new account with
the same username as an existing accoun
t

• During registration or a password chang
e

• If the password also matches, you can detect
that from a different error messge
Predictable Usernames
• Automatically generated names lik
e

• User101, User102, ...
Predictable Initial Passwords
• User accounts are create in large batche
s

• All have the same initial password
Insecure Distribution of
Credentials
• Passwords sent by email, SMS, etc
.

• Users may never change those credential
s

• Activation URLs may be predictabl
e

• Some apps email the new password to the user
after each password change
B
Implementation Flaws
Fail-Open Login
• Blank or invalid username may cause an
exception in the login routin
e

• Or very long or short value
s

• Or letters where numbers are expected..
.

• And allow the user in
Multistage Login
• Enter username and passwor
d

• Enter speci
fi
c digits from a PIN (a CAPTCHA
)

• Enter value displayed on a token
Multistage Login Defects
• May allow user to skip step
s

• May trust data that passes step one, but let user
change it, so invaid or locked-out accounts
remain availabl
e

• May assume that the same username applies to
all three stages but not verify this
Multistage Login Defects
• May use a randomly-chosen question to verify
the use
r

• But let the attacker alter that question in a
hidden HTML
fi
eld or cooki
e

• Or allow many requests, so attacker can choose
an easy question
Insecure Credential Storage
• Plaintext passwords in databas
e

• Hashed with MD5 or SHA-1, easily cracked
Securing Authentication
• Consideration
s

• How critical is security
?

• Will users tolerate inconvenient controls
?

• Cost of supporting a user-unfriendly syste
m

• Cost of alternatives, compare to revenue
generated or value of assets
Strong Credentials
• Minimum password length, requiring
alphabetical, numeric, and typographic
character
s

• Avoiding dictionary words, password same as
username, re-use of old password
s

• Usernames should be uniqu
e

• Automatically generated usernames or
passwords should be long and random, so they
cannot be guessed or predicte
d

• Allow users to set strong passwords
TED iOS App
• Bad password list, part of React.js
Handle Credentials
Secretively
• Protect them when created, stored, and
transmitte
d

• Use well-established cryptography like SSL, not
custom method
s

• Whole login page should be HTTPS, not just the
login butto
n

• Use POST rather than GE
T

• Don't put credentials in URL parameters or
cookies
Handle Credentials
Secretively
• Don't transmit credentials back to the client,
even in parameters to a redirec
t

• Securely hash credentials on the server
Hashing
• Password hashes must be salted and stretche
d

• Salt: add random bytes to the password before
hashing i
t

• Stretched: many rounds of hashing (Kali Linux 2
uses 5000 rounds of SHA-512)
Handle Credentials
Secretively
• Client-side "remember me" functionality should
remember only nonsecret items such as
username
s

• If you allow users to store passwords locally,
they should be reversibly encrypted with a key
known only to the serve
r

• And make sure there are no XSS
vulnerabilities
Handle Credentials
Secretively
• Force users to change passwords periodicall
y

• Credentials for new users should be sent as
securely as possible and time-limited; force
password change on
fi
rst logi
n

• Capture some login information with drop-down
lists instead of text
fi
elds, to defeat keyloggers
Validate Credentials
Properly
• Validate entire credential, with case sensitivit
y

• Terminate the session on any exceptio
n

• Review authentication logic and cod
e

• Strictly control user impersonation
Multistage Login
• All data about progress and the results of
previous validation tasks should be held in the
server-side session object and never available
to the clien
t

• No item of information should be submitted
more than once by the use
r

• No means for the user to modify data after
submission
Multistage Login
• The
fi
rst task at every stage should be to verify
that all prior stages have been correctly
complete
d

• Always proceed through all stages, even if the
fi
rst stage fails--don't give attacker any
information about which stage failed
Prevent Information Leakage
• All authentication failures should use the same
code to produce the same error messag
e

• To avoid subtle differences that leak
informatio
n

• Account lockout can be used for username
enumeratio
n

• Login attempts with invalid usernames should
lead to the same error messages as valid
ones
Self-Registration
• Allowing users to choose usernames permits
username enumeration. Better methods
:

• Generate unique, unpredictable username
s

• Use e-mail addresses as usernames and
require the user to receive and use an email
message
Prevent Brute-Force Attacks
• At login, password change, recover lost password,
etc
.

• Using unpredictable usernames and preventing their
enumeration makes brute-force attacks more dif
fi
cul
t

• High-security apps like banks disable an account
after several failed login
s

• Account holder must do something out-of-band to
re-activate account, like phone customer support
and answer security question
s

• A 30-minute delay is friendlier and cheaper
Prevent Brute-Force Attacks
• Password Spray attac
k

• Use many different usernames with the same
password, such as "password
"

• Avoids account lockout
s

• Defenses: strong password rules, CAPTCHA
Password Change
• No way to change usernam
e

• Require user to enter the old passwor
d

• Require new password twice (to prevent
mistakes
)

• Same error message for all failure
s

• Users should be noti
fi
ed out-of-band (such as
via email) that the password has been changed
Account Recovery
• For security-critical apps, require account
recovery out-of-ban
d

• Don't use "password hints
"

• Email a unique, time-limited, unguessable,
single-use recovery URL
Account Recovery
• Challenge question
s

• Don't let users write their own question
s

• Don't use questions with low-entropy
answers, such as "your favorite color"
Log, Monitor, and Notify
• Log all authentication-related event
s

• Protect logs from unauthorized acces
s

• Anomalies such as brute-force attacks should
trigger IDS alert
s

• Notify users out-of-band of any critical security
events, such as password change
s

• Notify users in-band of frequent security events,
such as time and source IP of the last login
C

Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

CNIT 129S: Ch 4: Mapping the Application
CNIT 129S: Ch 4: Mapping the ApplicationCNIT 129S: Ch 4: Mapping the Application
CNIT 129S: Ch 4: Mapping the Application
 
CNIT 129S: Ch 5: Bypassing Client-Side Controls
CNIT 129S: Ch 5: Bypassing Client-Side ControlsCNIT 129S: Ch 5: Bypassing Client-Side Controls
CNIT 129S: Ch 5: Bypassing Client-Side Controls
 
CNIT 129S: Ch 3: Web Application Technologies
CNIT 129S: Ch 3: Web Application TechnologiesCNIT 129S: Ch 3: Web Application Technologies
CNIT 129S: Ch 3: Web Application Technologies
 
CNIT 129S: Ch 6: Attacking Authentication
CNIT 129S: Ch 6: Attacking AuthenticationCNIT 129S: Ch 6: Attacking Authentication
CNIT 129S: Ch 6: Attacking Authentication
 
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
 
CNIT 129S: Securing Web Applications Ch 1-2
CNIT 129S: Securing Web Applications Ch 1-2CNIT 129S: Securing Web Applications Ch 1-2
CNIT 129S: Securing Web Applications Ch 1-2
 
CNIT 129S Ch 7: Attacking Session Management
CNIT 129S Ch 7: Attacking Session ManagementCNIT 129S Ch 7: Attacking Session Management
CNIT 129S Ch 7: Attacking Session Management
 
CNIT 129S: 13: Attacking Users: Other Techniques (Part 2 of 2)
CNIT 129S: 13: Attacking Users: Other Techniques (Part 2 of 2)CNIT 129S: 13: Attacking Users: Other Techniques (Part 2 of 2)
CNIT 129S: 13: Attacking Users: Other Techniques (Part 2 of 2)
 
CNIT 129S: 8: Attacking Access Controls
CNIT 129S: 8: Attacking Access ControlsCNIT 129S: 8: Attacking Access Controls
CNIT 129S: 8: Attacking Access Controls
 
Ch 1: Web Application (In)security & Ch 2: Core Defense Mechanisms
Ch 1: Web Application (In)security & Ch 2: Core Defense Mechanisms Ch 1: Web Application (In)security & Ch 2: Core Defense Mechanisms
Ch 1: Web Application (In)security & Ch 2: Core Defense Mechanisms
 
CNIT 129S: 10: Attacking Back-End Components
CNIT 129S: 10: Attacking Back-End ComponentsCNIT 129S: 10: Attacking Back-End Components
CNIT 129S: 10: Attacking Back-End Components
 
CNIT 129S: 11: Attacking Application Logic
CNIT 129S: 11: Attacking Application LogicCNIT 129S: 11: Attacking Application Logic
CNIT 129S: 11: Attacking Application Logic
 
CNIT 129S: 12: Attacking Users: Cross-Site Scripting (Part 2 of 3)
CNIT 129S: 12: Attacking Users: Cross-Site Scripting (Part 2 of 3)CNIT 129S: 12: Attacking Users: Cross-Site Scripting (Part 2 of 3)
CNIT 129S: 12: Attacking Users: Cross-Site Scripting (Part 2 of 3)
 
5. Identity and Access Management
5. Identity and Access Management5. Identity and Access Management
5. Identity and Access Management
 
Ch 10: Hacking Web Servers
Ch 10: Hacking Web ServersCh 10: Hacking Web Servers
Ch 10: Hacking Web Servers
 
CNIT 129S: 9: Attacking Data Stores (Part 2 of 2)
CNIT 129S: 9: Attacking Data Stores (Part 2 of 2)CNIT 129S: 9: Attacking Data Stores (Part 2 of 2)
CNIT 129S: 9: Attacking Data Stores (Part 2 of 2)
 
CNIT 129S: Ch 12: Attacking Users: Cross-Site Scripting
CNIT 129S: Ch 12: Attacking Users: Cross-Site ScriptingCNIT 129S: Ch 12: Attacking Users: Cross-Site Scripting
CNIT 129S: Ch 12: Attacking Users: Cross-Site Scripting
 
CNIT 123 Ch 10: Hacking Web Servers
CNIT 123 Ch 10: Hacking Web ServersCNIT 123 Ch 10: Hacking Web Servers
CNIT 123 Ch 10: Hacking Web Servers
 
Ch 6: Attacking Authentication
Ch 6: Attacking AuthenticationCh 6: Attacking Authentication
Ch 6: Attacking Authentication
 
Core defense mechanisms against security attacks on web applications
Core defense mechanisms against security attacks on web applicationsCore defense mechanisms against security attacks on web applications
Core defense mechanisms against security attacks on web applications
 

Similar a CNIT 129: 6. Attacking Authentication

Shiny, Let’s Be Bad Guys: Exploiting and Mitigating the Top 10 Web App Vulner...
Shiny, Let’s Be Bad Guys: Exploiting and Mitigating the Top 10 Web App Vulner...Shiny, Let’s Be Bad Guys: Exploiting and Mitigating the Top 10 Web App Vulner...
Shiny, Let’s Be Bad Guys: Exploiting and Mitigating the Top 10 Web App Vulner...
Michael Pirnat
 

Similar a CNIT 129: 6. Attacking Authentication (20)

Shiny, Let’s Be Bad Guys: Exploiting and Mitigating the Top 10 Web App Vulner...
Shiny, Let’s Be Bad Guys: Exploiting and Mitigating the Top 10 Web App Vulner...Shiny, Let’s Be Bad Guys: Exploiting and Mitigating the Top 10 Web App Vulner...
Shiny, Let’s Be Bad Guys: Exploiting and Mitigating the Top 10 Web App Vulner...
 
Ch 13: Attacking Users: Other Techniques (Part 2)
Ch 13: Attacking Users: Other Techniques (Part 2)Ch 13: Attacking Users: Other Techniques (Part 2)
Ch 13: Attacking Users: Other Techniques (Part 2)
 
Logical Attacks(Vulnerability Research)
Logical Attacks(Vulnerability Research)Logical Attacks(Vulnerability Research)
Logical Attacks(Vulnerability Research)
 
Ch 7: Attacking Session Management
Ch 7: Attacking Session ManagementCh 7: Attacking Session Management
Ch 7: Attacking Session Management
 
Presentation on Web Attacks
Presentation on Web AttacksPresentation on Web Attacks
Presentation on Web Attacks
 
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
 
Attacking Web Applications
Attacking Web ApplicationsAttacking Web Applications
Attacking Web Applications
 
Defending web applications v.1.0
Defending web applications v.1.0Defending web applications v.1.0
Defending web applications v.1.0
 
Flaws of password-based authentication
Flaws of password-based authenticationFlaws of password-based authentication
Flaws of password-based authentication
 
Web security uploadv1
Web security uploadv1Web security uploadv1
Web security uploadv1
 
OWASP Top 10 Web Vulnerabilities from DCC 04/14
OWASP Top 10 Web Vulnerabilities from DCC 04/14OWASP Top 10 Web Vulnerabilities from DCC 04/14
OWASP Top 10 Web Vulnerabilities from DCC 04/14
 
Presentation on Top 10 Vulnerabilities in Web Application
Presentation on Top 10 Vulnerabilities in Web ApplicationPresentation on Top 10 Vulnerabilities in Web Application
Presentation on Top 10 Vulnerabilities in Web Application
 
Two-factor Authentication
Two-factor AuthenticationTwo-factor Authentication
Two-factor Authentication
 
CISSP Prep: Ch 6. Identity and Access Management
CISSP Prep: Ch 6. Identity and Access ManagementCISSP Prep: Ch 6. Identity and Access Management
CISSP Prep: Ch 6. Identity and Access Management
 
Rest API Security
Rest API SecurityRest API Security
Rest API Security
 
Complete Guide to Setup Secure Scheme for Restful APIs
Complete Guide to Setup Secure Scheme for Restful APIsComplete Guide to Setup Secure Scheme for Restful APIs
Complete Guide to Setup Secure Scheme for Restful APIs
 
Ruby on Rails Security Guide
Ruby on Rails Security GuideRuby on Rails Security Guide
Ruby on Rails Security Guide
 
Secure electronic transaction
Secure electronic transactionSecure electronic transaction
Secure electronic transaction
 
CNIT 125 6. Identity and Access Management
CNIT 125 6. Identity and Access ManagementCNIT 125 6. Identity and Access Management
CNIT 125 6. Identity and Access Management
 
Authentication Methods authauthauthauthauthautha
Authentication Methods authauthauthauthauthauthaAuthentication Methods authauthauthauthauthautha
Authentication Methods authauthauthauthauthautha
 

Más de Sam Bowne

Más de Sam Bowne (20)

Cyberwar
CyberwarCyberwar
Cyberwar
 
3: DNS vulnerabilities
3: DNS vulnerabilities 3: DNS vulnerabilities
3: DNS vulnerabilities
 
8. Software Development Security
8. Software Development Security8. Software Development Security
8. Software Development Security
 
4 Mapping the Application
4 Mapping the Application4 Mapping the Application
4 Mapping the Application
 
3. Attacking iOS Applications (Part 2)
 3. Attacking iOS Applications (Part 2) 3. Attacking iOS Applications (Part 2)
3. Attacking iOS Applications (Part 2)
 
12 Elliptic Curves
12 Elliptic Curves12 Elliptic Curves
12 Elliptic Curves
 
11. Diffie-Hellman
11. Diffie-Hellman11. Diffie-Hellman
11. Diffie-Hellman
 
2a Analyzing iOS Apps Part 1
2a Analyzing iOS Apps Part 12a Analyzing iOS Apps Part 1
2a Analyzing iOS Apps Part 1
 
9 Writing Secure Android Applications
9 Writing Secure Android Applications9 Writing Secure Android Applications
9 Writing Secure Android Applications
 
12 Investigating Windows Systems (Part 2 of 3)
12 Investigating Windows Systems (Part 2 of 3)12 Investigating Windows Systems (Part 2 of 3)
12 Investigating Windows Systems (Part 2 of 3)
 
10 RSA
10 RSA10 RSA
10 RSA
 
12 Investigating Windows Systems (Part 1 of 3
12 Investigating Windows Systems (Part 1 of 312 Investigating Windows Systems (Part 1 of 3
12 Investigating Windows Systems (Part 1 of 3
 
9. Hard Problems
9. Hard Problems9. Hard Problems
9. Hard Problems
 
8 Android Implementation Issues (Part 1)
8 Android Implementation Issues (Part 1)8 Android Implementation Issues (Part 1)
8 Android Implementation Issues (Part 1)
 
11 Analysis Methodology
11 Analysis Methodology11 Analysis Methodology
11 Analysis Methodology
 
8. Authenticated Encryption
8. Authenticated Encryption8. Authenticated Encryption
8. Authenticated Encryption
 
7. Attacking Android Applications (Part 2)
7. Attacking Android Applications (Part 2)7. Attacking Android Applications (Part 2)
7. Attacking Android Applications (Part 2)
 
7. Attacking Android Applications (Part 1)
7. Attacking Android Applications (Part 1)7. Attacking Android Applications (Part 1)
7. Attacking Android Applications (Part 1)
 
5. Stream Ciphers
5. Stream Ciphers5. Stream Ciphers
5. Stream Ciphers
 
6 Scope & 7 Live Data Collection
6 Scope & 7 Live Data Collection6 Scope & 7 Live Data Collection
6 Scope & 7 Live Data Collection
 

Último

Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
Chris Hunter
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 

Último (20)

Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Role Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxRole Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptx
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 

CNIT 129: 6. Attacking Authentication

  • 1. CNIT 129S: Securing Web Applications Ch 6: Attacking Authentication Updated 2-25-2021
  • 2. Authentication Technologies • Over 90% of apps use name & password
  • 3. More Secure Methods • Two-factor authentication (or more ) • PIN from a token, SMS message, or mobile ap p • In addition to a passwor d • Submitted through an HTML form
  • 4. Cryptographic Methods • Client-side SSL certi fi cat e • Smartcard s • More expensive, higher overhead
  • 5. HTTP Authentication • Basic, Digest, and Windows-integrate d • Rarely used on the Interne t • More common in intranets, especially Windows domain s • So authenticated employees can easily access secured resources
  • 9.
  • 10. Design Flaws • Bad Passwords
  • 11.
  • 12. Brute-Force Attacks • Strictly, "brute force" refers to trying every possible combination of character s • Very slo w • In practice, attackers use lists of common password s • Defense: account lockout rules after too many failed login attempts
  • 13.
  • 14.
  • 15. Poor Attempt Counters • Cookie containing failedlogins= 1 • Failed login counter held within the current sessio n • Attacker can just withhold the session cookie to defeat thi s • Sometimes a page continues to provide information about a password's correctness even after account lockout
  • 17.
  • 18.
  • 19. Verbose Failure Messages • Friendly for legitimate user s • But helpful for attackers
  • 20.
  • 21. Script to Find Phone #s • echo $1,`curl -d "customerEmailAddress=$1" "https:// www.att.com/olam/ submitSLIDEmailForgotIdSlid.myworld" -silent| grep -Po '(?<=provided ()d*' ` • When you run 
 getatt.sh john.smith@example.com 
 it will output a line of text that looks like: • john.smith@example.com,678234567 8 • Link Ch 6d
  • 22. Username Importance • Attacks that reveal valid usernames are called "username enumeration " • Not as bad as fi nding a password, but still a privacy intrusio n • But could be used for social engineering attacks, such as spearphishing emails
  • 23. Similar but Non-Identical Error Messages • Any difference can be exploited; even response time
  • 24. Demo • Capture Hackazon login with invalid username and password • In Proxy, HTTP History, right-click POST and Send to Comparer (Response) • Repeat with valid username and invalid password • On Comparer tab, compare Words
  • 26. A
  • 27. Vulnerable Transmission of Credentials • Eavesdroppers may reside:
  • 28. HTTPS Risks • If credentials are sent unencrypted, the eavesdropper's task is trivial, but even HTTPS can't prevent these risks : • Credentials sent in the query string are likely to appear in server logs, browser history, and logs of reverse proxie s • Many sites take credentials from a POST and then redirect it (302) to another page with credentials in the query string
  • 29. HTTPS Risks • Cookie risks : • Web apps may store credentials in cookie s • Even if cookies cannot be decrypted, they can be re-use d • Many pages open a login page via HTTP and use an HTTPS request in the for m • This can be defeated by a man-in-the-middle attack, like sslstrip
  • 30.
  • 31. Password Change Functionality • Periodic password change mitigates the threat of password compromise (a dubious claim ) • Users need to change their passwords when they believe them to be compromised
  • 32. Vulnerable Password Change Systems • Reveal whether the requested username is vali d • Allow unrestricted guesses of the "existing password" fi el d • Validate the "existing password" fi eld before comparing the "new password" and "con fi rm new password" fi eld s • So an attacker can test passwords without making any actual change
  • 33. Password Change Decision Tree • Identify the use r • Validate "existing password " • Integrate with any account lockout feature s • Compare the new passwords with each other and against password quality rule s • Feed back any error conditions to the use r • Often there are subtle logic fl aws
  • 34. Forgotten Password Functionality • Often the weakest lin k • Uses a secondary challenge, like "mother's maiden name " • A small set of possible answers, can be brute- force d • Often can be found from public information
  • 35. Forgotten Password Functionality • Often users can write their own question s • Attackers can try a long list of username s • Seeking a really weak question, like "Do I own a boat? " • Password "Hints" are often obvious
  • 36. Forgotten Password Functionality • Often the mechanism used to reset the password after a correct challenge answer is vulnerabl e • Some apps disclose the forgotten password to the user, so an attacker can use the account without the owner knowin g • Some applications immediately let the user in after the challenge--no password needed
  • 37. Forgotten Password Functionality • Some apps allow the user to specify an email for the password reset link at the time the challenge is complete d • Or use email from a hidden fi eld or cooki e • Some apps allow a password reset and don't notify the user with an email
  • 38. "Remember Me" • Sometimes a simple persistent cookie, like • RememberUser=jsmit h • Session=72 8 • No need to actually log in, if username or session ID can be guessed or found
  • 39. "Remember Me" • Even if the userid or session token is properly encrypted, it can be stolen via XSS or by getting access to a user's phone or PC
  • 40. User Impersonation • Sometimes help desk personnel or other special accounts can impersonate user s • This may have fl aws lik e • Implemented with a "hidden" function lacking proper access controls, such as • /admin/ImpersonateUser.js p • A guessable session numbe r • A fi xed backdoor password
  • 41. Incomplete Validation • Some applications truncate passwords without telling user s • Also strip unusual character s • Link Ch 6e
  • 42. Nonunique Usernames • Rare but it happen s • You may be able to create a new account with the same username as an existing accoun t • During registration or a password chang e • If the password also matches, you can detect that from a different error messge
  • 43. Predictable Usernames • Automatically generated names lik e • User101, User102, ...
  • 44. Predictable Initial Passwords • User accounts are create in large batche s • All have the same initial password
  • 45. Insecure Distribution of Credentials • Passwords sent by email, SMS, etc . • Users may never change those credential s • Activation URLs may be predictabl e • Some apps email the new password to the user after each password change
  • 46. B
  • 48. Fail-Open Login • Blank or invalid username may cause an exception in the login routin e • Or very long or short value s • Or letters where numbers are expected.. . • And allow the user in
  • 49. Multistage Login • Enter username and passwor d • Enter speci fi c digits from a PIN (a CAPTCHA ) • Enter value displayed on a token
  • 50. Multistage Login Defects • May allow user to skip step s • May trust data that passes step one, but let user change it, so invaid or locked-out accounts remain availabl e • May assume that the same username applies to all three stages but not verify this
  • 51. Multistage Login Defects • May use a randomly-chosen question to verify the use r • But let the attacker alter that question in a hidden HTML fi eld or cooki e • Or allow many requests, so attacker can choose an easy question
  • 52. Insecure Credential Storage • Plaintext passwords in databas e • Hashed with MD5 or SHA-1, easily cracked
  • 53. Securing Authentication • Consideration s • How critical is security ? • Will users tolerate inconvenient controls ? • Cost of supporting a user-unfriendly syste m • Cost of alternatives, compare to revenue generated or value of assets
  • 54. Strong Credentials • Minimum password length, requiring alphabetical, numeric, and typographic character s • Avoiding dictionary words, password same as username, re-use of old password s • Usernames should be uniqu e • Automatically generated usernames or passwords should be long and random, so they cannot be guessed or predicte d • Allow users to set strong passwords
  • 55. TED iOS App • Bad password list, part of React.js
  • 56. Handle Credentials Secretively • Protect them when created, stored, and transmitte d • Use well-established cryptography like SSL, not custom method s • Whole login page should be HTTPS, not just the login butto n • Use POST rather than GE T • Don't put credentials in URL parameters or cookies
  • 57. Handle Credentials Secretively • Don't transmit credentials back to the client, even in parameters to a redirec t • Securely hash credentials on the server
  • 58. Hashing • Password hashes must be salted and stretche d • Salt: add random bytes to the password before hashing i t • Stretched: many rounds of hashing (Kali Linux 2 uses 5000 rounds of SHA-512)
  • 59.
  • 60. Handle Credentials Secretively • Client-side "remember me" functionality should remember only nonsecret items such as username s • If you allow users to store passwords locally, they should be reversibly encrypted with a key known only to the serve r • And make sure there are no XSS vulnerabilities
  • 61. Handle Credentials Secretively • Force users to change passwords periodicall y • Credentials for new users should be sent as securely as possible and time-limited; force password change on fi rst logi n • Capture some login information with drop-down lists instead of text fi elds, to defeat keyloggers
  • 62. Validate Credentials Properly • Validate entire credential, with case sensitivit y • Terminate the session on any exceptio n • Review authentication logic and cod e • Strictly control user impersonation
  • 63. Multistage Login • All data about progress and the results of previous validation tasks should be held in the server-side session object and never available to the clien t • No item of information should be submitted more than once by the use r • No means for the user to modify data after submission
  • 64. Multistage Login • The fi rst task at every stage should be to verify that all prior stages have been correctly complete d • Always proceed through all stages, even if the fi rst stage fails--don't give attacker any information about which stage failed
  • 65. Prevent Information Leakage • All authentication failures should use the same code to produce the same error messag e • To avoid subtle differences that leak informatio n • Account lockout can be used for username enumeratio n • Login attempts with invalid usernames should lead to the same error messages as valid ones
  • 66. Self-Registration • Allowing users to choose usernames permits username enumeration. Better methods : • Generate unique, unpredictable username s • Use e-mail addresses as usernames and require the user to receive and use an email message
  • 67. Prevent Brute-Force Attacks • At login, password change, recover lost password, etc . • Using unpredictable usernames and preventing their enumeration makes brute-force attacks more dif fi cul t • High-security apps like banks disable an account after several failed login s • Account holder must do something out-of-band to re-activate account, like phone customer support and answer security question s • A 30-minute delay is friendlier and cheaper
  • 68. Prevent Brute-Force Attacks • Password Spray attac k • Use many different usernames with the same password, such as "password " • Avoids account lockout s • Defenses: strong password rules, CAPTCHA
  • 69. Password Change • No way to change usernam e • Require user to enter the old passwor d • Require new password twice (to prevent mistakes ) • Same error message for all failure s • Users should be noti fi ed out-of-band (such as via email) that the password has been changed
  • 70. Account Recovery • For security-critical apps, require account recovery out-of-ban d • Don't use "password hints " • Email a unique, time-limited, unguessable, single-use recovery URL
  • 71. Account Recovery • Challenge question s • Don't let users write their own question s • Don't use questions with low-entropy answers, such as "your favorite color"
  • 72. Log, Monitor, and Notify • Log all authentication-related event s • Protect logs from unauthorized acces s • Anomalies such as brute-force attacks should trigger IDS alert s • Notify users out-of-band of any critical security events, such as password change s • Notify users in-band of frequent security events, such as time and source IP of the last login
  • 73. C