Sensitive Data Exposure
Emmanuel Benoist
Fall Term 2020/2021
Berner Fachhochschule | Haute ´ ecole sp´ ecialis´ ee bernoise | Berne University of Applied Sciences 1
Sensitive Data Exposure Emmanuel Benoist Fall Term 2020/2021 Berner - - PowerPoint PPT Presentation
Sensitive Data Exposure Emmanuel Benoist Fall Term 2020/2021 Berner Fachhochschule | Haute ecole sp ecialis ee bernoise | Berne University of Applied Sciences 1 Table of Contents Examples Attacks Recommendations PCI Data
Berner Fachhochschule | Haute ´ ecole sp´ ecialis´ ee bernoise | Berne University of Applied Sciences 1
Berner Fachhochschule | Haute ´ ecole sp´ ecialis´ ee bernoise | Berne University of Applied Sciences 2
Local Storage Database Transit (LAN)
Backup policy is part of security policy Data stored must be readable ... but not to much!
Berner Fachhochschule | Haute ´ ecole sp´ ecialis´ ee bernoise | Berne University of Applied Sciences 3
Break something else Steal keys man-in-the-middle
in transit from user’s browser
Berner Fachhochschule | Haute ´ ecole sp´ ecialis´ ee bernoise | Berne University of Applied Sciences 4
the most common flaw
weak key generation weak key management weak algorithm usage
limited access hard to exploit
Berner Fachhochschule | Haute ´ ecole sp´ ecialis´ ee bernoise | Berne University of Applied Sciences 5
Health records credentials personal data credit cards . . .
Value of data for competitors Reputation Compliance
Berner Fachhochschule | Haute ´ ecole sp´ ecialis´ ee bernoise | Berne University of Applied Sciences 6
Tons of mails were readable NSA listened to communication between datacenters Communication was cleartext
HTTPS for any client to gmail encryption of data between servers
Berner Fachhochschule | Haute ´ ecole sp´ ecialis´ ee bernoise | Berne University of Applied Sciences 7
Bug in the library Open SSL Implementation of Heartbeat by a PhD student Heartbeat : extension for TLS (Transport Layer Security)
Each heartbeat exposed up to 64kB of memory
Canada Revenue Agency : theft of 900 taxpayers Social Insurance Numbers in UK, Mumsnet had accounts hijacked (including CEO’s one)
Berner Fachhochschule | Haute ´ ecole sp´ ecialis´ ee bernoise | Berne University of Applied Sciences 8
Automatic encryption is done Data stored on the disk are unreadable But SQL injection can read Credit Card Numbers
Encrypt data with a public key Cards can only be read from back-end using private key Data are “write only”
Berner Fachhochschule | Haute ´ ecole sp´ ecialis´ ee bernoise | Berne University of Applied Sciences 9
Login occures in HTTPS pages Rest of pages are HTTPS Another part of site is HTTP
SessionID is sent also for HTTP pages / resources (images, css, . . . ) Can be spyed by third party Can be used for inpersonating the victim
Berner Fachhochschule | Haute ´ ecole sp´ ecialis´ ee bernoise | Berne University of Applied Sciences 10
Health data Credit Card information personal information Credentials (passwords, keys, . . . )
Including Backup
On the internet Inside the internal network
Berner Fachhochschule | Haute ´ ecole sp´ ecialis´ ee bernoise | Berne University of Applied Sciences 11
Some algorithms are proven weak (MD5 for instance) Configuration is crutial No self made crypto library : details are important
security directives or headers missing?
Berner Fachhochschule | Haute ´ ecole sp´ ecialis´ ee bernoise | Berne University of Applied Sciences 12
Many shops use third party payment providers No need to store Credit Card numbers Receives a transaction number certified by the bank
Zalando uses “Verified by Visa” or “MasterCard secure code” The bank verifies the validity of the card (using TAN for instance)
Berner Fachhochschule | Haute ´ ecole sp´ ecialis´ ee bernoise | Berne University of Applied Sciences 13
AES for symetric encryption, RSA for public key crypto, SHA-256 or better for hash functions
MD5 SHA1
For more details: CAPV program validates crypto algorithms http://csrc.nist.gov/groups/STM/cavp/index.html
Choice of salts Integrity with MAC (HMAC-SHA256 or HMAC-SAH512)
Berner Fachhochschule | Haute ´ ecole sp´ ecialis´ ee bernoise | Berne University of Applied Sciences 14
random numbers random file names random userID’s or sessionID’s random strings
No one should guess Seeded with sufficient entropy
Seed = current time in milliseconds or microseconds Very easy to know (or brute force)
Berner Fachhochschule | Haute ´ ecole sp´ ecialis´ ee bernoise | Berne University of Applied Sciences 15
No matter how easy it appears Example : heartbleed
For the design and for the review
Berner Fachhochschule | Haute ´ ecole sp´ ecialis´ ee bernoise | Berne University of Applied Sciences 16
Otherwise the ciphertext can be changed Especially over an untrusted chanel (e.g. URL or cookie)
CCM, GCM, OCB
CBC = Cipher Block Chaining Message Authentication Code : HMAC, UMAC Do not use ECB mode (Electronic codebook)
Berner Fachhochschule | Haute ´ ecole sp´ ecialis´ ee bernoise | Berne University of Applied Sciences 17
Vulnerable to SQL injection and the like
Present in rainbow tables
A salt is an information added to the value before passing to the hash function. Attack must be conducted for each of the users
Argon2, scrypt, bcrypt or PBKDF2
Berner Fachhochschule | Haute ´ ecole sp´ ecialis´ ee bernoise | Berne University of Applied Sciences 18
Berner Fachhochschule | Haute ´ ecole sp´ ecialis´ ee bernoise | Berne University of Applied Sciences 19
Data collected can be used by attackers For Identity Theft
Not encrypting sensitive data Using home grown algorithms Insecure use of strong algorithms Continued use of proven weak algorithms (MD5, SHA-1, RC3, RC4, etc.) Hard coding keys, and storing keys in unprotected stores
Berner Fachhochschule | Haute ´ ecole sp´ ecialis´ ee bernoise | Berne University of Applied Sciences 20
Berner Fachhochschule | Haute ´ ecole sp´ ecialis´ ee bernoise | Berne University of Applied Sciences 21
Berner Fachhochschule | Haute ´ ecole sp´ ecialis´ ee bernoise | Berne University of Applied Sciences 22
We sell goods and clients pay using their credit cards We have to store the address and references of all our clients for the legal issues. Data stored: name, address, e-mail, phone, Credit Cards Numbers
Attackers access to our Database They can harvest the whole content of our customer clients
Berner Fachhochschule | Haute ´ ecole sp´ ecialis´ ee bernoise | Berne University of Applied Sciences 23
Use of Credit Cards Number by attackers Privacy violation Identity Theft . . .
Reputation Clients data stolen (can be resold to a competitor) Business secrets stolen
Reputation
Berner Fachhochschule | Haute ´ ecole sp´ ecialis´ ee bernoise | Berne University of Applied Sciences 24
Clear-text : accessible by SQL injection, or insiders Hashed : can be verified, but not read Problem : Easy to check using lists of hashed passwords (dictionary attack) Hashed with the same salt : Attackers need to find the salt Hashed using a generic salt and a specific salt
Ruled by the Credit card industry (see later)
Should always been stored encrypted At least protected using a passphrase
Private data Social Security Number (AHV / AVS in Switzerland)
Berner Fachhochschule | Haute ´ ecole sp´ ecialis´ ee bernoise | Berne University of Applied Sciences 25
If you need to read and write data: symmetric encryption (e.g. DES, AES) If reading and writing are done by different entities: asymmetric encryption (e.g. RSA)
One input has always the same output Impossible to go from the output back to the input No collision can be generated (two inputs having the same
Example : SHA-256
Berner Fachhochschule | Haute ´ ecole sp´ ecialis´ ee bernoise | Berne University of Applied Sciences 26
Highly Sensitive data Require One-Way hashing Needs to be implemented by a partner.
Based on Modulo This function is so complicated that it can not be reversed.
Berner Fachhochschule | Haute ´ ecole sp´ ecialis´ ee bernoise | Berne University of Applied Sciences 27
Transform all the chars in the string into numbers Take an arbitrary number (always the same) Add this number to the last char, and modulo to remains in interval where conversion of number and char is automatic Add the obtained number to the penultimate char and modulo etc. The numbers obtained form a string The string is “secure”
Take the obtained string, start from the first Substract the arbitrary name to the char, we obtain the
Go on the same If the obtained number is negative, then modulo was used, attacker just needs to substract this value.
Berner Fachhochschule | Haute ´ ecole sp´ ecialis´ ee bernoise | Berne University of Applied Sciences 28
Berner Fachhochschule | Haute ´ ecole sp´ ecialis´ ee bernoise | Berne University of Applied Sciences 29
Berner Fachhochschule | Haute ´ ecole sp´ ecialis´ ee bernoise | Berne University of Applied Sciences 30
Only use approved public algorithms such as: AES, RSA public key cryptography and SHA-256 or better
MD5 / SHA1 hash functions have been proven weak Favor safer alternatives such as SHA-256
To protect the future if a private key is leaked. The communication is done using a session key that can not be found, even it key is leaked later.
Berner Fachhochschule | Haute ´ ecole sp´ ecialis´ ee bernoise | Berne University of Applied Sciences 31
Never transmit private keys over insecure channels
Using a pass-phrase Or in a Password Manager
Berner Fachhochschule | Haute ´ ecole sp´ ecialis´ ee bernoise | Berne University of Applied Sciences 32
Use tight file system permissions and controls Encrypt securely credentials
database encryption, useless if database connection pool provides unencrypted access
Berner Fachhochschule | Haute ´ ecole sp´ ecialis´ ee bernoise | Berne University of Applied Sciences 33
Berner Fachhochschule | Haute ´ ecole sp´ ecialis´ ee bernoise | Berne University of Applied Sciences 34
Developed by major credit card companies (e.g. Visa, Mastercard, American Express) to help organizations preventing credit card fraud
A company processing, storing or transmitting payment card data must be PCI DSS compliant Risk: losing their ability to process credit card payment
Validation conducted by auditors (Qualified Security Assessors (QSAs) Smaller companies just fill a self-assessment questionnaire.
Berner Fachhochschule | Haute ´ ecole sp´ ecialis´ ee bernoise | Berne University of Applied Sciences 35
Install and maintain a firewall Do not use vendor-supplied default password and other security parameters
Protect stored card-holder data Encrypt transmission of card-holder data across open, public networks
Protect all systems against malware and use and regularly update anti-virus software or programs Develop and maintain secure systems and applications
Restrict access to card-holder data by business need-to-know Identify and authenticate access to system components Restrict physical access to card-holder data
Berner Fachhochschule | Haute ´ ecole sp´ ecialis´ ee bernoise | Berne University of Applied Sciences 36
Track and monitor all access to network resources and card-holder data Regularly test security systems and processes
Maintain a policy that addresses information security for all personnel
Berner Fachhochschule | Haute ´ ecole sp´ ecialis´ ee bernoise | Berne University of Applied Sciences 37
Primary Account Number (PAN, a.k.a. credit card number) Card-holder name Service Code Expiration Date Can be stored Require protection
Full Magnetic Stripe CVC2/CVV2/CID PIN Can in no case be stored
Berner Fachhochschule | Haute ´ ecole sp´ ecialis´ ee bernoise | Berne University of Applied Sciences 38
Limit storage and retention time to which is required for business, legal, and/or regulatory
Truncate card-holder data if full PAN is not needed Never send PAN in unencrypted e-mails Mask PAN when displayed
Strong one-way hash functions Truncation Index tokens and pads (pads must be securely stored) Strong cryptography with associated key management processes and procedures
Berner Fachhochschule | Haute ´ ecole sp´ ecialis´ ee bernoise | Berne University of Applied Sciences 39
Berner Fachhochschule | Haute ´ ecole sp´ ecialis´ ee bernoise | Berne University of Applied Sciences 40
Depends on regulation
Use cryptography
Any non existent data can not be stollen!
Berner Fachhochschule | Haute ´ ecole sp´ ecialis´ ee bernoise | Berne University of Applied Sciences 41
Berner Fachhochschule | Haute ´ ecole sp´ ecialis´ ee bernoise | Berne University of Applied Sciences 42