SlideShare a Scribd company logo
ProtectingYour Users’ Privacy
@_aijaz_
ProtectingYour Users’ Privacy
@_aijaz_
Password Data on Remote Servers
Two Simple Things
Protecting Your Clients' Privacy
Survive
Protecting Your Clients' Privacy
SELECT * FROM USERTABLE
WHERE login = ‘admin’
AND password = ‘secret’
secret
$2a$07$Me1Q2TCPPce0oiUZ6IlJIQ3td4OKz/Pow2G
One Way Hash Algorithm
$2a$07$Me1Q2TC6IlJIQ3td4OKz/Pow2G
SELECT * FROM USERTABLE
WHERE login = ‘admin’
AND password=crypt(‘secret’, password)
Modern databases support many kinds of hashes.
Salts
Login: aijaz@example.com
Password: ‘hello’
Salt: 23ddkc
Hash: $2a$05$23ddkc20ker0998Q...
Login: dave@example.com
Password: ‘hello’
Salt: Zff7dk
Hash: $2a$05$Zff7dkf93kNSqnzC...
Use Random Salts
aijaz@example.com | ab287efee2876aa...
dave@example.com | ab287efee2876aa...
...
alice@example.com | ab287efee2876aa...
Protecting Your Clients' Privacy
Target hash: $2a$05$23ddkc20ker09
‘open!‘ -> $2a$05$dhwefu23823ld NO MATCH
‘sesame!’ -> $2a$05$39dk2sdkfu3el NO MATCH
...
‘friend’ -> $2a$05$23ddkc20ker09 ENTER!
Guessing Passwords
Your System can throttle, lock out
Password files can be analyzed offline
1- Use bcrypt
$2a$05$d098b0fc4aZKYOHnlPZff7NSqnzCrPwn0yqnyi
2
5
iterations
$2a$10$8ib9C2Zk8dDAPE8Kim0ogE9su11SDyHGuv4YUC
2
10
iterations - much more secure, much slower
You get to choose how many iterations you want.
The hash includes a random salt.
Increasing Iterations
password = cgi->fields->password
if (password is valid) {
numIter = substr(hash, 4, 2);
numIter++;
newhash = bcrypt(password, numIter);
replace hash with newhash in database
}
$2a$05$d098b0fc4aZKYOHnlPZff7NSqnzCrPwn0yqnyi
$2a$10$8ib9C2Zk8dDAPE8Kim0ogE9su11SDyHGuv4YUC
Secure Hashes are Slow
Algorithm Guessing Speed
Unsalted SHA-1
SHA512
bcrypt(10)
bcrypt(16)
bcrypt(20)
15.5 Billion guesses/second
11,000 guesses/second
11 guesses/second
5.5 seconds/guess
87.5 seconds/guess
Reusing a Password
Facebook User: bob@example.com Password:‘bob’
Twitter User: bob@example.com Password:‘bob’
MegaBank User: bob@example.com Password:‘bob’
Your Site User: bob@example.com Password:‘bob’
Your Password File
alice@foo.com:$2a$16$873AB23783...
bob@example.com:$2a$16$23d98Q7K129S...
cathy@bar.com:$2a$16$12AB43BBCE...
A good guess for bob’s password:‘bob’
Total time to crack: 5.5 seconds.
User: bob@example.com
Password:‘bob’
In the database:
User: $2a$05$d098b0fc....
Password: $2a$05$23d98Q...
2 - Hash the email
Without a user name, a password is worthless
Using a Hashed Email
✦ Normalize the email
✦ remove leading and trailing spaces
✦ convert to lower case
✦Guaranteed to get same hash every time
✦ Hash the normalized email
✦ Use that hash when adding a user or
querying on login.
Welcome, aa@example.com!!
Store it in the session
Now, only current sessions are at risk
Delete when the session expires
Encrypt it for additional safety
Uploading The Address Book
Never upload email addresses
Upload their hashes instead
Only upload what you need
Protecting Your Clients' Privacy
My Address Book:
Dave: dave@example.com
Aijaz’s Address Book:
Dave: $2a$05$qZHnl....
Later, Dave registers as dave@example.com
Insert user with email: $2a$05$qZHnl....
SELECT * FROM FRIENDS
WHERE EMAIL=’ $2a$05$qZHnl....’
Protecting Your Clients' Privacy
Dave, you might
know Aijaz
Aijaz, you might know Dave
You really didn’t need to upload the email
What to Remember
Hash passwords with bcrypt
http://TheJoyOfHack.com/
@_aijaz_
Thank

More Related Content

PDF
Couchdb
Brian Smith
 
PDF
MongoDB a document store that won't let you down.
Nurul Ferdous
 
PPTX
Cryptography for the mere mortals - for phpXperts Seminar 2011 by Hasin and Tonu
Hasin Hayder
 
PDF
与 PHP 和 Perl 使用 MySQL 数据库
YUCHENG HU
 
PDF
San Francisco Java User Group
kchodorow
 
PPSX
Php session
argusacademy
 
PPTX
PHP with MySQL
hamsa nandhini
 
PPT
PHP
webhostingguy
 
Couchdb
Brian Smith
 
MongoDB a document store that won't let you down.
Nurul Ferdous
 
Cryptography for the mere mortals - for phpXperts Seminar 2011 by Hasin and Tonu
Hasin Hayder
 
与 PHP 和 Perl 使用 MySQL 数据库
YUCHENG HU
 
San Francisco Java User Group
kchodorow
 
Php session
argusacademy
 
PHP with MySQL
hamsa nandhini
 

What's hot (9)

PDF
Mongo db for C# Developers
Simon Elliston Ball
 
PPT
Lecture8 php page control by okello erick
okelloerick
 
PDF
Riak Meetup Stockholm 1/11/2012
Bip Thelin
 
PDF
DBIx::Class walkthrough @ bangalore pm
Sheeju Alex
 
PDF
Apache CouchDB Presentation @ Sept. 2104 GTALUG Meeting
Myles Braithwaite
 
PPTX
Cracking for the Blue Team
James '​-- Mckinlay
 
PPTX
jQuery
Cheng-Yu Lin
 
PDF
Tips of CakePHP and MongoDB - Cakefest2011 ichikaway
ichikaway
 
ODP
Php 102: Out with the Bad, In with the Good
Jeremy Kendall
 
Mongo db for C# Developers
Simon Elliston Ball
 
Lecture8 php page control by okello erick
okelloerick
 
Riak Meetup Stockholm 1/11/2012
Bip Thelin
 
DBIx::Class walkthrough @ bangalore pm
Sheeju Alex
 
Apache CouchDB Presentation @ Sept. 2104 GTALUG Meeting
Myles Braithwaite
 
Cracking for the Blue Team
James '​-- Mckinlay
 
jQuery
Cheng-Yu Lin
 
Tips of CakePHP and MongoDB - Cakefest2011 ichikaway
ichikaway
 
Php 102: Out with the Bad, In with the Good
Jeremy Kendall
 
Ad

Viewers also liked (20)

PDF
Exploring JSON With jq
Aijaz Ansari
 
PPTX
GDC 2017 Education Soapbox: Game Academia's "Art Problem"
Christopher Totten
 
PPTX
Covenant Eyes Barna Study Data
Covenant Eyes
 
PDF
Now What?
Aijaz Ansari
 
PPTX
Digital Literacy for Everyday
Diipo Fagbolu
 
PDF
Carta a mi madre que esta en el cielo
Joseph Oré Marín
 
PDF
Unit 4 ep1_natural_science_animals
matea muñoz
 
PPTX
TSEM Spring 2017 Thompson Class 3
Laksamee Putnam
 
PPTX
College career readiness 2017
superrin
 
PDF
02 el shabbat dia de reposo copy
Beit meshobeb TX
 
PDF
01 el shabbat dia de reposo 1ra. Parte
Beit meshobeb TX
 
PPTX
language
Sheena Llare
 
PPTX
Diferencias y similitudes entre peirce y saussure
carolayngc
 
KEY
Wp and jq
Digitally
 
PPTX
Lmcp 1532 tugasan 7
CHEW leeyee
 
PDF
การเคลื่อนที่ของสิ่งมีชีวิตเซลล์เดียว
กมลรัตน์ ฉิมพาลี
 
PDF
Flask First-Timer
Aijaz Ansari
 
PPTX
3Com AS4C1M16E5-50JC
savomir
 
PPTX
Computacion
Santiago Sevilla
 
PPT
Subphylum mandibulata (By: J.Q)
Josefino Quieta
 
Exploring JSON With jq
Aijaz Ansari
 
GDC 2017 Education Soapbox: Game Academia's "Art Problem"
Christopher Totten
 
Covenant Eyes Barna Study Data
Covenant Eyes
 
Now What?
Aijaz Ansari
 
Digital Literacy for Everyday
Diipo Fagbolu
 
Carta a mi madre que esta en el cielo
Joseph Oré Marín
 
Unit 4 ep1_natural_science_animals
matea muñoz
 
TSEM Spring 2017 Thompson Class 3
Laksamee Putnam
 
College career readiness 2017
superrin
 
02 el shabbat dia de reposo copy
Beit meshobeb TX
 
01 el shabbat dia de reposo 1ra. Parte
Beit meshobeb TX
 
language
Sheena Llare
 
Diferencias y similitudes entre peirce y saussure
carolayngc
 
Wp and jq
Digitally
 
Lmcp 1532 tugasan 7
CHEW leeyee
 
การเคลื่อนที่ของสิ่งมีชีวิตเซลล์เดียว
กมลรัตน์ ฉิมพาลี
 
Flask First-Timer
Aijaz Ansari
 
3Com AS4C1M16E5-50JC
savomir
 
Computacion
Santiago Sevilla
 
Subphylum mandibulata (By: J.Q)
Josefino Quieta
 
Ad

Similar to Protecting Your Clients' Privacy (20)

PDF
Passwords good badugly181212-2
Iftach Ian Amit
 
PPTX
Password Storage Explained
jeetendra mandal
 
PPT
Kieon secure passwords theory and practice 2011
Kieon
 
PPTX
P@ssw0rds
Will Alexander
 
ODP
An Introduction to Hashing and Salting
Rahul Singh
 
PPTX
Password Storage Sucks!
nerdybeardo
 
PPTX
Passwords
GrittyCC
 
PPTX
Secure passwords-theory-and-practice
Akash Mahajan
 
PDF
A Survey of Password Attacks and Safe Hashing Algorithms
IRJET Journal
 
PDF
Hacknbeers sqli and cryptography
Miguel Ibarra
 
PPTX
Securing Passwords
Mandeep Singh
 
ODP
User Credential handling in Web Applications done right
tladesignz
 
PDF
Password hashing, salting, bycrpt
Ahmad karawash
 
PPTX
Password Management System: Enhancing Security and Efficiency
jatniwalafizza786
 
PDF
Password (in)security
Enrico Zimuel
 
PDF
business articles
client001competitors
 
PPTX
A Recipe for Password Storage: Add Salt to Taste
Nick Malcolm
 
PDF
Cracking Salted Hashes
n|u - The Open Security Community
 
PPTX
Storing passwords-honey words
kandulasindhu
 
PPTX
Application and Server Security
Brian Pontarelli
 
Passwords good badugly181212-2
Iftach Ian Amit
 
Password Storage Explained
jeetendra mandal
 
Kieon secure passwords theory and practice 2011
Kieon
 
P@ssw0rds
Will Alexander
 
An Introduction to Hashing and Salting
Rahul Singh
 
Password Storage Sucks!
nerdybeardo
 
Passwords
GrittyCC
 
Secure passwords-theory-and-practice
Akash Mahajan
 
A Survey of Password Attacks and Safe Hashing Algorithms
IRJET Journal
 
Hacknbeers sqli and cryptography
Miguel Ibarra
 
Securing Passwords
Mandeep Singh
 
User Credential handling in Web Applications done right
tladesignz
 
Password hashing, salting, bycrpt
Ahmad karawash
 
Password Management System: Enhancing Security and Efficiency
jatniwalafizza786
 
Password (in)security
Enrico Zimuel
 
business articles
client001competitors
 
A Recipe for Password Storage: Add Salt to Taste
Nick Malcolm
 
Cracking Salted Hashes
n|u - The Open Security Community
 
Storing passwords-honey words
kandulasindhu
 
Application and Server Security
Brian Pontarelli
 

Recently uploaded (20)

PDF
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
 
PDF
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
PDF
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
PDF
Brief History of Internet - Early Days of Internet
sutharharshit158
 
PPTX
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
PDF
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
PDF
The Future of Artificial Intelligence (AI)
Mukul
 
PDF
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
PPTX
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
PDF
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
PPTX
Simple and concise overview about Quantum computing..pptx
mughal641
 
PDF
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
PPTX
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
PPTX
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
PDF
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
PDF
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
PDF
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
PDF
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
PDF
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
PDF
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
 
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
Brief History of Internet - Early Days of Internet
sutharharshit158
 
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
The Future of Artificial Intelligence (AI)
Mukul
 
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
Simple and concise overview about Quantum computing..pptx
mughal641
 
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 

Protecting Your Clients' Privacy