SlideShare una empresa de Scribd logo
1 de 37
Speaking with Cryptographic Oracles Daniel “unicornFurnace” Crowley Application Security Consultant, Trustwave - Spiderlabs
The Speaker and the Presentation A quick introduction and a few distinctions
The Speaker Daniel Crowley Web application security d00d IANAC (I am not a cryptographer) dcrowley@trustwave.com @dan_crowley
The Presentation Topic Finding and exploiting: Encryption Oracles Decryption Oracles Padding Oracles With little to no cryptographic knowledge More crypto knowledge, more useful attacks
NOT the Presentation Topic The Oracle We are not being harvested for energy by robot overlords Maybe ORACLE If you Google “<any crypto word> oracle” it’s all you find Google, the Internet Oracle While awesome, not what we’re talking about
NOT the Presentation Topic Crypto g00r00s like Adi Shamir While also awesome and totally related, not the topic New attacks on old crypto Mistakes are easy enough to make in implementation How Padding Oracle attacks work Too much time to explain Too many good resources
DEFCON Drinking Game 0-day APT iPad APT China, cyber-war Cloud mobile botnet Cloud cloud Cyber-Twilight APT Sun Tzu RSA HBGary botnet PCI SCADA in the cloud Cyber-war? LulzSec??? APT China cyber-war weeaboo, WikiLeaks mobile LulzSec.
A Primer on Cryptographic Terms Basic cryptographic terms, concepts and mistakes
Very Basic Terms Cipher A system for scrambling and unscrambling data to protect it Key A variable used to permute the cipher Initialization Vector (IV) A second variable used to randomize the cipher Plaintext	 The data in readable form Ciphertext The data in unreadable form Encryption Turning something you can read into something you can’t Decryption Turning something you can’t read into something you can
Stream and Block Ciphers Block Encrypt X characters at a time X is the block size Key is used to directly transform plaintext to ciphertext Stream Encrypt one character at a time Key is used to generate pseudo-random numbers Those numbers are used to transform plaintext to ciphertext
Very Basic Mistakes Using a keyless cipher Completely insecure if cipher is ever discovered Reusing keys and/or IVs Makes Oracle attacks far more dangerous IV reuse can seriously weaken stream ciphers Think WEP Leaking data from crypto operations Foundation for Oracle attacks Flickr Creative Commons - Rosino
What is an Oracle? A system which takes queries and provides answers Queries might be Plaintext Ciphertext Answers might be Corresponding plaintext Corresponding ciphertext Info about operation Sample from PRNG Picture by D Sharon Pruitt – Creative Commons
Seek the Oracle How to identify cryptographic Oracles From a black-box perspective
Decryption Oracles: Identify Input Identify where encrypted input occurs Identify all points of user input For Web apps: GET, POST, URL, Cookie, headers Identify those which may be encrypted Encrypted data is generally encoded Base64 ASCII hex URL encoding Decoded data is likely encrypted if seemingly random Modification of values may result in decryption-related errors
Decryption Oracles: Find Decrypted Output May be reflected Normal output Error May be given in later response May be inferred from modified output May be stored and not shown Additional vulnerabilities may reveal output
Decryption Oracles: An Example Scenario Consider “GetPage.php?file=<encrypted_stuff>” Opens a file to be included based on encrypted input Allows for quick page additions Prevents file inclusion attacks…? Assumes properly encrypted input is sanitary Errors are verbose Usage Feed the script some ciphertext Record the “file” the error tells you wasn’t found
Encryption Oracles: Find Encrypted Data Often found in Cookies Hidden variables Databases File resident data Flickr Creative Commons – Gideon van der Stelt
Encryption Oracles: Determine Point of Entry Frequently encrypted data Client-side state variables Passwords Financial data Anything sufficiently sensitive Being encrypted is not enough We need to be able to manipulate it And see the ciphertext
Encryption Oracles: An Example Scenario Consider “auth” cookie, encrypted Username + “:” + password_hash + “:” + timestamp Assume usernames can’t contain “:” character No delimiter injection  Timestamp to control expiration Usage Register with any username, log in Copy cookie value and replace any encrypted input with it Can’t use colons or control suffix Might not matter
Padding Oracles Input must be encrypted Must be a padded block cipher Valid vs. invalid padding is distinguishable This is the essence of a padding Oracle Padding Oracles can be used as decryption Oracles Using the CBC-R technique they are also encryption Oracles May be limited in that the first block will be garbled
Exploiting Cryptographic Oracles Breaking bad crypto and bad crypto usage
Converting One Oracle Into Another Padding Oracles only tell you whether padding is valid This information can be used to decrypt data In some circumstances, it can also be used to encrypt Decryption Oracles Can be converted to encryption Oracles using brute force Far more effective with stream ciphers Encryption Oracles Can be converted to decryption Oracles using brute force Again, more effective with stream ciphers
Attack 0: Crypto Recon Check for static key, IV, and deterministic cipher Encrypt the same plaintext twice Check to see if they are identical Check for stream vs. block ciphers Encrypt plaintexts of various sizes Compare plaintext size to ciphertext size Check for ECB block cipher mode Encrypt repeating plaintext blocks Look for repetitive ciphertext Check for stream cipher feedback ,[object Object]
Change the first byte
Observe whether the following bytes change,[object Object]
And they’re not cryptographers
And it doesn’t end wellReal homespun crypto seen in the wild: “hello” might become “KqIKefKPrPKPrPKuJXK”
Attack 1: Bad Algorithms Is there substitution? Submit “AAAA” : Get “KLoKLoKLoKLoK” ,[object Object]
We can already see patterns, tooIs there transposition? Submit “AABB” : Get “KLoKLoKaBeKaBeK” ,[object Object]
We can see more patterns
The “K” seems to be a delimeter
Substitution doesn’t change on position
One replacement per letter,[object Object]
The Oracle tells us what each maps to,[object Object]
Attack 1.75: Bride of Bad Algorithms For some simple ciphers like xor Encryption = Decryption THUS Encryption Oracle = Decryption Oracle THUS Such ciphers are made completely useless by leaking output THUS For God’s sake stop using xor
Attack 1: Bad Algorithms DEMO
Attack 2: Trusted Encrypted Input People tend to reuse keys and IVs If we can encrypt arbitrary data in one place It may work in another If devs don’t think you can mess with input They probably won’t sanitize it Encrypted inputs with MAC aren’t totally tamper-proof

Más contenido relacionado

La actualidad más candente

php[world] 2016 - Tales From the Crypto: A Cryptography Primer
php[world] 2016 - Tales From the Crypto: A Cryptography Primerphp[world] 2016 - Tales From the Crypto: A Cryptography Primer
php[world] 2016 - Tales From the Crypto: A Cryptography PrimerAdam Englander
 
Crypto failures every developer should avoid
Crypto failures every developer should avoidCrypto failures every developer should avoid
Crypto failures every developer should avoidFilip Šebesta
 
Cryptography and PKI
Cryptography and PKICryptography and PKI
Cryptography and PKIRabei Hassan
 
Beyond Automated Testing - RVAsec 2016
Beyond Automated Testing - RVAsec 2016Beyond Automated Testing - RVAsec 2016
Beyond Automated Testing - RVAsec 2016Andrew McNicol
 
OSINT for Attack and Defense
OSINT for Attack and DefenseOSINT for Attack and Defense
OSINT for Attack and DefenseAndrew McNicol
 
HITCON 2015 - DGAs, DNS and Threat Intelligence
HITCON 2015 - DGAs, DNS and Threat IntelligenceHITCON 2015 - DGAs, DNS and Threat Intelligence
HITCON 2015 - DGAs, DNS and Threat IntelligenceJohn Bambenek
 
BSidesDC 2016 Beyond Automated Testing
BSidesDC 2016 Beyond Automated TestingBSidesDC 2016 Beyond Automated Testing
BSidesDC 2016 Beyond Automated TestingAndrew McNicol
 
Google Hacking for Cryptographic Secrets
Google Hacking for Cryptographic SecretsGoogle Hacking for Cryptographic Secrets
Google Hacking for Cryptographic SecretsDr. Emin İslam Tatlı
 
Cryptography by gaurav singh
Cryptography by gaurav singhCryptography by gaurav singh
Cryptography by gaurav singhGaurav Singh
 
THOTCON 0x6: Going Kinetic on Electronic Crime Networks
THOTCON 0x6: Going Kinetic on Electronic Crime NetworksTHOTCON 0x6: Going Kinetic on Electronic Crime Networks
THOTCON 0x6: Going Kinetic on Electronic Crime NetworksJohn Bambenek
 
The Good News on Cryptography
The Good News on CryptographyThe Good News on Cryptography
The Good News on CryptographyMartijn Grooten
 
My Bro The ELK
My Bro The ELKMy Bro The ELK
My Bro The ELKTripwire
 
The Dirty Little Secrets They Didn’t Teach You In Pentesting Class
The Dirty Little Secrets They Didn’t Teach You In Pentesting Class The Dirty Little Secrets They Didn’t Teach You In Pentesting Class
The Dirty Little Secrets They Didn’t Teach You In Pentesting Class Chris Gates
 
Cryptography and Encryptions,Network Security,Caesar Cipher
Cryptography and Encryptions,Network Security,Caesar CipherCryptography and Encryptions,Network Security,Caesar Cipher
Cryptography and Encryptions,Network Security,Caesar CipherGopal Sakarkar
 

La actualidad más candente (14)

php[world] 2016 - Tales From the Crypto: A Cryptography Primer
php[world] 2016 - Tales From the Crypto: A Cryptography Primerphp[world] 2016 - Tales From the Crypto: A Cryptography Primer
php[world] 2016 - Tales From the Crypto: A Cryptography Primer
 
Crypto failures every developer should avoid
Crypto failures every developer should avoidCrypto failures every developer should avoid
Crypto failures every developer should avoid
 
Cryptography and PKI
Cryptography and PKICryptography and PKI
Cryptography and PKI
 
Beyond Automated Testing - RVAsec 2016
Beyond Automated Testing - RVAsec 2016Beyond Automated Testing - RVAsec 2016
Beyond Automated Testing - RVAsec 2016
 
OSINT for Attack and Defense
OSINT for Attack and DefenseOSINT for Attack and Defense
OSINT for Attack and Defense
 
HITCON 2015 - DGAs, DNS and Threat Intelligence
HITCON 2015 - DGAs, DNS and Threat IntelligenceHITCON 2015 - DGAs, DNS and Threat Intelligence
HITCON 2015 - DGAs, DNS and Threat Intelligence
 
BSidesDC 2016 Beyond Automated Testing
BSidesDC 2016 Beyond Automated TestingBSidesDC 2016 Beyond Automated Testing
BSidesDC 2016 Beyond Automated Testing
 
Google Hacking for Cryptographic Secrets
Google Hacking for Cryptographic SecretsGoogle Hacking for Cryptographic Secrets
Google Hacking for Cryptographic Secrets
 
Cryptography by gaurav singh
Cryptography by gaurav singhCryptography by gaurav singh
Cryptography by gaurav singh
 
THOTCON 0x6: Going Kinetic on Electronic Crime Networks
THOTCON 0x6: Going Kinetic on Electronic Crime NetworksTHOTCON 0x6: Going Kinetic on Electronic Crime Networks
THOTCON 0x6: Going Kinetic on Electronic Crime Networks
 
The Good News on Cryptography
The Good News on CryptographyThe Good News on Cryptography
The Good News on Cryptography
 
My Bro The ELK
My Bro The ELKMy Bro The ELK
My Bro The ELK
 
The Dirty Little Secrets They Didn’t Teach You In Pentesting Class
The Dirty Little Secrets They Didn’t Teach You In Pentesting Class The Dirty Little Secrets They Didn’t Teach You In Pentesting Class
The Dirty Little Secrets They Didn’t Teach You In Pentesting Class
 
Cryptography and Encryptions,Network Security,Caesar Cipher
Cryptography and Encryptions,Network Security,Caesar CipherCryptography and Encryptions,Network Security,Caesar Cipher
Cryptography and Encryptions,Network Security,Caesar Cipher
 

Destacado

Oracle Transparent Data Encription
Oracle Transparent Data EncriptionOracle Transparent Data Encription
Oracle Transparent Data Encriptionrohit3033
 
Encryption oracle
Encryption oracleEncryption oracle
Encryption oraclemanong007
 
Jack of all Formats
Jack of all FormatsJack of all Formats
Jack of all FormatsBaronZor
 
Oracle Key Vault Data Subsetting and Masking
Oracle Key Vault Data Subsetting and MaskingOracle Key Vault Data Subsetting and Masking
Oracle Key Vault Data Subsetting and MaskingDLT Solutions
 
Introduction à la sécurité des WebServices
Introduction à la sécurité des WebServicesIntroduction à la sécurité des WebServices
Introduction à la sécurité des WebServicesConFoo
 
“Secure Password Managers” and “Military-Grade Encryption” on Smartphones:...
“Secure Password Managers” and   “Military-Grade Encryption” on  Smartphones:...“Secure Password Managers” and   “Military-Grade Encryption” on  Smartphones:...
“Secure Password Managers” and “Military-Grade Encryption” on Smartphones:...Positive Hack Days
 
Oracle Transparent Data Encryption (TDE) 12c
Oracle Transparent Data Encryption (TDE) 12cOracle Transparent Data Encryption (TDE) 12c
Oracle Transparent Data Encryption (TDE) 12cNabeel Yoosuf
 
Introduction to Tokenization
Introduction to TokenizationIntroduction to Tokenization
Introduction to TokenizationNabeel Yoosuf
 
What is a Token Service Provider?
What is a Token Service Provider?What is a Token Service Provider?
What is a Token Service Provider?Rambus Inc
 
What is Payment Tokenization?
What is Payment Tokenization?What is Payment Tokenization?
What is Payment Tokenization?Rambus Inc
 
Oracle database 12c advanced security guide
Oracle database 12c advanced security guideOracle database 12c advanced security guide
Oracle database 12c advanced security guidebupbechanhgmail
 
Oracle database 12c 2 day + security guide
Oracle database 12c 2 day + security guideOracle database 12c 2 day + security guide
Oracle database 12c 2 day + security guidebupbechanhgmail
 

Destacado (14)

Oracle Transparent Data Encription
Oracle Transparent Data EncriptionOracle Transparent Data Encription
Oracle Transparent Data Encription
 
venture lab project 02
venture lab project 02venture lab project 02
venture lab project 02
 
Encryption oracle
Encryption oracleEncryption oracle
Encryption oracle
 
Jack of all Formats
Jack of all FormatsJack of all Formats
Jack of all Formats
 
Oracle Key Vault Data Subsetting and Masking
Oracle Key Vault Data Subsetting and MaskingOracle Key Vault Data Subsetting and Masking
Oracle Key Vault Data Subsetting and Masking
 
Modified MD5 Algorithm for Password Encryption
Modified MD5 Algorithm for Password EncryptionModified MD5 Algorithm for Password Encryption
Modified MD5 Algorithm for Password Encryption
 
Introduction à la sécurité des WebServices
Introduction à la sécurité des WebServicesIntroduction à la sécurité des WebServices
Introduction à la sécurité des WebServices
 
“Secure Password Managers” and “Military-Grade Encryption” on Smartphones:...
“Secure Password Managers” and   “Military-Grade Encryption” on  Smartphones:...“Secure Password Managers” and   “Military-Grade Encryption” on  Smartphones:...
“Secure Password Managers” and “Military-Grade Encryption” on Smartphones:...
 
Oracle Transparent Data Encryption (TDE) 12c
Oracle Transparent Data Encryption (TDE) 12cOracle Transparent Data Encryption (TDE) 12c
Oracle Transparent Data Encryption (TDE) 12c
 
Introduction to Tokenization
Introduction to TokenizationIntroduction to Tokenization
Introduction to Tokenization
 
What is a Token Service Provider?
What is a Token Service Provider?What is a Token Service Provider?
What is a Token Service Provider?
 
What is Payment Tokenization?
What is Payment Tokenization?What is Payment Tokenization?
What is Payment Tokenization?
 
Oracle database 12c advanced security guide
Oracle database 12c advanced security guideOracle database 12c advanced security guide
Oracle database 12c advanced security guide
 
Oracle database 12c 2 day + security guide
Oracle database 12c 2 day + security guideOracle database 12c 2 day + security guide
Oracle database 12c 2 day + security guide
 

Similar a Daniel Crowley - Speaking with Cryptographic Oracles

aacyberessential3cryptography-131067585699078884.pptx
aacyberessential3cryptography-131067585699078884.pptxaacyberessential3cryptography-131067585699078884.pptx
aacyberessential3cryptography-131067585699078884.pptxImXaib
 
Crypto failures every developer should avoid
Crypto failures every developer should avoidCrypto failures every developer should avoid
Crypto failures every developer should avoidOwaspCzech
 
Cracking the crypto
Cracking the cryptoCracking the crypto
Cracking the cryptoMihir Shah
 
Cyber Security Workshop GDSC-BITW
Cyber Security Workshop GDSC-BITWCyber Security Workshop GDSC-BITW
Cyber Security Workshop GDSC-BITWChanchalHiwanj1
 
Java Hurdling: Obstacles and Techniques in Java Client Penetration-Testing
Java Hurdling: Obstacles and Techniques in Java Client Penetration-TestingJava Hurdling: Obstacles and Techniques in Java Client Penetration-Testing
Java Hurdling: Obstacles and Techniques in Java Client Penetration-TestingTal Melamed
 
BCS_PKI_part1.ppt
BCS_PKI_part1.pptBCS_PKI_part1.ppt
BCS_PKI_part1.pptUskuMusku1
 
amer-network-sihubconferances-security.ppt
amer-network-sihubconferances-security.pptamer-network-sihubconferances-security.ppt
amer-network-sihubconferances-security.pptnavidkamrava
 
Secure Coding 101 - OWASP University of Ottawa Workshop
Secure Coding 101 - OWASP University of Ottawa WorkshopSecure Coding 101 - OWASP University of Ottawa Workshop
Secure Coding 101 - OWASP University of Ottawa WorkshopPaul Ionescu
 
Discussion Question Contrast file encryption and volume encryptio.docx
Discussion Question Contrast file encryption and volume encryptio.docxDiscussion Question Contrast file encryption and volume encryptio.docx
Discussion Question Contrast file encryption and volume encryptio.docxJeniceStuckeyoo
 
Eliminating Secret Sprawl in the Cloud with HashiCorp Vault - 07.11.2018
Eliminating Secret Sprawl in the Cloud with HashiCorp Vault - 07.11.2018Eliminating Secret Sprawl in the Cloud with HashiCorp Vault - 07.11.2018
Eliminating Secret Sprawl in the Cloud with HashiCorp Vault - 07.11.2018HashiCorp
 
Introduction To PKI Technology
Introduction To PKI TechnologyIntroduction To PKI Technology
Introduction To PKI TechnologySylvain Maret
 
The Anatomy of Java Vulnerabilities
The Anatomy of Java VulnerabilitiesThe Anatomy of Java Vulnerabilities
The Anatomy of Java VulnerabilitiesSteve Poole
 
How to Use Cryptography Properly: Common Mistakes People Make When Using Cry...
How to Use Cryptography Properly:  Common Mistakes People Make When Using Cry...How to Use Cryptography Properly:  Common Mistakes People Make When Using Cry...
How to Use Cryptography Properly: Common Mistakes People Make When Using Cry...All Things Open
 

Similar a Daniel Crowley - Speaking with Cryptographic Oracles (20)

Encryption
EncryptionEncryption
Encryption
 
aacyberessential3cryptography-131067585699078884.pptx
aacyberessential3cryptography-131067585699078884.pptxaacyberessential3cryptography-131067585699078884.pptx
aacyberessential3cryptography-131067585699078884.pptx
 
Crypto failures every developer should avoid
Crypto failures every developer should avoidCrypto failures every developer should avoid
Crypto failures every developer should avoid
 
Cracking the crypto
Cracking the cryptoCracking the crypto
Cracking the crypto
 
Cyber Security Workshop GDSC-BITW
Cyber Security Workshop GDSC-BITWCyber Security Workshop GDSC-BITW
Cyber Security Workshop GDSC-BITW
 
Java Hurdling: Obstacles and Techniques in Java Client Penetration-Testing
Java Hurdling: Obstacles and Techniques in Java Client Penetration-TestingJava Hurdling: Obstacles and Techniques in Java Client Penetration-Testing
Java Hurdling: Obstacles and Techniques in Java Client Penetration-Testing
 
BCS_PKI_part1.ppt
BCS_PKI_part1.pptBCS_PKI_part1.ppt
BCS_PKI_part1.ppt
 
amer-network-sihubconferances-security.ppt
amer-network-sihubconferances-security.pptamer-network-sihubconferances-security.ppt
amer-network-sihubconferances-security.ppt
 
paper9.pdf
paper9.pdfpaper9.pdf
paper9.pdf
 
sheet2.pdf
sheet2.pdfsheet2.pdf
sheet2.pdf
 
doc2.pdf
doc2.pdfdoc2.pdf
doc2.pdf
 
paper2.pdf
paper2.pdfpaper2.pdf
paper2.pdf
 
lecture1.pdf
lecture1.pdflecture1.pdf
lecture1.pdf
 
Secure Coding 101 - OWASP University of Ottawa Workshop
Secure Coding 101 - OWASP University of Ottawa WorkshopSecure Coding 101 - OWASP University of Ottawa Workshop
Secure Coding 101 - OWASP University of Ottawa Workshop
 
Discussion Question Contrast file encryption and volume encryptio.docx
Discussion Question Contrast file encryption and volume encryptio.docxDiscussion Question Contrast file encryption and volume encryptio.docx
Discussion Question Contrast file encryption and volume encryptio.docx
 
Information Security
Information SecurityInformation Security
Information Security
 
Eliminating Secret Sprawl in the Cloud with HashiCorp Vault - 07.11.2018
Eliminating Secret Sprawl in the Cloud with HashiCorp Vault - 07.11.2018Eliminating Secret Sprawl in the Cloud with HashiCorp Vault - 07.11.2018
Eliminating Secret Sprawl in the Cloud with HashiCorp Vault - 07.11.2018
 
Introduction To PKI Technology
Introduction To PKI TechnologyIntroduction To PKI Technology
Introduction To PKI Technology
 
The Anatomy of Java Vulnerabilities
The Anatomy of Java VulnerabilitiesThe Anatomy of Java Vulnerabilities
The Anatomy of Java Vulnerabilities
 
How to Use Cryptography Properly: Common Mistakes People Make When Using Cry...
How to Use Cryptography Properly:  Common Mistakes People Make When Using Cry...How to Use Cryptography Properly:  Common Mistakes People Make When Using Cry...
How to Use Cryptography Properly: Common Mistakes People Make When Using Cry...
 

Más de BaronZor

The Patsy Proxy
The Patsy ProxyThe Patsy Proxy
The Patsy ProxyBaronZor
 
No-Knowledge Crypto Attacks
No-Knowledge Crypto AttacksNo-Knowledge Crypto Attacks
No-Knowledge Crypto AttacksBaronZor
 
Home Invasion 2.0 - DEF CON 21 - 2013
Home Invasion 2.0 - DEF CON 21 - 2013Home Invasion 2.0 - DEF CON 21 - 2013
Home Invasion 2.0 - DEF CON 21 - 2013BaronZor
 
Why UPnP is awesome and terrifying
Why UPnP is awesome and terrifyingWhy UPnP is awesome and terrifying
Why UPnP is awesome and terrifyingBaronZor
 
Advanced SQL Injection with SQLol
Advanced SQL Injection with SQLolAdvanced SQL Injection with SQLol
Advanced SQL Injection with SQLolBaronZor
 
Windows File Pseudonyms
Windows File PseudonymsWindows File Pseudonyms
Windows File PseudonymsBaronZor
 

Más de BaronZor (6)

The Patsy Proxy
The Patsy ProxyThe Patsy Proxy
The Patsy Proxy
 
No-Knowledge Crypto Attacks
No-Knowledge Crypto AttacksNo-Knowledge Crypto Attacks
No-Knowledge Crypto Attacks
 
Home Invasion 2.0 - DEF CON 21 - 2013
Home Invasion 2.0 - DEF CON 21 - 2013Home Invasion 2.0 - DEF CON 21 - 2013
Home Invasion 2.0 - DEF CON 21 - 2013
 
Why UPnP is awesome and terrifying
Why UPnP is awesome and terrifyingWhy UPnP is awesome and terrifying
Why UPnP is awesome and terrifying
 
Advanced SQL Injection with SQLol
Advanced SQL Injection with SQLolAdvanced SQL Injection with SQLol
Advanced SQL Injection with SQLol
 
Windows File Pseudonyms
Windows File PseudonymsWindows File Pseudonyms
Windows File Pseudonyms
 

Último

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 

Último (20)

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 

Daniel Crowley - Speaking with Cryptographic Oracles

  • 1. Speaking with Cryptographic Oracles Daniel “unicornFurnace” Crowley Application Security Consultant, Trustwave - Spiderlabs
  • 2. The Speaker and the Presentation A quick introduction and a few distinctions
  • 3. The Speaker Daniel Crowley Web application security d00d IANAC (I am not a cryptographer) dcrowley@trustwave.com @dan_crowley
  • 4. The Presentation Topic Finding and exploiting: Encryption Oracles Decryption Oracles Padding Oracles With little to no cryptographic knowledge More crypto knowledge, more useful attacks
  • 5. NOT the Presentation Topic The Oracle We are not being harvested for energy by robot overlords Maybe ORACLE If you Google “<any crypto word> oracle” it’s all you find Google, the Internet Oracle While awesome, not what we’re talking about
  • 6. NOT the Presentation Topic Crypto g00r00s like Adi Shamir While also awesome and totally related, not the topic New attacks on old crypto Mistakes are easy enough to make in implementation How Padding Oracle attacks work Too much time to explain Too many good resources
  • 7. DEFCON Drinking Game 0-day APT iPad APT China, cyber-war Cloud mobile botnet Cloud cloud Cyber-Twilight APT Sun Tzu RSA HBGary botnet PCI SCADA in the cloud Cyber-war? LulzSec??? APT China cyber-war weeaboo, WikiLeaks mobile LulzSec.
  • 8. A Primer on Cryptographic Terms Basic cryptographic terms, concepts and mistakes
  • 9. Very Basic Terms Cipher A system for scrambling and unscrambling data to protect it Key A variable used to permute the cipher Initialization Vector (IV) A second variable used to randomize the cipher Plaintext The data in readable form Ciphertext The data in unreadable form Encryption Turning something you can read into something you can’t Decryption Turning something you can’t read into something you can
  • 10. Stream and Block Ciphers Block Encrypt X characters at a time X is the block size Key is used to directly transform plaintext to ciphertext Stream Encrypt one character at a time Key is used to generate pseudo-random numbers Those numbers are used to transform plaintext to ciphertext
  • 11. Very Basic Mistakes Using a keyless cipher Completely insecure if cipher is ever discovered Reusing keys and/or IVs Makes Oracle attacks far more dangerous IV reuse can seriously weaken stream ciphers Think WEP Leaking data from crypto operations Foundation for Oracle attacks Flickr Creative Commons - Rosino
  • 12. What is an Oracle? A system which takes queries and provides answers Queries might be Plaintext Ciphertext Answers might be Corresponding plaintext Corresponding ciphertext Info about operation Sample from PRNG Picture by D Sharon Pruitt – Creative Commons
  • 13. Seek the Oracle How to identify cryptographic Oracles From a black-box perspective
  • 14. Decryption Oracles: Identify Input Identify where encrypted input occurs Identify all points of user input For Web apps: GET, POST, URL, Cookie, headers Identify those which may be encrypted Encrypted data is generally encoded Base64 ASCII hex URL encoding Decoded data is likely encrypted if seemingly random Modification of values may result in decryption-related errors
  • 15. Decryption Oracles: Find Decrypted Output May be reflected Normal output Error May be given in later response May be inferred from modified output May be stored and not shown Additional vulnerabilities may reveal output
  • 16. Decryption Oracles: An Example Scenario Consider “GetPage.php?file=<encrypted_stuff>” Opens a file to be included based on encrypted input Allows for quick page additions Prevents file inclusion attacks…? Assumes properly encrypted input is sanitary Errors are verbose Usage Feed the script some ciphertext Record the “file” the error tells you wasn’t found
  • 17. Encryption Oracles: Find Encrypted Data Often found in Cookies Hidden variables Databases File resident data Flickr Creative Commons – Gideon van der Stelt
  • 18. Encryption Oracles: Determine Point of Entry Frequently encrypted data Client-side state variables Passwords Financial data Anything sufficiently sensitive Being encrypted is not enough We need to be able to manipulate it And see the ciphertext
  • 19. Encryption Oracles: An Example Scenario Consider “auth” cookie, encrypted Username + “:” + password_hash + “:” + timestamp Assume usernames can’t contain “:” character No delimiter injection  Timestamp to control expiration Usage Register with any username, log in Copy cookie value and replace any encrypted input with it Can’t use colons or control suffix Might not matter
  • 20. Padding Oracles Input must be encrypted Must be a padded block cipher Valid vs. invalid padding is distinguishable This is the essence of a padding Oracle Padding Oracles can be used as decryption Oracles Using the CBC-R technique they are also encryption Oracles May be limited in that the first block will be garbled
  • 21. Exploiting Cryptographic Oracles Breaking bad crypto and bad crypto usage
  • 22. Converting One Oracle Into Another Padding Oracles only tell you whether padding is valid This information can be used to decrypt data In some circumstances, it can also be used to encrypt Decryption Oracles Can be converted to encryption Oracles using brute force Far more effective with stream ciphers Encryption Oracles Can be converted to decryption Oracles using brute force Again, more effective with stream ciphers
  • 23.
  • 25.
  • 26. And they’re not cryptographers
  • 27. And it doesn’t end wellReal homespun crypto seen in the wild: “hello” might become “KqIKefKPrPKPrPKuJXK”
  • 28.
  • 29.
  • 30. We can see more patterns
  • 31. The “K” seems to be a delimeter
  • 33.
  • 34.
  • 35. Attack 1.75: Bride of Bad Algorithms For some simple ciphers like xor Encryption = Decryption THUS Encryption Oracle = Decryption Oracle THUS Such ciphers are made completely useless by leaking output THUS For God’s sake stop using xor
  • 36. Attack 1: Bad Algorithms DEMO
  • 37. Attack 2: Trusted Encrypted Input People tend to reuse keys and IVs If we can encrypt arbitrary data in one place It may work in another If devs don’t think you can mess with input They probably won’t sanitize it Encrypted inputs with MAC aren’t totally tamper-proof
  • 38. Attack 2: Trusted Encrypted Input Encrypted password with MAC in cookie Checked against database on each request needing auth Find encryption Oracle with the same keys & IV Use encryption Oracle to encrypt ‘ or 1=1-- Plug resulting value into cookie Laugh all the way to the bank
  • 39. Attack 2: Trusted Encrypted Input DEMO
  • 40. Attack 3: Let the client have it, it’s encrypted Find a decryption Oracle Find encrypted data Decrypt that sucka ????? PROFIT!!! This attack also relies on key/IV reuse
  • 41. Attack 3: Let the client have it, it’s encrypted DEMO
  • 42. What encryption? If you can find An encryption Oracle A decryption Oracle You can encrypt or decrypt any data As long as keys and IVs are reused Algorithm doesn’t matter Padding doesn’t matter Cipher mode doesn’t matter All encryption which uses the same key and IV is now useless
  • 43. How Can I Fix My Code? Avoid giving away information about crypto operations Output Not always plausible Success/Failure Suppress or generalize errors Timing Make code take the same time to finish no matter what happens Authenticate your crypto Encrypt-then-MAC MAC-then-Encrypt still allows for padding oracle attacks
  • 44. Questions? Daniel Crowley Trustwave– SpiderLabs @dan_crowley dcrowley@trustwave.com

Notas del editor

  1. The first step is to identify where encrypted user input occurs. From a black box perspective, we first need to identify all of the user inputs, then determine which of them may be encrypted,