SlideShare a Scribd company logo
1 of 43
Download to read offline
Breaking Smart [Bank] Statements
How to read a Bank Statement without a password
SECURITY RESEARCHER @
TRUSTWAVE SPIDERLABS RESEARCH –VAT
OCTOBER 10, 2019
Manuel Nader
Agenda
Context
Analysis of the file
Analysis of JavaScript
RC4
Demo
Analysis after fix
Conclusions
Q & A
01
02
03
04
05
06
07
08
Whoami
• Work
• Security Researcher at Trustwave SpiderLabs.
• Previously worked in the offensive side of security (Ethical Hacking).
• Before that he worked on the defensive side of security.
• Extra
• Web attacks, DDoS
• Dogs, tacos
• Twitter: @AgoraSecurity
Context
Disclosure Timeline
• Disclosure to SLR Intelligence: March 21, 2018
• SLR Intelligence contacted the vendor: March 22, 2018
• Vendor responded: April 30, 2018
• Vendor (responsible.disclosure@citi.com) confirms fix: July 19,
2018
Context – Who?
• CitiBanamex
• One of the largest Banks in Mexico (3rd biggest bank1 in Mexico).
• Part of Citigroup (one of the biggest groups in the world).
1. https://www.forbes.com.mx/los-10-bancos-mas-grandes-de-mexico/
• In Mexico, it’s possible to receive
your monthly bank statement via
email.
• Mexico's banking and securities
regulator (CNBV) says that security
mechanisms must be applied to
the bank statement to avoid an
unauthorized third party.2
2. Titulo Quinto --> Capítulo X --> Sección Segunda --> Artículo 313
http://www.cnbv.gob.mx/Normatividad/Disposiciones%20de%20carácter%20general%20aplicables%20a%20las%20instituciones%20de%20crédito.pdf
Context – Bank Statement via email
• CitiBanamex send two types of Bank Statements:
1. Encrypted PDF. Used for most accounts.
2. Smart Statements. Send only3 to Credit Cards of the type “Tarjetas Oro,
Prestige y Beyond Citibanamex”.
• Fun Fact: They have a FAQ page4 for the Smart Statement.
• Question 3 (translated):
• 3. Is my Smart Statement safe?
• The Smart Statement has the highest security protocols worldwide, which is
why it is just as safe as your PDF Account Statement.
3. Information from 2018
4. https://www.banamex.com/citialert/smartstatement/resources/faqs.pdf?lid=MX%7Ces%7Cpersonas%7Cbanca-digital%7Cestado-de-cuenta-TextoBottom-04102017-
Information-irFAQsSmartStatement-ES-ES
Context – CitiBanamex Bank Statement via email
Analysis of the file
First view of the HTML
Incorrect Password
Correct Password
Private data,
address
CC number
What does the HTML contain?
• The HTML is around 2.3 – 3 MB.
– Contains lots of JavaScript (around 93%).
– Some CSS (around 6%).
– Some HTML (around 1%).
What is happening?
• First impression: Security via obscurity and some type of
encryption:
• Analysis of the HTML
Analysis of the JavaScript
JS Analysis #1
• It has 31 JavaScript functions and a lot of variables.
– Some are very similar: hexCrypt0, hexCrypt1, hexCrypt2, etc.
– One is particularly interesting: validatePswd
• After some beautify of the JS and following the logic, here’s a simple
diagram of what’s happening:
User submits
password
SHA1 of the
password is
obtained
(hashTypedPswd)
Second SHA1
hash is obtained
and compared
against
‘validatePswd’
If they are equal,
decrypt the
message.
Note: Use the first hash as the
key:
`desenc(hashTypedPswd)`
• The ‘desenc’ function is quite
simple:
− Calls one functions 30 times (push the
result to an array).
− Replace the window with the content of the
array.
• What does the function decrypt
do?
JS Analysis #2
• The ‘decrypt’ function is:• Looks like RC4.
• RC4 is a stream cipher.
− It has more than 20 years.
− It’s not considered a strong encryption
algorithm.
• Line 18 is different (they are not
adding +1).
• They are using the same key
(remember previous slide)!
JS Analysis #3
RC4
RC4 – What is it?
• RC4. Rivest Cipher 4 also known
as ARC4.
• Was initially a trade secret.
• Is a stream cipher.
• Extra: Listen CRYPTO WARS
(DARKNET DIARIES) Source: Wikipedia.
https://en.wikipedia.org/wiki/RC4
RC4 – Overview #1
• A stream cipher is a symmetric key cipher where plaintext digits
are combined with a pseudorandom cipher digit stream
(keystream), RC4 is a stream cipher.
• For RC4, the keystream is independent of the plaintext
(Synchronous stream cipher).
• The algorithm does 2
main things:
• Key Scheduling
algorithm (KSA)
• PRGA: XOR the plaintext
(get the encrypted text)
and keep generating
the keystream
www.hackerhalted.com 23
RC4 – Overview #2
PRGA
algorithm
(keystream)
Plaintext
Encrypted
text
Key
RC4 KSA
Algorithm
Input for
PGRA
• The KSA does:
1. Initialize an array (s) with all
values from 0 to 255.
2. Scramble array using key.
• Output is an array that will be
used to generate the keystream.
www.hackerhalted.com 24
RC4 – Overview #3
1
2
• For every element of
the plaintext, the PRGA:
• Gets the next element
of the keystream
• XOR the plaintext with
the keystream
www.hackerhalted.com 25
RC4 – Overview #4
• To sum up RC4:
• The keystream is generated
using the key.
• You will always have the same
keystream if you use the same
key.
• The plaintext XOR the
keystream = the encrypted
message.
www.hackerhalted.com 26
RC4 – Overview #5
RC4 – Security
• There are some attacks on the algorithm, but they are not very simple.
• You should never use the same key to encrypt more than one message
in a stream cipher.
• The same key is used to encrypt 30 different messages.
• The desired output is always an HTML and we can do a Known-plaintext
attack.
Breaking RC4 – Known-plaintext attack # 1
• For each bit:
𝐶 = 𝑍 ⊕ 𝑀
• Which is equal to:
𝑍 = 𝐶 ⊕ 𝑀
C = Encrypted Text
Z = Keystream
M = Plain Text Message
• We have the Encrypted Message and it is split in ~30 variables [for
our convenience].
• Could we obtain the Keystream?
• Could we obtain the complete plain text?
Breaking RC4 – Known-plaintext attack # 2
• Decrypted HTML:
− Looks like it’s going to be the same for every
Bank Statement.
− HTML normal headers & comments.
− jQuery
Breaking RC4 – Known-plaintext attack # 3
• Could we obtain the Keystream?
Keystream = Cipher Text1 ⊕ Plain Text1
• Could we obtain the complete plain text?
Plain Textn = Cipher Textn ⊕ Keystream
Breaking RC4 – Known-plaintext attack # 2
• Idea behind the exploit:
1
2
3
Breaking RC4 – Exploit
1. Use plain text we know (first ~3% of the HTML).
2. Obtain the keystream.
3. Decrypt the message using the keystream.
Demo
Possible Fixes
Possible Fixes
• There are many possible solutions, some ideas are:
• Don’t send the bank statement to the user via email (ask to login for download).
• Don’t reuse the same key in a stream cipher.
• This is, join the variables or use an IV.
• Use an algorithm that is considered safe.
• Could you think of other?
Analysis After the Fix
Fix #1
• Decrypt function now uses AES
• Use of CryptoJS v3.1.2
• aes.js
• sha256.js
Fix #2
• Join all text together before decrypting:
Fix #3
• Use a SHA256 of the password as the key:
Conclusion
Conclusion
• It’s a good idea to have a security review before rolling out a new product.
• Hire specialists if needed.
• Always use cryptography algorithms that are considered safe.
• Never roll your own cryptography algorithms (nor implement them differently).
• Never use the same key more than once in a stream cipher.
• If possible, have a simple, safe & clear way of communicating security issues to your organization.
• Blog: https://www.trustwave.com/en-us/resources/blogs/spiderlabs-blog/breaking-smart-bank-
statements/
Questions and Next Steps
Breaking Smart [Bank] Statements – Hacker Halted 2019 – Manuel Nader

More Related Content

What's hot

Advanced Threats and Lateral Movement Detection
Advanced Threats and Lateral Movement DetectionAdvanced Threats and Lateral Movement Detection
Advanced Threats and Lateral Movement DetectionGreg Foss
 
BSidesCharleston2014 - Ballin on a Budget: Tracking Chinese Malware Campaigns...
BSidesCharleston2014 - Ballin on a Budget: Tracking Chinese Malware Campaigns...BSidesCharleston2014 - Ballin on a Budget: Tracking Chinese Malware Campaigns...
BSidesCharleston2014 - Ballin on a Budget: Tracking Chinese Malware Campaigns...Andrew Morris
 
Fade from Whitehat... to Black
Fade from Whitehat... to BlackFade from Whitehat... to Black
Fade from Whitehat... to BlackBeau Bullock
 
Assessing a pen tester: Making the right choice when choosing a third party P...
Assessing a pen tester: Making the right choice when choosing a third party P...Assessing a pen tester: Making the right choice when choosing a third party P...
Assessing a pen tester: Making the right choice when choosing a third party P...Jason Broz, CIPP/US
 
MonkeySpider at Sicherheit 2008
MonkeySpider at Sicherheit 2008MonkeySpider at Sicherheit 2008
MonkeySpider at Sicherheit 2008Ali Ikinci
 
Tracking Exploit Kits - Virus Bulletin 2016
Tracking Exploit Kits - Virus Bulletin 2016Tracking Exploit Kits - Virus Bulletin 2016
Tracking Exploit Kits - Virus Bulletin 2016John Bambenek
 
Using GreyNoise to Quantify Response Time of Cloud Provider Abuse Teams
Using GreyNoise to Quantify Response Time of Cloud Provider Abuse TeamsUsing GreyNoise to Quantify Response Time of Cloud Provider Abuse Teams
Using GreyNoise to Quantify Response Time of Cloud Provider Abuse TeamsAndrew Morris
 
Cybercrime and the Developer Java2Days 2016 Sofia
Cybercrime and the Developer Java2Days 2016 SofiaCybercrime and the Developer Java2Days 2016 Sofia
Cybercrime and the Developer Java2Days 2016 SofiaSteve Poole
 
Are your cloud servers under attack?– Hacker Halted 2019 – Brian Hileman
Are your cloud servers under attack?– Hacker Halted 2019 – Brian HilemanAre your cloud servers under attack?– Hacker Halted 2019 – Brian Hileman
Are your cloud servers under attack?– Hacker Halted 2019 – Brian HilemanEC-Council
 
Threat Intelligence Field of Dreams
Threat Intelligence Field of DreamsThreat Intelligence Field of Dreams
Threat Intelligence Field of DreamsGreg Foss
 
Staying Ahead of Internet Background Exploitation - Microsoft BlueHat Israel ...
Staying Ahead of Internet Background Exploitation - Microsoft BlueHat Israel ...Staying Ahead of Internet Background Exploitation - Microsoft BlueHat Israel ...
Staying Ahead of Internet Background Exploitation - Microsoft BlueHat Israel ...Andrew Morris
 
Capture the Flag Exercise Using Active Deception Defense
Capture the Flag Exercise Using Active Deception DefenseCapture the Flag Exercise Using Active Deception Defense
Capture the Flag Exercise Using Active Deception DefenseFidelis Cybersecurity
 
OSINT for Attack and Defense
OSINT for Attack and DefenseOSINT for Attack and Defense
OSINT for Attack and DefenseAndrew McNicol
 
Red Team Apocalypse
Red Team ApocalypseRed Team Apocalypse
Red Team ApocalypseBeau Bullock
 
Navigating the Security Landscape
Navigating the Security LandscapeNavigating the Security Landscape
Navigating the Security LandscapeSucuri
 
Malware analysis, threat intelligence and reverse engineering
Malware analysis, threat intelligence and reverse engineeringMalware analysis, threat intelligence and reverse engineering
Malware analysis, threat intelligence and reverse engineeringbartblaze
 
What you need to know about OSINT
What you need to know about OSINTWhat you need to know about OSINT
What you need to know about OSINTJerod Brennen
 
Network Security and Cryptography.pdf
Network Security and Cryptography.pdfNetwork Security and Cryptography.pdf
Network Security and Cryptography.pdfAdityaKumar1548
 
OSINT using Twitter & Python
OSINT using Twitter & PythonOSINT using Twitter & Python
OSINT using Twitter & Python37point2
 
LonestarPHP 2014 Security Keynote
LonestarPHP 2014 Security KeynoteLonestarPHP 2014 Security Keynote
LonestarPHP 2014 Security KeynoteAlison Gianotto
 

What's hot (20)

Advanced Threats and Lateral Movement Detection
Advanced Threats and Lateral Movement DetectionAdvanced Threats and Lateral Movement Detection
Advanced Threats and Lateral Movement Detection
 
BSidesCharleston2014 - Ballin on a Budget: Tracking Chinese Malware Campaigns...
BSidesCharleston2014 - Ballin on a Budget: Tracking Chinese Malware Campaigns...BSidesCharleston2014 - Ballin on a Budget: Tracking Chinese Malware Campaigns...
BSidesCharleston2014 - Ballin on a Budget: Tracking Chinese Malware Campaigns...
 
Fade from Whitehat... to Black
Fade from Whitehat... to BlackFade from Whitehat... to Black
Fade from Whitehat... to Black
 
Assessing a pen tester: Making the right choice when choosing a third party P...
Assessing a pen tester: Making the right choice when choosing a third party P...Assessing a pen tester: Making the right choice when choosing a third party P...
Assessing a pen tester: Making the right choice when choosing a third party P...
 
MonkeySpider at Sicherheit 2008
MonkeySpider at Sicherheit 2008MonkeySpider at Sicherheit 2008
MonkeySpider at Sicherheit 2008
 
Tracking Exploit Kits - Virus Bulletin 2016
Tracking Exploit Kits - Virus Bulletin 2016Tracking Exploit Kits - Virus Bulletin 2016
Tracking Exploit Kits - Virus Bulletin 2016
 
Using GreyNoise to Quantify Response Time of Cloud Provider Abuse Teams
Using GreyNoise to Quantify Response Time of Cloud Provider Abuse TeamsUsing GreyNoise to Quantify Response Time of Cloud Provider Abuse Teams
Using GreyNoise to Quantify Response Time of Cloud Provider Abuse Teams
 
Cybercrime and the Developer Java2Days 2016 Sofia
Cybercrime and the Developer Java2Days 2016 SofiaCybercrime and the Developer Java2Days 2016 Sofia
Cybercrime and the Developer Java2Days 2016 Sofia
 
Are your cloud servers under attack?– Hacker Halted 2019 – Brian Hileman
Are your cloud servers under attack?– Hacker Halted 2019 – Brian HilemanAre your cloud servers under attack?– Hacker Halted 2019 – Brian Hileman
Are your cloud servers under attack?– Hacker Halted 2019 – Brian Hileman
 
Threat Intelligence Field of Dreams
Threat Intelligence Field of DreamsThreat Intelligence Field of Dreams
Threat Intelligence Field of Dreams
 
Staying Ahead of Internet Background Exploitation - Microsoft BlueHat Israel ...
Staying Ahead of Internet Background Exploitation - Microsoft BlueHat Israel ...Staying Ahead of Internet Background Exploitation - Microsoft BlueHat Israel ...
Staying Ahead of Internet Background Exploitation - Microsoft BlueHat Israel ...
 
Capture the Flag Exercise Using Active Deception Defense
Capture the Flag Exercise Using Active Deception DefenseCapture the Flag Exercise Using Active Deception Defense
Capture the Flag Exercise Using Active Deception Defense
 
OSINT for Attack and Defense
OSINT for Attack and DefenseOSINT for Attack and Defense
OSINT for Attack and Defense
 
Red Team Apocalypse
Red Team ApocalypseRed Team Apocalypse
Red Team Apocalypse
 
Navigating the Security Landscape
Navigating the Security LandscapeNavigating the Security Landscape
Navigating the Security Landscape
 
Malware analysis, threat intelligence and reverse engineering
Malware analysis, threat intelligence and reverse engineeringMalware analysis, threat intelligence and reverse engineering
Malware analysis, threat intelligence and reverse engineering
 
What you need to know about OSINT
What you need to know about OSINTWhat you need to know about OSINT
What you need to know about OSINT
 
Network Security and Cryptography.pdf
Network Security and Cryptography.pdfNetwork Security and Cryptography.pdf
Network Security and Cryptography.pdf
 
OSINT using Twitter & Python
OSINT using Twitter & PythonOSINT using Twitter & Python
OSINT using Twitter & Python
 
LonestarPHP 2014 Security Keynote
LonestarPHP 2014 Security KeynoteLonestarPHP 2014 Security Keynote
LonestarPHP 2014 Security Keynote
 

Similar to Breaking Smart [Bank] Statements – Hacker Halted 2019 – Manuel Nader

Cryptography in Blockchain
Cryptography in BlockchainCryptography in Blockchain
Cryptography in BlockchainEC-Council
 
UNIT 4 CRYPTOGRAPHIC SYSTEMS.pptx
UNIT 4  CRYPTOGRAPHIC SYSTEMS.pptxUNIT 4  CRYPTOGRAPHIC SYSTEMS.pptx
UNIT 4 CRYPTOGRAPHIC SYSTEMS.pptxssuserd5e356
 
Workshop on Network Security
Workshop on Network SecurityWorkshop on Network Security
Workshop on Network SecurityUC San Diego
 
Encryption in php
Encryption in phpEncryption in php
Encryption in phpsana mateen
 
Classical Cryptography and Digital Encryption
Classical Cryptography and Digital EncryptionClassical Cryptography and Digital Encryption
Classical Cryptography and Digital EncryptionDamaineFranklinMScBE
 
Cryptanalysis in the Time of Ransomware
Cryptanalysis in the Time of RansomwareCryptanalysis in the Time of Ransomware
Cryptanalysis in the Time of RansomwareMark Mager
 
Symmetric ciphermodel
Symmetric ciphermodelSymmetric ciphermodel
Symmetric ciphermodelpriyapavi96
 
Iaetsd enhanced cryptography algorithm for providing
Iaetsd enhanced cryptography algorithm for providingIaetsd enhanced cryptography algorithm for providing
Iaetsd enhanced cryptography algorithm for providingIaetsd Iaetsd
 
Common crypto attacks and secure implementations
Common crypto attacks and secure implementationsCommon crypto attacks and secure implementations
Common crypto attacks and secure implementationsTrupti Shiralkar, CISSP
 
Message authentication and hash function
Message authentication and hash functionMessage authentication and hash function
Message authentication and hash functionomarShiekh1
 
Cryptography for Penetration Testers (PDF version)
Cryptography for Penetration Testers (PDF version)Cryptography for Penetration Testers (PDF version)
Cryptography for Penetration Testers (PDF version)ceng
 
CNIT 123 12: Cryptography
CNIT 123 12: CryptographyCNIT 123 12: Cryptography
CNIT 123 12: CryptographySam Bowne
 
PANDEMONIUM: Automated Identification of Cryptographic Algorithms using Dynam...
PANDEMONIUM: Automated Identification of Cryptographic Algorithms using Dynam...PANDEMONIUM: Automated Identification of Cryptographic Algorithms using Dynam...
PANDEMONIUM: Automated Identification of Cryptographic Algorithms using Dynam...CODE BLUE
 
Information System Security.pptx
Information System  Security.pptxInformation System  Security.pptx
Information System Security.pptxGIT
 
Fundamentals of Information Encryption
Fundamentals of Information EncryptionFundamentals of Information Encryption
Fundamentals of Information EncryptionAmna Magzoub
 
CH2 Stallings,_William_Computer_Security_Principles_and_Practice_Pearson [54-...
CH2 Stallings,_William_Computer_Security_Principles_and_Practice_Pearson [54-...CH2 Stallings,_William_Computer_Security_Principles_and_Practice_Pearson [54-...
CH2 Stallings,_William_Computer_Security_Principles_and_Practice_Pearson [54-...ams1ams11
 

Similar to Breaking Smart [Bank] Statements – Hacker Halted 2019 – Manuel Nader (20)

Cryptography in Blockchain
Cryptography in BlockchainCryptography in Blockchain
Cryptography in Blockchain
 
UNIT 4 CRYPTOGRAPHIC SYSTEMS.pptx
UNIT 4  CRYPTOGRAPHIC SYSTEMS.pptxUNIT 4  CRYPTOGRAPHIC SYSTEMS.pptx
UNIT 4 CRYPTOGRAPHIC SYSTEMS.pptx
 
Workshop on Network Security
Workshop on Network SecurityWorkshop on Network Security
Workshop on Network Security
 
Encryption in php
Encryption in phpEncryption in php
Encryption in php
 
Classical Cryptography and Digital Encryption
Classical Cryptography and Digital EncryptionClassical Cryptography and Digital Encryption
Classical Cryptography and Digital Encryption
 
Cryptanalysis in the Time of Ransomware
Cryptanalysis in the Time of RansomwareCryptanalysis in the Time of Ransomware
Cryptanalysis in the Time of Ransomware
 
SSL overview
SSL overviewSSL overview
SSL overview
 
Symmetric ciphermodel
Symmetric ciphermodelSymmetric ciphermodel
Symmetric ciphermodel
 
Iaetsd enhanced cryptography algorithm for providing
Iaetsd enhanced cryptography algorithm for providingIaetsd enhanced cryptography algorithm for providing
Iaetsd enhanced cryptography algorithm for providing
 
rspamd-fosdem
rspamd-fosdemrspamd-fosdem
rspamd-fosdem
 
Common crypto attacks and secure implementations
Common crypto attacks and secure implementationsCommon crypto attacks and secure implementations
Common crypto attacks and secure implementations
 
Message authentication and hash function
Message authentication and hash functionMessage authentication and hash function
Message authentication and hash function
 
Cryptography for Penetration Testers (PDF version)
Cryptography for Penetration Testers (PDF version)Cryptography for Penetration Testers (PDF version)
Cryptography for Penetration Testers (PDF version)
 
CNIT 123 12: Cryptography
CNIT 123 12: CryptographyCNIT 123 12: Cryptography
CNIT 123 12: Cryptography
 
PANDEMONIUM: Automated Identification of Cryptographic Algorithms using Dynam...
PANDEMONIUM: Automated Identification of Cryptographic Algorithms using Dynam...PANDEMONIUM: Automated Identification of Cryptographic Algorithms using Dynam...
PANDEMONIUM: Automated Identification of Cryptographic Algorithms using Dynam...
 
Information System Security.pptx
Information System  Security.pptxInformation System  Security.pptx
Information System Security.pptx
 
Slidecast - Workshop
Slidecast - WorkshopSlidecast - Workshop
Slidecast - Workshop
 
Fundamentals of Information Encryption
Fundamentals of Information EncryptionFundamentals of Information Encryption
Fundamentals of Information Encryption
 
Cryptography cse,ru
Cryptography cse,ruCryptography cse,ru
Cryptography cse,ru
 
CH2 Stallings,_William_Computer_Security_Principles_and_Practice_Pearson [54-...
CH2 Stallings,_William_Computer_Security_Principles_and_Practice_Pearson [54-...CH2 Stallings,_William_Computer_Security_Principles_and_Practice_Pearson [54-...
CH2 Stallings,_William_Computer_Security_Principles_and_Practice_Pearson [54-...
 

More from EC-Council

CyberOm - Hacking the Wellness Code in a Chaotic Cyber World
CyberOm - Hacking the Wellness Code in a Chaotic Cyber WorldCyberOm - Hacking the Wellness Code in a Chaotic Cyber World
CyberOm - Hacking the Wellness Code in a Chaotic Cyber WorldEC-Council
 
Cloud Security Architecture - a different approach
Cloud Security Architecture - a different approachCloud Security Architecture - a different approach
Cloud Security Architecture - a different approachEC-Council
 
Phases of Incident Response
Phases of Incident ResponsePhases of Incident Response
Phases of Incident ResponseEC-Council
 
Weaponizing OSINT – Hacker Halted 2019 – Michael James
 Weaponizing OSINT – Hacker Halted 2019 – Michael James  Weaponizing OSINT – Hacker Halted 2019 – Michael James
Weaponizing OSINT – Hacker Halted 2019 – Michael James EC-Council
 
Hacking Your Career – Hacker Halted 2019 – Keith Turpin
Hacking Your Career – Hacker Halted 2019 – Keith TurpinHacking Your Career – Hacker Halted 2019 – Keith Turpin
Hacking Your Career – Hacker Halted 2019 – Keith TurpinEC-Council
 
Hacking Diversity – Hacker Halted . 2019 – Marcelle Lee
Hacking Diversity – Hacker Halted . 2019 – Marcelle LeeHacking Diversity – Hacker Halted . 2019 – Marcelle Lee
Hacking Diversity – Hacker Halted . 2019 – Marcelle LeeEC-Council
 
Cloud Proxy Technology – Hacker Halted 2019 – Jeff Silver
Cloud Proxy Technology – Hacker Halted 2019 – Jeff SilverCloud Proxy Technology – Hacker Halted 2019 – Jeff Silver
Cloud Proxy Technology – Hacker Halted 2019 – Jeff SilverEC-Council
 
Data in cars can be creepy – Hacker Halted 2019 – Andrea Amico
Data in cars can be creepy – Hacker Halted 2019 – Andrea AmicoData in cars can be creepy – Hacker Halted 2019 – Andrea Amico
Data in cars can be creepy – Hacker Halted 2019 – Andrea AmicoEC-Council
 
War Game: Ransomware – Global CISO Forum 2019
War Game: Ransomware – Global CISO Forum 2019War Game: Ransomware – Global CISO Forum 2019
War Game: Ransomware – Global CISO Forum 2019EC-Council
 
How to become a Security Behavior Alchemist – Global CISO Forum 2019 – Perry ...
How to become a Security Behavior Alchemist – Global CISO Forum 2019 – Perry ...How to become a Security Behavior Alchemist – Global CISO Forum 2019 – Perry ...
How to become a Security Behavior Alchemist – Global CISO Forum 2019 – Perry ...EC-Council
 
Introduction to FAIR Risk Methodology – Global CISO Forum 2019 – Donna Gall...
Introduction to FAIR Risk Methodology – Global CISO Forum 2019  –  Donna Gall...Introduction to FAIR Risk Methodology – Global CISO Forum 2019  –  Donna Gall...
Introduction to FAIR Risk Methodology – Global CISO Forum 2019 – Donna Gall...EC-Council
 
Alexa is a snitch! Hacker Halted 2019 - Wes Widner
Alexa is a snitch! Hacker Halted 2019 - Wes WidnerAlexa is a snitch! Hacker Halted 2019 - Wes Widner
Alexa is a snitch! Hacker Halted 2019 - Wes WidnerEC-Council
 
Hacker Halted 2018: Don't Panic! Big Data Analytics vs. Law Enforcement
Hacker Halted 2018: Don't Panic! Big Data Analytics vs. Law EnforcementHacker Halted 2018: Don't Panic! Big Data Analytics vs. Law Enforcement
Hacker Halted 2018: Don't Panic! Big Data Analytics vs. Law EnforcementEC-Council
 
Hacker Halted 2018: HACKING TRILLIAN: A 42-STEP SOLUTION TO EXPLOIT POST-VOGA...
Hacker Halted 2018: HACKING TRILLIAN: A 42-STEP SOLUTION TO EXPLOIT POST-VOGA...Hacker Halted 2018: HACKING TRILLIAN: A 42-STEP SOLUTION TO EXPLOIT POST-VOGA...
Hacker Halted 2018: HACKING TRILLIAN: A 42-STEP SOLUTION TO EXPLOIT POST-VOGA...EC-Council
 
Hacker Halted 2018: Breaking the Bad News: How to Prevent Your IR Messages fr...
Hacker Halted 2018: Breaking the Bad News: How to Prevent Your IR Messages fr...Hacker Halted 2018: Breaking the Bad News: How to Prevent Your IR Messages fr...
Hacker Halted 2018: Breaking the Bad News: How to Prevent Your IR Messages fr...EC-Council
 
Hacker Halted 2018: SE vs Predator: Using Social Engineering in ways I never ...
Hacker Halted 2018: SE vs Predator: Using Social Engineering in ways I never ...Hacker Halted 2018: SE vs Predator: Using Social Engineering in ways I never ...
Hacker Halted 2018: SE vs Predator: Using Social Engineering in ways I never ...EC-Council
 
Global CCISO Forum 2018 | Sebastian Hess "Cyber Insurance and Cyber Risk Quan...
Global CCISO Forum 2018 | Sebastian Hess "Cyber Insurance and Cyber Risk Quan...Global CCISO Forum 2018 | Sebastian Hess "Cyber Insurance and Cyber Risk Quan...
Global CCISO Forum 2018 | Sebastian Hess "Cyber Insurance and Cyber Risk Quan...EC-Council
 
Global CCISO Forum 2018 | John Felker "Partnerships to Address Threats"
 Global CCISO Forum 2018 | John Felker "Partnerships to Address Threats" Global CCISO Forum 2018 | John Felker "Partnerships to Address Threats"
Global CCISO Forum 2018 | John Felker "Partnerships to Address Threats"EC-Council
 
Global CCISO Forum 2018 | Sharon Smith "Don't Panic"
Global CCISO Forum 2018 | Sharon Smith "Don't Panic"Global CCISO Forum 2018 | Sharon Smith "Don't Panic"
Global CCISO Forum 2018 | Sharon Smith "Don't Panic"EC-Council
 
Global CCISO Forum 2018 | AI vs Malware 2018
Global CCISO Forum 2018 | AI vs Malware 2018Global CCISO Forum 2018 | AI vs Malware 2018
Global CCISO Forum 2018 | AI vs Malware 2018EC-Council
 

More from EC-Council (20)

CyberOm - Hacking the Wellness Code in a Chaotic Cyber World
CyberOm - Hacking the Wellness Code in a Chaotic Cyber WorldCyberOm - Hacking the Wellness Code in a Chaotic Cyber World
CyberOm - Hacking the Wellness Code in a Chaotic Cyber World
 
Cloud Security Architecture - a different approach
Cloud Security Architecture - a different approachCloud Security Architecture - a different approach
Cloud Security Architecture - a different approach
 
Phases of Incident Response
Phases of Incident ResponsePhases of Incident Response
Phases of Incident Response
 
Weaponizing OSINT – Hacker Halted 2019 – Michael James
 Weaponizing OSINT – Hacker Halted 2019 – Michael James  Weaponizing OSINT – Hacker Halted 2019 – Michael James
Weaponizing OSINT – Hacker Halted 2019 – Michael James
 
Hacking Your Career – Hacker Halted 2019 – Keith Turpin
Hacking Your Career – Hacker Halted 2019 – Keith TurpinHacking Your Career – Hacker Halted 2019 – Keith Turpin
Hacking Your Career – Hacker Halted 2019 – Keith Turpin
 
Hacking Diversity – Hacker Halted . 2019 – Marcelle Lee
Hacking Diversity – Hacker Halted . 2019 – Marcelle LeeHacking Diversity – Hacker Halted . 2019 – Marcelle Lee
Hacking Diversity – Hacker Halted . 2019 – Marcelle Lee
 
Cloud Proxy Technology – Hacker Halted 2019 – Jeff Silver
Cloud Proxy Technology – Hacker Halted 2019 – Jeff SilverCloud Proxy Technology – Hacker Halted 2019 – Jeff Silver
Cloud Proxy Technology – Hacker Halted 2019 – Jeff Silver
 
Data in cars can be creepy – Hacker Halted 2019 – Andrea Amico
Data in cars can be creepy – Hacker Halted 2019 – Andrea AmicoData in cars can be creepy – Hacker Halted 2019 – Andrea Amico
Data in cars can be creepy – Hacker Halted 2019 – Andrea Amico
 
War Game: Ransomware – Global CISO Forum 2019
War Game: Ransomware – Global CISO Forum 2019War Game: Ransomware – Global CISO Forum 2019
War Game: Ransomware – Global CISO Forum 2019
 
How to become a Security Behavior Alchemist – Global CISO Forum 2019 – Perry ...
How to become a Security Behavior Alchemist – Global CISO Forum 2019 – Perry ...How to become a Security Behavior Alchemist – Global CISO Forum 2019 – Perry ...
How to become a Security Behavior Alchemist – Global CISO Forum 2019 – Perry ...
 
Introduction to FAIR Risk Methodology – Global CISO Forum 2019 – Donna Gall...
Introduction to FAIR Risk Methodology – Global CISO Forum 2019  –  Donna Gall...Introduction to FAIR Risk Methodology – Global CISO Forum 2019  –  Donna Gall...
Introduction to FAIR Risk Methodology – Global CISO Forum 2019 – Donna Gall...
 
Alexa is a snitch! Hacker Halted 2019 - Wes Widner
Alexa is a snitch! Hacker Halted 2019 - Wes WidnerAlexa is a snitch! Hacker Halted 2019 - Wes Widner
Alexa is a snitch! Hacker Halted 2019 - Wes Widner
 
Hacker Halted 2018: Don't Panic! Big Data Analytics vs. Law Enforcement
Hacker Halted 2018: Don't Panic! Big Data Analytics vs. Law EnforcementHacker Halted 2018: Don't Panic! Big Data Analytics vs. Law Enforcement
Hacker Halted 2018: Don't Panic! Big Data Analytics vs. Law Enforcement
 
Hacker Halted 2018: HACKING TRILLIAN: A 42-STEP SOLUTION TO EXPLOIT POST-VOGA...
Hacker Halted 2018: HACKING TRILLIAN: A 42-STEP SOLUTION TO EXPLOIT POST-VOGA...Hacker Halted 2018: HACKING TRILLIAN: A 42-STEP SOLUTION TO EXPLOIT POST-VOGA...
Hacker Halted 2018: HACKING TRILLIAN: A 42-STEP SOLUTION TO EXPLOIT POST-VOGA...
 
Hacker Halted 2018: Breaking the Bad News: How to Prevent Your IR Messages fr...
Hacker Halted 2018: Breaking the Bad News: How to Prevent Your IR Messages fr...Hacker Halted 2018: Breaking the Bad News: How to Prevent Your IR Messages fr...
Hacker Halted 2018: Breaking the Bad News: How to Prevent Your IR Messages fr...
 
Hacker Halted 2018: SE vs Predator: Using Social Engineering in ways I never ...
Hacker Halted 2018: SE vs Predator: Using Social Engineering in ways I never ...Hacker Halted 2018: SE vs Predator: Using Social Engineering in ways I never ...
Hacker Halted 2018: SE vs Predator: Using Social Engineering in ways I never ...
 
Global CCISO Forum 2018 | Sebastian Hess "Cyber Insurance and Cyber Risk Quan...
Global CCISO Forum 2018 | Sebastian Hess "Cyber Insurance and Cyber Risk Quan...Global CCISO Forum 2018 | Sebastian Hess "Cyber Insurance and Cyber Risk Quan...
Global CCISO Forum 2018 | Sebastian Hess "Cyber Insurance and Cyber Risk Quan...
 
Global CCISO Forum 2018 | John Felker "Partnerships to Address Threats"
 Global CCISO Forum 2018 | John Felker "Partnerships to Address Threats" Global CCISO Forum 2018 | John Felker "Partnerships to Address Threats"
Global CCISO Forum 2018 | John Felker "Partnerships to Address Threats"
 
Global CCISO Forum 2018 | Sharon Smith "Don't Panic"
Global CCISO Forum 2018 | Sharon Smith "Don't Panic"Global CCISO Forum 2018 | Sharon Smith "Don't Panic"
Global CCISO Forum 2018 | Sharon Smith "Don't Panic"
 
Global CCISO Forum 2018 | AI vs Malware 2018
Global CCISO Forum 2018 | AI vs Malware 2018Global CCISO Forum 2018 | AI vs Malware 2018
Global CCISO Forum 2018 | AI vs Malware 2018
 

Recently uploaded

DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 

Recently uploaded (20)

DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 

Breaking Smart [Bank] Statements – Hacker Halted 2019 – Manuel Nader

  • 1. Breaking Smart [Bank] Statements How to read a Bank Statement without a password
  • 2. SECURITY RESEARCHER @ TRUSTWAVE SPIDERLABS RESEARCH –VAT OCTOBER 10, 2019 Manuel Nader
  • 3. Agenda Context Analysis of the file Analysis of JavaScript RC4 Demo Analysis after fix Conclusions Q & A 01 02 03 04 05 06 07 08
  • 4. Whoami • Work • Security Researcher at Trustwave SpiderLabs. • Previously worked in the offensive side of security (Ethical Hacking). • Before that he worked on the defensive side of security. • Extra • Web attacks, DDoS • Dogs, tacos • Twitter: @AgoraSecurity
  • 6. Disclosure Timeline • Disclosure to SLR Intelligence: March 21, 2018 • SLR Intelligence contacted the vendor: March 22, 2018 • Vendor responded: April 30, 2018 • Vendor (responsible.disclosure@citi.com) confirms fix: July 19, 2018
  • 7. Context – Who? • CitiBanamex • One of the largest Banks in Mexico (3rd biggest bank1 in Mexico). • Part of Citigroup (one of the biggest groups in the world). 1. https://www.forbes.com.mx/los-10-bancos-mas-grandes-de-mexico/
  • 8. • In Mexico, it’s possible to receive your monthly bank statement via email. • Mexico's banking and securities regulator (CNBV) says that security mechanisms must be applied to the bank statement to avoid an unauthorized third party.2 2. Titulo Quinto --> Capítulo X --> Sección Segunda --> Artículo 313 http://www.cnbv.gob.mx/Normatividad/Disposiciones%20de%20carácter%20general%20aplicables%20a%20las%20instituciones%20de%20crédito.pdf Context – Bank Statement via email
  • 9. • CitiBanamex send two types of Bank Statements: 1. Encrypted PDF. Used for most accounts. 2. Smart Statements. Send only3 to Credit Cards of the type “Tarjetas Oro, Prestige y Beyond Citibanamex”. • Fun Fact: They have a FAQ page4 for the Smart Statement. • Question 3 (translated): • 3. Is my Smart Statement safe? • The Smart Statement has the highest security protocols worldwide, which is why it is just as safe as your PDF Account Statement. 3. Information from 2018 4. https://www.banamex.com/citialert/smartstatement/resources/faqs.pdf?lid=MX%7Ces%7Cpersonas%7Cbanca-digital%7Cestado-de-cuenta-TextoBottom-04102017- Information-irFAQsSmartStatement-ES-ES Context – CitiBanamex Bank Statement via email
  • 11. First view of the HTML
  • 14. What does the HTML contain? • The HTML is around 2.3 – 3 MB. – Contains lots of JavaScript (around 93%). – Some CSS (around 6%). – Some HTML (around 1%).
  • 15. What is happening? • First impression: Security via obscurity and some type of encryption: • Analysis of the HTML
  • 16. Analysis of the JavaScript
  • 17. JS Analysis #1 • It has 31 JavaScript functions and a lot of variables. – Some are very similar: hexCrypt0, hexCrypt1, hexCrypt2, etc. – One is particularly interesting: validatePswd • After some beautify of the JS and following the logic, here’s a simple diagram of what’s happening: User submits password SHA1 of the password is obtained (hashTypedPswd) Second SHA1 hash is obtained and compared against ‘validatePswd’ If they are equal, decrypt the message. Note: Use the first hash as the key: `desenc(hashTypedPswd)`
  • 18. • The ‘desenc’ function is quite simple: − Calls one functions 30 times (push the result to an array). − Replace the window with the content of the array. • What does the function decrypt do? JS Analysis #2
  • 19. • The ‘decrypt’ function is:• Looks like RC4. • RC4 is a stream cipher. − It has more than 20 years. − It’s not considered a strong encryption algorithm. • Line 18 is different (they are not adding +1). • They are using the same key (remember previous slide)! JS Analysis #3
  • 20. RC4
  • 21. RC4 – What is it? • RC4. Rivest Cipher 4 also known as ARC4. • Was initially a trade secret. • Is a stream cipher. • Extra: Listen CRYPTO WARS (DARKNET DIARIES) Source: Wikipedia. https://en.wikipedia.org/wiki/RC4
  • 22. RC4 – Overview #1 • A stream cipher is a symmetric key cipher where plaintext digits are combined with a pseudorandom cipher digit stream (keystream), RC4 is a stream cipher. • For RC4, the keystream is independent of the plaintext (Synchronous stream cipher).
  • 23. • The algorithm does 2 main things: • Key Scheduling algorithm (KSA) • PRGA: XOR the plaintext (get the encrypted text) and keep generating the keystream www.hackerhalted.com 23 RC4 – Overview #2 PRGA algorithm (keystream) Plaintext Encrypted text Key RC4 KSA Algorithm Input for PGRA
  • 24. • The KSA does: 1. Initialize an array (s) with all values from 0 to 255. 2. Scramble array using key. • Output is an array that will be used to generate the keystream. www.hackerhalted.com 24 RC4 – Overview #3 1 2
  • 25. • For every element of the plaintext, the PRGA: • Gets the next element of the keystream • XOR the plaintext with the keystream www.hackerhalted.com 25 RC4 – Overview #4
  • 26. • To sum up RC4: • The keystream is generated using the key. • You will always have the same keystream if you use the same key. • The plaintext XOR the keystream = the encrypted message. www.hackerhalted.com 26 RC4 – Overview #5
  • 27. RC4 – Security • There are some attacks on the algorithm, but they are not very simple. • You should never use the same key to encrypt more than one message in a stream cipher. • The same key is used to encrypt 30 different messages. • The desired output is always an HTML and we can do a Known-plaintext attack.
  • 28. Breaking RC4 – Known-plaintext attack # 1 • For each bit: 𝐶 = 𝑍 ⊕ 𝑀 • Which is equal to: 𝑍 = 𝐶 ⊕ 𝑀 C = Encrypted Text Z = Keystream M = Plain Text Message
  • 29. • We have the Encrypted Message and it is split in ~30 variables [for our convenience]. • Could we obtain the Keystream? • Could we obtain the complete plain text? Breaking RC4 – Known-plaintext attack # 2
  • 30. • Decrypted HTML: − Looks like it’s going to be the same for every Bank Statement. − HTML normal headers & comments. − jQuery Breaking RC4 – Known-plaintext attack # 3
  • 31. • Could we obtain the Keystream? Keystream = Cipher Text1 ⊕ Plain Text1 • Could we obtain the complete plain text? Plain Textn = Cipher Textn ⊕ Keystream Breaking RC4 – Known-plaintext attack # 2
  • 32. • Idea behind the exploit: 1 2 3 Breaking RC4 – Exploit 1. Use plain text we know (first ~3% of the HTML). 2. Obtain the keystream. 3. Decrypt the message using the keystream.
  • 33. Demo
  • 35. Possible Fixes • There are many possible solutions, some ideas are: • Don’t send the bank statement to the user via email (ask to login for download). • Don’t reuse the same key in a stream cipher. • This is, join the variables or use an IV. • Use an algorithm that is considered safe. • Could you think of other?
  • 37. Fix #1 • Decrypt function now uses AES • Use of CryptoJS v3.1.2 • aes.js • sha256.js
  • 38. Fix #2 • Join all text together before decrypting:
  • 39. Fix #3 • Use a SHA256 of the password as the key:
  • 41. Conclusion • It’s a good idea to have a security review before rolling out a new product. • Hire specialists if needed. • Always use cryptography algorithms that are considered safe. • Never roll your own cryptography algorithms (nor implement them differently). • Never use the same key more than once in a stream cipher. • If possible, have a simple, safe & clear way of communicating security issues to your organization. • Blog: https://www.trustwave.com/en-us/resources/blogs/spiderlabs-blog/breaking-smart-bank- statements/