SlideShare una empresa de Scribd logo
1 de 37
A CRYPTO-FAIL STORY
RootedCON Valencia
September 2017
2
Jose Selvi (@Jose Selvi)
+12 years in the infosec industry
Principal Penetration Tester
& Security Researcher
SANS Institute Community Instructor
GIAC Security Expert (GSE)
Blogger (sometimes): http://www.pentester.es
$ WHOIS JSELVI
3
I DID NOT MAKE A FULL VULNERABILITY RESEARCH
4
THIS IS NOT A CRYPTO TRAINING
5
6
7
TESTING CRYPTO IN 30 MINUTES
test1@test.com : 123456 -> 5A 8D 7D B4 DB B4 05 E9 AB CC 2D 46 AD AD 21 7F
test1@test.com : 123456 -> 5A 8D 7D B4 DB B4 05 E9 AB CC 2D 46 AD AD 21 7F
REUSE SALT, REUSE IV
test1@test.com : 123456 -> 5A 8D 7D B4 DB B4 05 E9 AB CC 2D 46 AD AD 21 7F
test1@test.com : 000000 -> 2E C7 7C 2A 19 6E 02 2B AA 68 7E F0 61 67 51 B0
test1@test.com : 123456 -> 5A 8D 7D B4 DB B4 05 E9 AB CC 2D 46 AD AD 21 7F
test2@test.com : 123456 -> 7B 49 CF 4D E4 32 1E 77 93 21 1A B5 74 8B 44 DA
BASED ON EMAIL & PASSWORD
BLOCK CIPHER (REVERSIBLE) ENCRYPTION
B6 78 78 BD F5 72 FC BE 04 8B D5 33 44 98 7B 02
23 97 F8 B5 BD 63 3F 6D F8 AB 13 64 76 DD 37 BE
5A 8D 7D B4 DB B4 05 E9 AB CC 2D 46 AD AD 21 7F
8
SECURITY STRIKES BACK
9
NO EXPLOITATION, NO FUN
POTENTIALLY EXPLOITABLE
WE PRESUME THAT WITH ENOUGH EFFORT IT COULD BE EXPLOITED
10
QUICK LOOK AT THE BINARY
$ rabin2 -i server.exe | grep -i crypt
ordinal=001 plt=0x005c80c4 bind=NONE type=FUNC name=CRYPTUI.dll_CryptUIDlgViewCertificateW
ordinal=001 plt=0x005c8098 bind=NONE type=FUNC name=CRYPT32.dll_CertEnumCertificatesInStore
ordinal=002 plt=0x005c809c bind=NONE type=FUNC name=CRYPT32.dll_CertCloseStore
ordinal=003 plt=0x005c80a0 bind=NONE type=FUNC name=CRYPT32.dll_CertFreeCertificateContext
ordinal=004 plt=0x005c80a4 bind=NONE type=FUNC name=CRYPT32.dll_CertGetCertificateContextProperty
ordinal=005 plt=0x005c80a8 bind=NONE type=FUNC name=CRYPT32.dll_CertDuplicateCertificateContext
ordinal=006 plt=0x005c80ac bind=NONE type=FUNC name=CRYPT32.dll_CertGetEnhancedKeyUsage
ordinal=007 plt=0x005c80b0 bind=NONE type=FUNC name=CRYPT32.dll_CertGetNameStringW
ordinal=008 plt=0x005c80b4 bind=NONE type=FUNC name=CRYPT32.dll_CertOpenStore
ordinal=009 plt=0x005c80b8 bind=NONE type=FUNC name=CRYPT32.dll_CryptProtectData
ordinal=010 plt=0x005c80bc bind=NONE type=FUNC name=CRYPT32.dll_CryptUnprotectData
$ rabin2 -zz server.exe | grep -i crypt
vaddr=0x00626ff6 paddr=0x002257f6 ordinal=21488 sz=27 len=26 section=.rdata type=ascii
string=CryptUIDlgViewCertificateW
vaddr=0x00627012 paddr=0x00225812 ordinal=21489 sz=12 len=11 section=.rdata type=ascii string=CRYPTUI.dll
vaddr=0x0062755a paddr=0x00225d5a ordinal=21555 sz=17 len=16 section=.rdata type=ascii string=CryptProtectData
vaddr=0x0062756e paddr=0x00225d6e ordinal=21556 sz=19 len=18 section=.rdata type=ascii string=CryptUnprotectData
vaddr=0x00627582 paddr=0x00225d82 ordinal=21557 sz=12 len=11 section=.rdata type=ascii string=CRYPT32.dll
vaddr=0x0062f6e0 paddr=0x0022dae0 ordinal=22387 sz=40 len=39 section=.data type=ascii string=.?AU?
$Deleter@UCryptData@@P6AHPAU1@@Z@@
vaddr=0x0062f710 paddr=0x0022db10 ordinal=22388 sz=30 len=29 section=.data type=ascii string=.?AV?
$TPointer@UCryptData@@@@
vaddr=0x0062f738 paddr=0x0022db38 ordinal=22389 sz=34 len=33 section=.data type=ascii string=.?AV?
$TAutoFreeObj@UCryptData@@@@
11
12
HASHING ALGORITHMS
static void reset(uint32_t digest[], std::string &buffer, uint64_t &transforms)
{
/* SHA1 initialization constants */
digest[0] = 0x67452301;
digest[1] = 0xefcdab89;
digest[2] = 0x98badcfe;
digest[3] = 0x10325476;
digest[4] = 0xc3d2e1f0;
/* Reset counters */
buffer = "";
transforms = 0;
}
13
STREAM CIPHERS
14
BLOCK CIPHERS
15
16
17
AES has 10 rounds for 128-bit
keys, 12 rounds for 192-bit
keys, and 14 rounds for 256-bit
keys.
18
19
20
21
22
CRACKING THE “HASH”
$ ./crack my@email.com 52796b
User: my@email.com
Password: test123456
23
RESULT
24
DO NOT USE ECB MODE NEVER EVER
25
$ echo Testing1234 | openssl enc -aes-128-ecb -K 1234 -iv 1 | hexd
0000000 8d 47 5c 5f bb 1b 1c 0a 79 ca e5 45 6a 8f c4 58
$ echo Testing1234 | openssl enc -aes-128-ecb -K 1234 -iv 2 | hexd
0000000 8d 47 5c 5f bb 1b 1c 0a 79 ca e5 45 6a 8f c4 58
$ echo Testing1234 | openssl enc -aes-128-cbc -K 1234 -iv
0001 | hexdump
0000000 d5 1e 92 d4 ce 72 dc ab 6d e9 c0 b6 bb 39 de f7
$ echo Testing1234 | openssl enc -aes-128-cbc -K 1234 -iv
0002 | hexdump
0000000 1b 28 1f e3 10 fa 69 14 8b 80 e2 64 97 2e 93 d0
26
https://github.com/golang/go/issues/5597
27
ALWAYS USE DIFFERENT IVs ON EACH MESSAGE
28
REUSING IVs ON AES
$ echo Testing1234 | openssl enc -aes-128-cbc -K 1234 -iv 1 | hexdump
0000000 d5 1e 92 d4 ce 72 dc ab 6d e9 c0 b6 bb 39 de f7
$ echo Testing1234 | openssl enc -aes-128-cbc -K 1234 -iv 1 | hexdump
0000000 d5 1e 92 d4 ce 72 dc ab 6d e9 c0 b6 bb 39 de f7
$ echo Testing1234 | openssl enc -aes-128-cbc -K 1234 -iv 1 | hexdump
0000000 d5 1e 92 d4 ce 72 dc ab 6d e9 c0 b6 bb 39 de f7
$ echo Testing1234 | openssl enc -aes-128-cbc -K 1234 -iv 1 | hexdump
0000000 d5 1e 92 d4 ce 72 dc ab 6d e9 c0 b6 bb 39 de f7
$ echo Testing1234 | openssl enc -aes-128-cbc -K 1234 -iv 1 | hexdump
0000000 d5 1e 92 d4 ce 72 dc ab 6d e9 c0 b6 bb 39 de f7
29
REUSING IVs ON STREAM CIPHERS
W E L C O M E T O T H I S
12 34 56 78 9A BC DE F0 12 34 56 78 9A BC DE F0
H I D D E N M E S S A G E ! .
12 34 56 78 9A BC DE F0 12 34 56 78 9A BC DE F0
(M1 ⊕ KEY) ⊕ (M2 ⊕ KEY)
M1 ⊕ M2
30
DO NOT USE REVERSIBLE ENCRYPTION FOR PASSWORDS
Credentials Storage
31
AUTHENTICATION & HASHING
pass1234
Client Side Server Side
XYZW
XYZW
Code
Credentials Storage
32
SALT & PEPPER
pass1234
Client Side Server Side
SALT$XYZW
SALT$XYZW
PEPPER
PEPPERSALT
33
PASSWORD SPECIFIC HASHING: PBKDF2, BCRYPT, SCRYPT, …
34
SERIOUSLY, DO NOT KEEP SECRETS AT CLIENT SIDE
XYZWABCD
Random Token Generator
Token Storage
35
RANDOM TOKENS
Client Side Server Side
XYZWABCD
JSON Token Generator
XYZWABCD
Token Storage
36
JSON WEB TOKENS (JWT)
Client Side Server Side
Certification Authority
CA
www.prosegur.comwww.prosegur.com
THANKS A LOT!
ANY QUESTIONS?
jose.selvi@prosegur.com
jselvi@pentester.es
@JoseSelvi

Más contenido relacionado

Similar a José Selvi - Historia de un CryptoFAIL [rootedvlc4]

Automated Testing for SQL Injection Vulnerabilities: An Input Mutation Approach
Automated Testing for SQL Injection Vulnerabilities: An Input Mutation ApproachAutomated Testing for SQL Injection Vulnerabilities: An Input Mutation Approach
Automated Testing for SQL Injection Vulnerabilities: An Input Mutation Approach
Lionel Briand
 

Similar a José Selvi - Historia de un CryptoFAIL [rootedvlc4] (20)

Aaron Bedra - Effective Software Security Teams
Aaron Bedra - Effective Software Security TeamsAaron Bedra - Effective Software Security Teams
Aaron Bedra - Effective Software Security Teams
 
Star bed 2018.07.19
Star bed 2018.07.19Star bed 2018.07.19
Star bed 2018.07.19
 
We need t go deeper - Testing inception apps.
We need t go deeper - Testing inception apps.We need t go deeper - Testing inception apps.
We need t go deeper - Testing inception apps.
 
"We need to go deeper - testing inception apps" - Jakub Kałużny
"We need to go deeper - testing inception apps" - Jakub Kałużny"We need to go deeper - testing inception apps" - Jakub Kałużny
"We need to go deeper - testing inception apps" - Jakub Kałużny
 
MITRE ATT&CKcon 2018: From Technique to Detection, Paul Ewing and Ross Wolf, ...
MITRE ATT&CKcon 2018: From Technique to Detection, Paul Ewing and Ross Wolf, ...MITRE ATT&CKcon 2018: From Technique to Detection, Paul Ewing and Ross Wolf, ...
MITRE ATT&CKcon 2018: From Technique to Detection, Paul Ewing and Ross Wolf, ...
 
Data Encryption at Rest
Data Encryption at RestData Encryption at Rest
Data Encryption at Rest
 
Algebra and Trigonometry 9th Edition Larson Solutions Manual
Algebra and Trigonometry 9th Edition Larson Solutions ManualAlgebra and Trigonometry 9th Edition Larson Solutions Manual
Algebra and Trigonometry 9th Edition Larson Solutions Manual
 
ReadyNow: Azul's Unconventional "AOT"
ReadyNow: Azul's Unconventional "AOT"ReadyNow: Azul's Unconventional "AOT"
ReadyNow: Azul's Unconventional "AOT"
 
44CON London 2015 - Jtagsploitation: 5 wires, 5 ways to root
44CON London 2015 - Jtagsploitation: 5 wires, 5 ways to root44CON London 2015 - Jtagsploitation: 5 wires, 5 ways to root
44CON London 2015 - Jtagsploitation: 5 wires, 5 ways to root
 
DEP/ASLR bypass without ROP/JIT
DEP/ASLR bypass without ROP/JITDEP/ASLR bypass without ROP/JIT
DEP/ASLR bypass without ROP/JIT
 
DEF CON 23 - COLIN O'FLYNN - dont whisper my chips
DEF CON 23 - COLIN O'FLYNN - dont whisper my chipsDEF CON 23 - COLIN O'FLYNN - dont whisper my chips
DEF CON 23 - COLIN O'FLYNN - dont whisper my chips
 
2013-07-21 MITRE Developer Days - Red Hat SCAP Remediation
2013-07-21 MITRE Developer Days - Red Hat SCAP Remediation2013-07-21 MITRE Developer Days - Red Hat SCAP Remediation
2013-07-21 MITRE Developer Days - Red Hat SCAP Remediation
 
JEEConf 2017 - How to find deadlock not getting into it
JEEConf 2017 - How to find deadlock not getting into itJEEConf 2017 - How to find deadlock not getting into it
JEEConf 2017 - How to find deadlock not getting into it
 
Mobile security
Mobile securityMobile security
Mobile security
 
Automated Testing for SQL Injection Vulnerabilities: An Input Mutation Approach
Automated Testing for SQL Injection Vulnerabilities: An Input Mutation ApproachAutomated Testing for SQL Injection Vulnerabilities: An Input Mutation Approach
Automated Testing for SQL Injection Vulnerabilities: An Input Mutation Approach
 
(automatic) Testing: from business to university and back
(automatic) Testing: from business to university and back(automatic) Testing: from business to university and back
(automatic) Testing: from business to university and back
 
Open daylight and Openstack
Open daylight and OpenstackOpen daylight and Openstack
Open daylight and Openstack
 
Checking Bitcoin
 Checking Bitcoin Checking Bitcoin
Checking Bitcoin
 
CQURE_BHAsia19_Paula_Januszkiewicz_slides
CQURE_BHAsia19_Paula_Januszkiewicz_slidesCQURE_BHAsia19_Paula_Januszkiewicz_slides
CQURE_BHAsia19_Paula_Januszkiewicz_slides
 
Bulletproof
BulletproofBulletproof
Bulletproof
 

Más de RootedCON

Más de RootedCON (20)

Rooted2020 A clockwork pentester - Jose Carlos Moral & Alvaro Villaverde
Rooted2020 A clockwork pentester - Jose Carlos Moral & Alvaro VillaverdeRooted2020 A clockwork pentester - Jose Carlos Moral & Alvaro Villaverde
Rooted2020 A clockwork pentester - Jose Carlos Moral & Alvaro Villaverde
 
rooted2020 Sandbox fingerprinting -_evadiendo_entornos_de_analisis_-_victor_c...
rooted2020 Sandbox fingerprinting -_evadiendo_entornos_de_analisis_-_victor_c...rooted2020 Sandbox fingerprinting -_evadiendo_entornos_de_analisis_-_victor_c...
rooted2020 Sandbox fingerprinting -_evadiendo_entornos_de_analisis_-_victor_c...
 
Rooted2020 hunting malware-using_process_behavior-roberto_amado
Rooted2020 hunting malware-using_process_behavior-roberto_amadoRooted2020 hunting malware-using_process_behavior-roberto_amado
Rooted2020 hunting malware-using_process_behavior-roberto_amado
 
Rooted2020 compliance as-code_-_guillermo_obispo_-_jose_mariaperez_-_
Rooted2020 compliance as-code_-_guillermo_obispo_-_jose_mariaperez_-_Rooted2020 compliance as-code_-_guillermo_obispo_-_jose_mariaperez_-_
Rooted2020 compliance as-code_-_guillermo_obispo_-_jose_mariaperez_-_
 
Rooted2020 the day i_ruled_the_world_deceiving_software_developers_through_op...
Rooted2020 the day i_ruled_the_world_deceiving_software_developers_through_op...Rooted2020 the day i_ruled_the_world_deceiving_software_developers_through_op...
Rooted2020 the day i_ruled_the_world_deceiving_software_developers_through_op...
 
Rooted2020 si la-empresa_ha_ocultado_el_ciberataque,_como_se_ha_enterado_el_r...
Rooted2020 si la-empresa_ha_ocultado_el_ciberataque,_como_se_ha_enterado_el_r...Rooted2020 si la-empresa_ha_ocultado_el_ciberataque,_como_se_ha_enterado_el_r...
Rooted2020 si la-empresa_ha_ocultado_el_ciberataque,_como_se_ha_enterado_el_r...
 
Rooted2020 wordpress-another_terror_story_-_manuel_garcia_-_jacinto_sergio_ca...
Rooted2020 wordpress-another_terror_story_-_manuel_garcia_-_jacinto_sergio_ca...Rooted2020 wordpress-another_terror_story_-_manuel_garcia_-_jacinto_sergio_ca...
Rooted2020 wordpress-another_terror_story_-_manuel_garcia_-_jacinto_sergio_ca...
 
Rooted2020 Atacando comunicaciones-de_voz_cifradas_-_jose_luis_verdeguer
Rooted2020 Atacando comunicaciones-de_voz_cifradas_-_jose_luis_verdeguerRooted2020 Atacando comunicaciones-de_voz_cifradas_-_jose_luis_verdeguer
Rooted2020 Atacando comunicaciones-de_voz_cifradas_-_jose_luis_verdeguer
 
rooted2020-Rootkit necurs no_es_un_bug,_es_una_feature_-_roberto_santos_-_jav...
rooted2020-Rootkit necurs no_es_un_bug,_es_una_feature_-_roberto_santos_-_jav...rooted2020-Rootkit necurs no_es_un_bug,_es_una_feature_-_roberto_santos_-_jav...
rooted2020-Rootkit necurs no_es_un_bug,_es_una_feature_-_roberto_santos_-_jav...
 
Rooted2020 stefano maccaglia--_the_enemy_of_my_enemy
Rooted2020 stefano maccaglia--_the_enemy_of_my_enemyRooted2020 stefano maccaglia--_the_enemy_of_my_enemy
Rooted2020 stefano maccaglia--_the_enemy_of_my_enemy
 
Rooted2020 taller de-reversing_de_binarios_escritos_en_golang_-_mariano_palom...
Rooted2020 taller de-reversing_de_binarios_escritos_en_golang_-_mariano_palom...Rooted2020 taller de-reversing_de_binarios_escritos_en_golang_-_mariano_palom...
Rooted2020 taller de-reversing_de_binarios_escritos_en_golang_-_mariano_palom...
 
Rooted2020 virtual pwned-network_-_manel_molina
Rooted2020 virtual pwned-network_-_manel_molinaRooted2020 virtual pwned-network_-_manel_molina
Rooted2020 virtual pwned-network_-_manel_molina
 
Rooted2020 van a-mear_sangre_como_hacer_que_los_malos_lo_paguen_muy_caro_-_an...
Rooted2020 van a-mear_sangre_como_hacer_que_los_malos_lo_paguen_muy_caro_-_an...Rooted2020 van a-mear_sangre_como_hacer_que_los_malos_lo_paguen_muy_caro_-_an...
Rooted2020 van a-mear_sangre_como_hacer_que_los_malos_lo_paguen_muy_caro_-_an...
 
Rooted2020 todo a-siem_-_marta_lopez
Rooted2020 todo a-siem_-_marta_lopezRooted2020 todo a-siem_-_marta_lopez
Rooted2020 todo a-siem_-_marta_lopez
 
Rooted2020 roapt evil-mass_storage_-_tu-ya_aqui_-_david_reguera_-_abel_valero
Rooted2020 roapt evil-mass_storage_-_tu-ya_aqui_-_david_reguera_-_abel_valeroRooted2020 roapt evil-mass_storage_-_tu-ya_aqui_-_david_reguera_-_abel_valero
Rooted2020 roapt evil-mass_storage_-_tu-ya_aqui_-_david_reguera_-_abel_valero
 
Rooted2020 live coding--_jesus_jara
Rooted2020 live coding--_jesus_jaraRooted2020 live coding--_jesus_jara
Rooted2020 live coding--_jesus_jara
 
Rooted2020 legalidad de-la_prueba_tecnologica_indiciaria_cuando_tu_papi_es_un...
Rooted2020 legalidad de-la_prueba_tecnologica_indiciaria_cuando_tu_papi_es_un...Rooted2020 legalidad de-la_prueba_tecnologica_indiciaria_cuando_tu_papi_es_un...
Rooted2020 legalidad de-la_prueba_tecnologica_indiciaria_cuando_tu_papi_es_un...
 
Rooted2020 hackeando el-mundo_exterior_a_traves_de_bluetooth_low-energy_ble_-...
Rooted2020 hackeando el-mundo_exterior_a_traves_de_bluetooth_low-energy_ble_-...Rooted2020 hackeando el-mundo_exterior_a_traves_de_bluetooth_low-energy_ble_-...
Rooted2020 hackeando el-mundo_exterior_a_traves_de_bluetooth_low-energy_ble_-...
 
Rooted2020 evading deep-learning_malware_detectors_-_javier_yuste
Rooted2020 evading deep-learning_malware_detectors_-_javier_yusteRooted2020 evading deep-learning_malware_detectors_-_javier_yuste
Rooted2020 evading deep-learning_malware_detectors_-_javier_yuste
 
Rooted2020 encontrando 0days-en_2020_-_antonio_morales
Rooted2020 encontrando 0days-en_2020_-_antonio_moralesRooted2020 encontrando 0days-en_2020_-_antonio_morales
Rooted2020 encontrando 0days-en_2020_-_antonio_morales
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

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
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
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
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
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
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 

José Selvi - Historia de un CryptoFAIL [rootedvlc4]

  • 1. A CRYPTO-FAIL STORY RootedCON Valencia September 2017
  • 2. 2 Jose Selvi (@Jose Selvi) +12 years in the infosec industry Principal Penetration Tester & Security Researcher SANS Institute Community Instructor GIAC Security Expert (GSE) Blogger (sometimes): http://www.pentester.es $ WHOIS JSELVI
  • 3. 3 I DID NOT MAKE A FULL VULNERABILITY RESEARCH
  • 4. 4 THIS IS NOT A CRYPTO TRAINING
  • 5. 5
  • 6. 6
  • 7. 7 TESTING CRYPTO IN 30 MINUTES test1@test.com : 123456 -> 5A 8D 7D B4 DB B4 05 E9 AB CC 2D 46 AD AD 21 7F test1@test.com : 123456 -> 5A 8D 7D B4 DB B4 05 E9 AB CC 2D 46 AD AD 21 7F REUSE SALT, REUSE IV test1@test.com : 123456 -> 5A 8D 7D B4 DB B4 05 E9 AB CC 2D 46 AD AD 21 7F test1@test.com : 000000 -> 2E C7 7C 2A 19 6E 02 2B AA 68 7E F0 61 67 51 B0 test1@test.com : 123456 -> 5A 8D 7D B4 DB B4 05 E9 AB CC 2D 46 AD AD 21 7F test2@test.com : 123456 -> 7B 49 CF 4D E4 32 1E 77 93 21 1A B5 74 8B 44 DA BASED ON EMAIL & PASSWORD BLOCK CIPHER (REVERSIBLE) ENCRYPTION B6 78 78 BD F5 72 FC BE 04 8B D5 33 44 98 7B 02 23 97 F8 B5 BD 63 3F 6D F8 AB 13 64 76 DD 37 BE 5A 8D 7D B4 DB B4 05 E9 AB CC 2D 46 AD AD 21 7F
  • 9. 9 NO EXPLOITATION, NO FUN POTENTIALLY EXPLOITABLE WE PRESUME THAT WITH ENOUGH EFFORT IT COULD BE EXPLOITED
  • 10. 10 QUICK LOOK AT THE BINARY $ rabin2 -i server.exe | grep -i crypt ordinal=001 plt=0x005c80c4 bind=NONE type=FUNC name=CRYPTUI.dll_CryptUIDlgViewCertificateW ordinal=001 plt=0x005c8098 bind=NONE type=FUNC name=CRYPT32.dll_CertEnumCertificatesInStore ordinal=002 plt=0x005c809c bind=NONE type=FUNC name=CRYPT32.dll_CertCloseStore ordinal=003 plt=0x005c80a0 bind=NONE type=FUNC name=CRYPT32.dll_CertFreeCertificateContext ordinal=004 plt=0x005c80a4 bind=NONE type=FUNC name=CRYPT32.dll_CertGetCertificateContextProperty ordinal=005 plt=0x005c80a8 bind=NONE type=FUNC name=CRYPT32.dll_CertDuplicateCertificateContext ordinal=006 plt=0x005c80ac bind=NONE type=FUNC name=CRYPT32.dll_CertGetEnhancedKeyUsage ordinal=007 plt=0x005c80b0 bind=NONE type=FUNC name=CRYPT32.dll_CertGetNameStringW ordinal=008 plt=0x005c80b4 bind=NONE type=FUNC name=CRYPT32.dll_CertOpenStore ordinal=009 plt=0x005c80b8 bind=NONE type=FUNC name=CRYPT32.dll_CryptProtectData ordinal=010 plt=0x005c80bc bind=NONE type=FUNC name=CRYPT32.dll_CryptUnprotectData $ rabin2 -zz server.exe | grep -i crypt vaddr=0x00626ff6 paddr=0x002257f6 ordinal=21488 sz=27 len=26 section=.rdata type=ascii string=CryptUIDlgViewCertificateW vaddr=0x00627012 paddr=0x00225812 ordinal=21489 sz=12 len=11 section=.rdata type=ascii string=CRYPTUI.dll vaddr=0x0062755a paddr=0x00225d5a ordinal=21555 sz=17 len=16 section=.rdata type=ascii string=CryptProtectData vaddr=0x0062756e paddr=0x00225d6e ordinal=21556 sz=19 len=18 section=.rdata type=ascii string=CryptUnprotectData vaddr=0x00627582 paddr=0x00225d82 ordinal=21557 sz=12 len=11 section=.rdata type=ascii string=CRYPT32.dll vaddr=0x0062f6e0 paddr=0x0022dae0 ordinal=22387 sz=40 len=39 section=.data type=ascii string=.?AU? $Deleter@UCryptData@@P6AHPAU1@@Z@@ vaddr=0x0062f710 paddr=0x0022db10 ordinal=22388 sz=30 len=29 section=.data type=ascii string=.?AV? $TPointer@UCryptData@@@@ vaddr=0x0062f738 paddr=0x0022db38 ordinal=22389 sz=34 len=33 section=.data type=ascii string=.?AV? $TAutoFreeObj@UCryptData@@@@
  • 11. 11
  • 12. 12 HASHING ALGORITHMS static void reset(uint32_t digest[], std::string &buffer, uint64_t &transforms) { /* SHA1 initialization constants */ digest[0] = 0x67452301; digest[1] = 0xefcdab89; digest[2] = 0x98badcfe; digest[3] = 0x10325476; digest[4] = 0xc3d2e1f0; /* Reset counters */ buffer = ""; transforms = 0; }
  • 15. 15
  • 16. 16
  • 17. 17 AES has 10 rounds for 128-bit keys, 12 rounds for 192-bit keys, and 14 rounds for 256-bit keys.
  • 18. 18
  • 19. 19
  • 20. 20
  • 21. 21
  • 22. 22 CRACKING THE “HASH” $ ./crack my@email.com 52796b User: my@email.com Password: test123456
  • 24. 24 DO NOT USE ECB MODE NEVER EVER
  • 25. 25 $ echo Testing1234 | openssl enc -aes-128-ecb -K 1234 -iv 1 | hexd 0000000 8d 47 5c 5f bb 1b 1c 0a 79 ca e5 45 6a 8f c4 58 $ echo Testing1234 | openssl enc -aes-128-ecb -K 1234 -iv 2 | hexd 0000000 8d 47 5c 5f bb 1b 1c 0a 79 ca e5 45 6a 8f c4 58 $ echo Testing1234 | openssl enc -aes-128-cbc -K 1234 -iv 0001 | hexdump 0000000 d5 1e 92 d4 ce 72 dc ab 6d e9 c0 b6 bb 39 de f7 $ echo Testing1234 | openssl enc -aes-128-cbc -K 1234 -iv 0002 | hexdump 0000000 1b 28 1f e3 10 fa 69 14 8b 80 e2 64 97 2e 93 d0
  • 27. 27 ALWAYS USE DIFFERENT IVs ON EACH MESSAGE
  • 28. 28 REUSING IVs ON AES $ echo Testing1234 | openssl enc -aes-128-cbc -K 1234 -iv 1 | hexdump 0000000 d5 1e 92 d4 ce 72 dc ab 6d e9 c0 b6 bb 39 de f7 $ echo Testing1234 | openssl enc -aes-128-cbc -K 1234 -iv 1 | hexdump 0000000 d5 1e 92 d4 ce 72 dc ab 6d e9 c0 b6 bb 39 de f7 $ echo Testing1234 | openssl enc -aes-128-cbc -K 1234 -iv 1 | hexdump 0000000 d5 1e 92 d4 ce 72 dc ab 6d e9 c0 b6 bb 39 de f7 $ echo Testing1234 | openssl enc -aes-128-cbc -K 1234 -iv 1 | hexdump 0000000 d5 1e 92 d4 ce 72 dc ab 6d e9 c0 b6 bb 39 de f7 $ echo Testing1234 | openssl enc -aes-128-cbc -K 1234 -iv 1 | hexdump 0000000 d5 1e 92 d4 ce 72 dc ab 6d e9 c0 b6 bb 39 de f7
  • 29. 29 REUSING IVs ON STREAM CIPHERS W E L C O M E T O T H I S 12 34 56 78 9A BC DE F0 12 34 56 78 9A BC DE F0 H I D D E N M E S S A G E ! . 12 34 56 78 9A BC DE F0 12 34 56 78 9A BC DE F0 (M1 ⊕ KEY) ⊕ (M2 ⊕ KEY) M1 ⊕ M2
  • 30. 30 DO NOT USE REVERSIBLE ENCRYPTION FOR PASSWORDS
  • 31. Credentials Storage 31 AUTHENTICATION & HASHING pass1234 Client Side Server Side XYZW XYZW
  • 32. Code Credentials Storage 32 SALT & PEPPER pass1234 Client Side Server Side SALT$XYZW SALT$XYZW PEPPER PEPPERSALT
  • 33. 33 PASSWORD SPECIFIC HASHING: PBKDF2, BCRYPT, SCRYPT, …
  • 34. 34 SERIOUSLY, DO NOT KEEP SECRETS AT CLIENT SIDE
  • 35. XYZWABCD Random Token Generator Token Storage 35 RANDOM TOKENS Client Side Server Side XYZWABCD
  • 36. JSON Token Generator XYZWABCD Token Storage 36 JSON WEB TOKENS (JWT) Client Side Server Side Certification Authority CA
  • 37. www.prosegur.comwww.prosegur.com THANKS A LOT! ANY QUESTIONS? jose.selvi@prosegur.com jselvi@pentester.es @JoseSelvi