SlideShare a Scribd company logo
1McAfee Foundstone Services
McAfee
WannaCry
Technical Insight and Lessons Learned
Thomas Roccia | Security Consultant Researcher
2McAfee Foundstone Services
McAfee
Presentation
• Thomas Roccia
• McAfee Foundstone Consultant
• Twitter: @fr0gger_
3McAfee Foundstone Services
Overview
§ Wannacry Presentation
§ about the Exploit Code
§ Technical Overview
§ Lessons Learned
§ Conclusion
§ Summary – Q & A
Summary
PROFESSIONAL SERVICES
Introduction
The Increasing Malware Threat
5McAfee Foundstone Services
The Increasing Malware Threat
§ Today the malware threat is really increasing
and lot of stolen data are sold in the
underground markets.
§ Malware are new weapons used by a lot of
actors:
§ Governments
§ Spies
§ Hacktivist
§ Mafia
§ Even kids
§ The challenge is huge for attackers and
defenders
6McAfee Foundstone Services
The Increasing Ransomware Threat
§ Ransomware is an increase threat.
§ The first ransomware was pretty much Scarewares
(Without encryption).
§ Today Ransomware is more powerfull and encrypts with a
solid algorithm your data or even used exploit code.
§ Wannacry was very mediatic due to this automatedand
quick spreading.
Introduction
PROFESSIONAL SERVICES
Wannacry Presentation
The Largest Ransomware Attack
8McAfee Foundstone Services
Wannacry Presentation
§ WannaCry is a ransomware that hit the World in
May 2017.
§ It combined Ransomware capabilities with Worm
techniques to spread automatically across the
network.
§ The Worm exploits a vulnerability into SMB that was
discovered previously by the NSA (EquationGroup).
§ More than 230 000 computers in over 150
countries were infected.
§ Big companies like the NHS, FedEx or Renault were
impacted by it.
9McAfee Foundstone Services
Wannacry Presentation
Map Infection
10McAfee Foundstone Services
Why is Wannacry Big?
WannaCry
Ransomware
No user
interaction
needed
Remote code
Exploit
PROFESSIONAL SERVICES
The Story About the Exploit Code
12McAfee Foundstone Services
The Shadow Brokers
§ The Shadow Brokers is a hacker group who first
appeared in the summer of 2016.
§ They published several leaks containing hacking
tools from the National Security Agency,
including several zero-day exploits.
§ First message appeared in August 2016
§ The leak with all the zero day was publicly available
for free in April 15th 2017
The Story about the Exploit Code
13McAfee Foundstone Services
The Exploit Code used by Wannacry
Exploit Code Used by Wannacry
The Story about the Exploit Code
§ WannaCry used the exploit code EternalBlue.
§ EternalBlue exploits a vulnerability in the Server Message Block (SMB) protocol.
§ This vulnerability is denoted by entry CVE-2017-0144.
§ The vulnerability exists because the SMB version 1 (SMBv1) server in various versions of Microsoft
Windows accepts specially crafted packets from remote attackers, allowing them to execute
arbitrary code on the target computer.
§ The Windows security update on 14 March 2017 resolved the issue via security update MS17-010.
14McAfee Foundstone Services
Exploit Code used by Wannacry
Exploit Code Used by Wannacry
The Story about the Exploit Code
§ In addition to EternalBlue exploit, Wannacry used the
DoublePulsar Implant.
§ The implant using a Kernel DLL injection technique
allowing the attacker the full right on the compromised
system.
§ Payload in memory was XORed to remain undetected.
§ Then the shellcode was injected directly into lsass.exe.
PROFESSIONAL SERVICES
Wannacry Technical Overview
16McAfee Foundstone Services
Key Characteristic
§ Uses the MS17-010 “EternalBlue” exploit to spread to
other machines through SMB
§ Malware generates random target IP addresses, not
limited to the local network
§ Hardcoded IP addresses.
§ Payload delivered by the SMB packets is encrypted
§ Malware dropper contains code to check for two specific
domains before executing its ransomware or the network
exploit codes.
§ Dropper variants do not exhibit this same behavior –no “kill
switch”, no exploit, target mounted networkshares
§ 3 Bitcoin wallets being used to receive payment from
victims - Tor browser used for anonymous payment
Wannacry Technical Overview
17McAfee Foundstone Services
Content
Wannacry Technical Overview
§ msg -This folder contains the RTF describing the
different instructions for the ransomware. Totaling 28
languages.
§ b.wnry - BMP ransom image used as a background
image replacement by the malware.
§ c.wnry -  configuration file containing the target
address, but also the tor communication endpoints
information.
§ s.wnry - Tor client to communication with the above
endpoints.
§ u.wnry - UI interface of the ransomware, containing
the communications routines and password
validation.
§ t.wnry - “WANACRY!” file — contains default keys
• The initial file is a ZIP protected (Password: WNcry@2ol7)containing several other files that
are dropped into the infected system.
18McAfee Foundstone Services
§ Wannacry has a kill switch function to stop the spreading.
§ hxxp://www[dot]iuqerfsodp9ifjaposdfjhgosurijfaewrwergwea[dot]com
§ hxxp://www[dot]ifferfsodp9ifjaposdfjhgosurijfaewrwergwea[dot]com
Kill Switch Function
Wannacry Technical Overview
19McAfee Foundstone Services
§ Wannacry spreads across the network by scanning a range of IP dynamically generated.
How Wannacry Spreads
Wannacry Technical Overview
20McAfee Foundstone Services
§ SMB Requests through the network
SMB Exploit
Wannacry Technical Overview
21McAfee Foundstone Services
§ Infection Flow
SMB Exploit
Wannacry Technical Overview
22McAfee Foundstone Services
§ Extract resource zip file XIA with hardcoded password “WNcry@2ol7”
§ Get c.wnry, which includes the Tor configuration used by the malware used by the malware
§ Extract the configuration from c.wnry to get the Tor browser and onion sites to be used for communication and
onion sites to be used for communication:
§ gx7ekbenv2riucmf.onion;
§ 57g7spgrzlojinas.onion;
§ xxlvbrloxvriy2c5.onion;
§ 76jdd2ir2embyv47.onion;
§ cwwnhwhlz52maqm7.onion;
§ Load Bitcoin wallets which have been previously set up by the attackers for payment for file
restoration and update c.wnry
§ “13AM4VW2dhxYgXeQepoHkHSQuy6NgaEb94”
§ “12t9YDPgwueZ9NyMgw519p7AA8isjr6SMw"
§ “115p7UMMngoj1pMvkpHijcRdfJNXj6LrLn"
Ransomware Behavior
Wannacry Technical Overview
23McAfee Foundstone Services
§ Hide Extract Zip Directory and Modify Security Descriptors
§ Create process: Runs command to hide current directory: attrib +h
§ Runs command:
§ icacls . /grant Everyone:F /T /C /Q. This grants all users full access to files
in the current directory and all directories below.
§ Prep Encryption Public Key, AES Key…
§ Creates Mutex for all threads: GlobalMsWinZonesCacheCounterMutexW
Ransomware Behavior
Wannacry Technical Overview
24McAfee Foundstone Services
§ Creates a new thread to overwrite files on disk
§ Generate a key
§ Generate Data Buffers for each file
§ Call thread for function StartAddress to begin writing encrypting file contents
§ Tack on extension ".WNCRYT”
§ Run new process taskdl.exe in a new thread
§ Set Up the Decrypter Persistence
§ Create process "taskse.exe @WanaDecryptor@.exe”
§ Set persistence key to run itself on reboot HKCUSOFTWAREMicrosoftWindowsCurrentVersionRun
§ CheckTokenMembership, GetComputerName Info
§ Run: cmd.exe /c reg add "HKCUSOFTWAREMicrosoftWindowsCurrentVersionRun” /v
"<rand>" /t REG_SZ /d “"tasksche.exe"" /f
Ransomware Behavior
Wannacry Technical Overview
25McAfee Foundstone Services
.der, .pfx, .key, .crt, .csr, .p12, .pem, .odt, .sxw, .stw, .3ds, .max, .3dm, .ods,
.sxc, .stc, .dif, .slk, .wb2, .odp, .sxd, .std, .sxm, .sqlite3, .sqlitedb, .sql,
.accdb, .mdb, .dbf, .odb, .mdf, .ldf, .cpp, .pas, .asm, .cmd, .bat, .vbs, .sch,
.jsp, .php, .asp, .java, .jar, .class, .mp3, .wav, .swf, .fla, .wmv, .mpg, .vob,
.mpeg, .asf, .avi, .mov, .mp4, .mkv, .flv, .wma, .mid, .m3u, .m4u, .svg, .psd,
.tiff, .tif, .raw, .gif, .png, .bmp, .jpg, .jpeg, .iso, .backup, .zip, .rar, .tgz, .tar,
.bak, .ARC, .vmdk, .vdi, .sldm, .sldx, .sti, .sxi, .dwg, .pdf, .wk1, .wks, .rtf,
.csv, .txt, .msg, .pst, .ppsx, .ppsm, .pps, .pot, .pptm, .pptx, .ppt, .xltm, .xltx,
.xlc, .xlm, .xlt, .xlw, .xlsb, .xlsm, .xlsx, .xls, .dotm, .dot, .docm, .docx, .doc,
Targeted file extension
Wannacry Technical Overview
26McAfee Foundstone Services
Format of the Encrypted file
Wannacry Technical Overview
27McAfee Foundstone Services
§ 3 walllets 50 Bitcoins (115 000€)
Bitcoin Wallet
Wannacry Technical Overview
PROFESSIONAL SERVICES
How to Recover Your Files
29McAfee Foundstone Services
§ Wannacry uses AES encryption to encrypt files.
§ Then the AES key is encrypted in RSA.
§ The RSA private key is generated dynamically
in memory.
§ The keys are immediately destroying.
Wannacry Encryption
How to Recover Your Files
30McAfee Foundstone Services
§ Wannacry uses 2 functions to destroy the keys in memory:
§ CryptDestroyKey: free the memory that the key used.
§ CryptReleaseContext: release the Cryptography Service Provider (CSP).
§ French Security Researcher discovered that these functions does not release the prime numbers into
the memory.
§ Allowing the victim to generate the private key if the memory is not freeing.
§ Wannakiwi is a tool that looks for the prime number in the memory.
https://github.com/gentilkiwi/wanakiwi
The bug
How to Recover Your Files
PROFESSIONAL SERVICES
Wannacry Legacy
32McAfee Foundstone Services
§ Wannacry inspired several other attackers.
§ After this attack we saw many other variants that
spread the same manner and use the EternalBlue
Exploit.
§ New variant of Wannacry were used (no kill
switch…).
§ Adylkuzz which used the same exploit to spread.
§ EternalRocks
§ UIWIX Ransomware
Wannacry Legacy
PROFESSIONAL SERVICES
Lessons Learned
34McAfee Foundstone Services
§ Threat intelligence is a key to know what’s happened in the Infosec World!
§ Shadow Brokers was known since one year.
§ The leak was published in April 2017
§ Patch Management is crucial!
§ Wannacry exploited a known vulnerability CVE-2017-0144.
§ Microsoft published the March 14 the security update MS17-010
§ Disable unnecessary services!
§ The SMB is not use everywhere
§ Disable if not needed.
Vulnerability
Lessons Learned
35McAfee Foundstone Services
Security
§ Teach your people!
§ Train your security team for Malware Analysis
§ Perform user awareness training for users
§ Follow the best practices against Ransomware
threat!
§ Backup file
§ Manage the user and admin right
§ Create an Incident Response Program!
§ Do the right things when an incident occurs.
Lessons Learned
36McAfee Foundstone Services
www.NoMoreRansom.org
37McAfee Foundstone Services
§ Wannacry is not an advanced Ransomware, however the worm capabilities allows it to spread very
quickly.
§ EquationGroup exploit leak let powerful tools for attackers.
§ The Ransomware threats are still evolving to be more powerful.
§ Malware are still growing so does attack surfaces
§ Security best practices still efficient (Backup, Update, Awareness…)
§ Setup advanced malware detection technics like Sandboxing and machine learning
Conclusion
Q & A
McAfee, the McAfee logo and [insert <other relevant McAfee Names>] are trademarks or registered trademarks of McAfee LLC or its subsidiaries in the U.S. and/or other countries.
Other names and brands may be claimed as the property of others.
Copyright © 2017 McAfee LLC.

More Related Content

What's hot (20)

PDF
Pentest with Metasploit
M.Syarifudin, ST, OSCP, OSWP
 
PPTX
System hacking
CAS
 
PPTX
What is Ransomware
jeetendra mandal
 
PDF
Vulnerability and Patch Management
n|u - The Open Security Community
 
PPTX
Cyber kill chain
Ankita Ganguly
 
PDF
Local File Inclusion to Remote Code Execution
n|u - The Open Security Community
 
PDF
Penetration testing
Ammar WK
 
PDF
Sécurité des applications web: attaque et défense
Antonio Fontes
 
PPTX
Cisco Web and Email Security Overview
Cisco Security
 
PDF
Carlos García - Pentesting Active Directory Forests [rooted2019]
RootedCON
 
PPTX
AWS Cloud Security
AWS Riyadh User Group
 
PPTX
OWASP Top 10 2021 Presentation (Jul 2022)
TzahiArabov
 
PPTX
Ransomware
Chaitali Sharma
 
PPTX
Cyber Security Best Practices
Evolve IP
 
PDF
Ransomware attacks
Texas Medical Liability Trust
 
PDF
CNIT 121: Computer Forensics Ch 1
Sam Bowne
 
PPT
Ch01 Introduction to Security
Information Technology
 
PPTX
An introduction to denial of service attacks
Rollingsherman
 
ODP
pfSense presentation
Simon Vass
 
PPT
Wannacry-A Ransomware Attack
MahimaVerma28
 
Pentest with Metasploit
M.Syarifudin, ST, OSCP, OSWP
 
System hacking
CAS
 
What is Ransomware
jeetendra mandal
 
Vulnerability and Patch Management
n|u - The Open Security Community
 
Cyber kill chain
Ankita Ganguly
 
Local File Inclusion to Remote Code Execution
n|u - The Open Security Community
 
Penetration testing
Ammar WK
 
Sécurité des applications web: attaque et défense
Antonio Fontes
 
Cisco Web and Email Security Overview
Cisco Security
 
Carlos García - Pentesting Active Directory Forests [rooted2019]
RootedCON
 
AWS Cloud Security
AWS Riyadh User Group
 
OWASP Top 10 2021 Presentation (Jul 2022)
TzahiArabov
 
Ransomware
Chaitali Sharma
 
Cyber Security Best Practices
Evolve IP
 
Ransomware attacks
Texas Medical Liability Trust
 
CNIT 121: Computer Forensics Ch 1
Sam Bowne
 
Ch01 Introduction to Security
Information Technology
 
An introduction to denial of service attacks
Rollingsherman
 
pfSense presentation
Simon Vass
 
Wannacry-A Ransomware Attack
MahimaVerma28
 

Similar to Wannacry | Technical Insight and Lessons Learned (20)

PPT
Protecting Your organization from WannaCry Ransomware
Quick Heal Technologies Ltd.
 
PPTX
BlueHat v17 || Wannacrypt + Smbv1.0 Vulnerability = One of the Most Damaging ...
BlueHat Security Conference
 
PDF
3. Ransomware (cyber awareness series)
Isaac Feliciano
 
PDF
ALARMING RANSOMWARE
Santosh Kushwaha
 
PPTX
Ransomware - what is it, how to protect against it
Zoltan Balazs
 
PDF
Your Guide to tackle the Ransomware threat "WannaCry" | Sysfore
Sysfore Technologies
 
PPTX
Ransomware: WanaCry, WanCrypt
Yash Diwakar
 
PDF
Palestra Jeferson Propheta - Wanna Cry more
BHack Conference
 
PPTX
Crypto-Jacking, Ransomware & Worming Malware's Frightening Future (Keynote an...
Jay Beale
 
PDF
Ransomware ly
Lisa Young
 
PDF
Your Money or Your Data: Ransomware, Cyber Security and Today’s Threat Landsc...
Roger Hagedorn
 
PPT
WannaCrygehieiwkwjwhwhwiwiwjwhhwjwjhw.ppt
HasanNudin31
 
PPT
WannaCryppthisiiskhsisksksksjgshsksksk.ppt
HasanNudin31
 
PPTX
WannaCry? No Thanks!
Roberto Martelloni
 
PDF
Ransomware Trends 2017 & Mitigation Techniques
Avinash Sinha
 
PDF
Ransomware (1).pdf
HiYeti1
 
PDF
Ransomware- What you need to know to Safeguard your Data
Inderjeet Singh
 
PPTX
Ransomware attack and its effects on cyber crimes
ShilpaShreeD
 
PPTX
Defend Your Company Against Ransomware
Kevo Meehan
 
Protecting Your organization from WannaCry Ransomware
Quick Heal Technologies Ltd.
 
BlueHat v17 || Wannacrypt + Smbv1.0 Vulnerability = One of the Most Damaging ...
BlueHat Security Conference
 
3. Ransomware (cyber awareness series)
Isaac Feliciano
 
ALARMING RANSOMWARE
Santosh Kushwaha
 
Ransomware - what is it, how to protect against it
Zoltan Balazs
 
Your Guide to tackle the Ransomware threat "WannaCry" | Sysfore
Sysfore Technologies
 
Ransomware: WanaCry, WanCrypt
Yash Diwakar
 
Palestra Jeferson Propheta - Wanna Cry more
BHack Conference
 
Crypto-Jacking, Ransomware & Worming Malware's Frightening Future (Keynote an...
Jay Beale
 
Ransomware ly
Lisa Young
 
Your Money or Your Data: Ransomware, Cyber Security and Today’s Threat Landsc...
Roger Hagedorn
 
WannaCrygehieiwkwjwhwhwiwiwjwhhwjwjhw.ppt
HasanNudin31
 
WannaCryppthisiiskhsisksksksjgshsksksk.ppt
HasanNudin31
 
WannaCry? No Thanks!
Roberto Martelloni
 
Ransomware Trends 2017 & Mitigation Techniques
Avinash Sinha
 
Ransomware (1).pdf
HiYeti1
 
Ransomware- What you need to know to Safeguard your Data
Inderjeet Singh
 
Ransomware attack and its effects on cyber crimes
ShilpaShreeD
 
Defend Your Company Against Ransomware
Kevo Meehan
 
Ad

More from Thomas Roccia (9)

PDF
TRITON: The Next Generation of ICS Malware
Thomas Roccia
 
PPTX
CoinMiners are Evasive - BsidesTLV
Thomas Roccia
 
PDF
42 - Malware - Understand the Threat and How to Respond
Thomas Roccia
 
PDF
Sandbox Evasion Cheat Sheet
Thomas Roccia
 
PDF
Malware Evasion Techniques
Thomas Roccia
 
PDF
Ransomware Teslacrypt Uncovered - Malware Analysis
Thomas Roccia
 
PDF
Research Paper on Digital Forensic
Thomas Roccia
 
PDF
Windows Kernel Debugging
Thomas Roccia
 
PDF
Sec day cuckoo_workshop
Thomas Roccia
 
TRITON: The Next Generation of ICS Malware
Thomas Roccia
 
CoinMiners are Evasive - BsidesTLV
Thomas Roccia
 
42 - Malware - Understand the Threat and How to Respond
Thomas Roccia
 
Sandbox Evasion Cheat Sheet
Thomas Roccia
 
Malware Evasion Techniques
Thomas Roccia
 
Ransomware Teslacrypt Uncovered - Malware Analysis
Thomas Roccia
 
Research Paper on Digital Forensic
Thomas Roccia
 
Windows Kernel Debugging
Thomas Roccia
 
Sec day cuckoo_workshop
Thomas Roccia
 
Ad

Recently uploaded (20)

PDF
Per Axbom: The spectacular lies of maps
Nexer Digital
 
PPTX
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
PDF
NewMind AI Weekly Chronicles – July’25, Week III
NewMind AI
 
PDF
introduction to computer hardware and sofeware
chauhanshraddha2007
 
PDF
TrustArc Webinar - Navigating Data Privacy in LATAM: Laws, Trends, and Compli...
TrustArc
 
PDF
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
PDF
Researching The Best Chat SDK Providers in 2025
Ray Fields
 
PDF
OpenInfra ID 2025 - Are Containers Dying? Rethinking Isolation with MicroVMs.pdf
Muhammad Yuga Nugraha
 
PDF
Brief History of Internet - Early Days of Internet
sutharharshit158
 
PDF
Peak of Data & AI Encore - Real-Time Insights & Scalable Editing with ArcGIS
Safe Software
 
PDF
State-Dependent Conformal Perception Bounds for Neuro-Symbolic Verification
Ivan Ruchkin
 
PDF
Market Insight : ETH Dominance Returns
CIFDAQ
 
PPTX
The Future of AI & Machine Learning.pptx
pritsen4700
 
PDF
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
PDF
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
PPTX
Machine Learning Benefits Across Industries
SynapseIndia
 
PPTX
Agile Chennai 18-19 July 2025 Ideathon | AI Powered Microfinance Literacy Gui...
AgileNetwork
 
PPTX
AVL ( audio, visuals or led ), technology.
Rajeshwri Panchal
 
PDF
Build with AI and GDG Cloud Bydgoszcz- ADK .pdf
jaroslawgajewski1
 
PDF
RAT Builders - How to Catch Them All [DeepSec 2024]
malmoeb
 
Per Axbom: The spectacular lies of maps
Nexer Digital
 
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
NewMind AI Weekly Chronicles – July’25, Week III
NewMind AI
 
introduction to computer hardware and sofeware
chauhanshraddha2007
 
TrustArc Webinar - Navigating Data Privacy in LATAM: Laws, Trends, and Compli...
TrustArc
 
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
Researching The Best Chat SDK Providers in 2025
Ray Fields
 
OpenInfra ID 2025 - Are Containers Dying? Rethinking Isolation with MicroVMs.pdf
Muhammad Yuga Nugraha
 
Brief History of Internet - Early Days of Internet
sutharharshit158
 
Peak of Data & AI Encore - Real-Time Insights & Scalable Editing with ArcGIS
Safe Software
 
State-Dependent Conformal Perception Bounds for Neuro-Symbolic Verification
Ivan Ruchkin
 
Market Insight : ETH Dominance Returns
CIFDAQ
 
The Future of AI & Machine Learning.pptx
pritsen4700
 
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
Machine Learning Benefits Across Industries
SynapseIndia
 
Agile Chennai 18-19 July 2025 Ideathon | AI Powered Microfinance Literacy Gui...
AgileNetwork
 
AVL ( audio, visuals or led ), technology.
Rajeshwri Panchal
 
Build with AI and GDG Cloud Bydgoszcz- ADK .pdf
jaroslawgajewski1
 
RAT Builders - How to Catch Them All [DeepSec 2024]
malmoeb
 

Wannacry | Technical Insight and Lessons Learned

  • 1. 1McAfee Foundstone Services McAfee WannaCry Technical Insight and Lessons Learned Thomas Roccia | Security Consultant Researcher
  • 2. 2McAfee Foundstone Services McAfee Presentation • Thomas Roccia • McAfee Foundstone Consultant • Twitter: @fr0gger_
  • 3. 3McAfee Foundstone Services Overview § Wannacry Presentation § about the Exploit Code § Technical Overview § Lessons Learned § Conclusion § Summary – Q & A Summary
  • 5. 5McAfee Foundstone Services The Increasing Malware Threat § Today the malware threat is really increasing and lot of stolen data are sold in the underground markets. § Malware are new weapons used by a lot of actors: § Governments § Spies § Hacktivist § Mafia § Even kids § The challenge is huge for attackers and defenders
  • 6. 6McAfee Foundstone Services The Increasing Ransomware Threat § Ransomware is an increase threat. § The first ransomware was pretty much Scarewares (Without encryption). § Today Ransomware is more powerfull and encrypts with a solid algorithm your data or even used exploit code. § Wannacry was very mediatic due to this automatedand quick spreading. Introduction
  • 8. 8McAfee Foundstone Services Wannacry Presentation § WannaCry is a ransomware that hit the World in May 2017. § It combined Ransomware capabilities with Worm techniques to spread automatically across the network. § The Worm exploits a vulnerability into SMB that was discovered previously by the NSA (EquationGroup). § More than 230 000 computers in over 150 countries were infected. § Big companies like the NHS, FedEx or Renault were impacted by it.
  • 9. 9McAfee Foundstone Services Wannacry Presentation Map Infection
  • 10. 10McAfee Foundstone Services Why is Wannacry Big? WannaCry Ransomware No user interaction needed Remote code Exploit
  • 11. PROFESSIONAL SERVICES The Story About the Exploit Code
  • 12. 12McAfee Foundstone Services The Shadow Brokers § The Shadow Brokers is a hacker group who first appeared in the summer of 2016. § They published several leaks containing hacking tools from the National Security Agency, including several zero-day exploits. § First message appeared in August 2016 § The leak with all the zero day was publicly available for free in April 15th 2017 The Story about the Exploit Code
  • 13. 13McAfee Foundstone Services The Exploit Code used by Wannacry Exploit Code Used by Wannacry The Story about the Exploit Code § WannaCry used the exploit code EternalBlue. § EternalBlue exploits a vulnerability in the Server Message Block (SMB) protocol. § This vulnerability is denoted by entry CVE-2017-0144. § The vulnerability exists because the SMB version 1 (SMBv1) server in various versions of Microsoft Windows accepts specially crafted packets from remote attackers, allowing them to execute arbitrary code on the target computer. § The Windows security update on 14 March 2017 resolved the issue via security update MS17-010.
  • 14. 14McAfee Foundstone Services Exploit Code used by Wannacry Exploit Code Used by Wannacry The Story about the Exploit Code § In addition to EternalBlue exploit, Wannacry used the DoublePulsar Implant. § The implant using a Kernel DLL injection technique allowing the attacker the full right on the compromised system. § Payload in memory was XORed to remain undetected. § Then the shellcode was injected directly into lsass.exe.
  • 16. 16McAfee Foundstone Services Key Characteristic § Uses the MS17-010 “EternalBlue” exploit to spread to other machines through SMB § Malware generates random target IP addresses, not limited to the local network § Hardcoded IP addresses. § Payload delivered by the SMB packets is encrypted § Malware dropper contains code to check for two specific domains before executing its ransomware or the network exploit codes. § Dropper variants do not exhibit this same behavior –no “kill switch”, no exploit, target mounted networkshares § 3 Bitcoin wallets being used to receive payment from victims - Tor browser used for anonymous payment Wannacry Technical Overview
  • 17. 17McAfee Foundstone Services Content Wannacry Technical Overview § msg -This folder contains the RTF describing the different instructions for the ransomware. Totaling 28 languages. § b.wnry - BMP ransom image used as a background image replacement by the malware. § c.wnry -  configuration file containing the target address, but also the tor communication endpoints information. § s.wnry - Tor client to communication with the above endpoints. § u.wnry - UI interface of the ransomware, containing the communications routines and password validation. § t.wnry - “WANACRY!” file — contains default keys • The initial file is a ZIP protected (Password: WNcry@2ol7)containing several other files that are dropped into the infected system.
  • 18. 18McAfee Foundstone Services § Wannacry has a kill switch function to stop the spreading. § hxxp://www[dot]iuqerfsodp9ifjaposdfjhgosurijfaewrwergwea[dot]com § hxxp://www[dot]ifferfsodp9ifjaposdfjhgosurijfaewrwergwea[dot]com Kill Switch Function Wannacry Technical Overview
  • 19. 19McAfee Foundstone Services § Wannacry spreads across the network by scanning a range of IP dynamically generated. How Wannacry Spreads Wannacry Technical Overview
  • 20. 20McAfee Foundstone Services § SMB Requests through the network SMB Exploit Wannacry Technical Overview
  • 21. 21McAfee Foundstone Services § Infection Flow SMB Exploit Wannacry Technical Overview
  • 22. 22McAfee Foundstone Services § Extract resource zip file XIA with hardcoded password “WNcry@2ol7” § Get c.wnry, which includes the Tor configuration used by the malware used by the malware § Extract the configuration from c.wnry to get the Tor browser and onion sites to be used for communication and onion sites to be used for communication: § gx7ekbenv2riucmf.onion; § 57g7spgrzlojinas.onion; § xxlvbrloxvriy2c5.onion; § 76jdd2ir2embyv47.onion; § cwwnhwhlz52maqm7.onion; § Load Bitcoin wallets which have been previously set up by the attackers for payment for file restoration and update c.wnry § “13AM4VW2dhxYgXeQepoHkHSQuy6NgaEb94” § “12t9YDPgwueZ9NyMgw519p7AA8isjr6SMw" § “115p7UMMngoj1pMvkpHijcRdfJNXj6LrLn" Ransomware Behavior Wannacry Technical Overview
  • 23. 23McAfee Foundstone Services § Hide Extract Zip Directory and Modify Security Descriptors § Create process: Runs command to hide current directory: attrib +h § Runs command: § icacls . /grant Everyone:F /T /C /Q. This grants all users full access to files in the current directory and all directories below. § Prep Encryption Public Key, AES Key… § Creates Mutex for all threads: GlobalMsWinZonesCacheCounterMutexW Ransomware Behavior Wannacry Technical Overview
  • 24. 24McAfee Foundstone Services § Creates a new thread to overwrite files on disk § Generate a key § Generate Data Buffers for each file § Call thread for function StartAddress to begin writing encrypting file contents § Tack on extension ".WNCRYT” § Run new process taskdl.exe in a new thread § Set Up the Decrypter Persistence § Create process "taskse.exe @[email protected]” § Set persistence key to run itself on reboot HKCUSOFTWAREMicrosoftWindowsCurrentVersionRun § CheckTokenMembership, GetComputerName Info § Run: cmd.exe /c reg add "HKCUSOFTWAREMicrosoftWindowsCurrentVersionRun” /v "<rand>" /t REG_SZ /d “"tasksche.exe"" /f Ransomware Behavior Wannacry Technical Overview
  • 25. 25McAfee Foundstone Services .der, .pfx, .key, .crt, .csr, .p12, .pem, .odt, .sxw, .stw, .3ds, .max, .3dm, .ods, .sxc, .stc, .dif, .slk, .wb2, .odp, .sxd, .std, .sxm, .sqlite3, .sqlitedb, .sql, .accdb, .mdb, .dbf, .odb, .mdf, .ldf, .cpp, .pas, .asm, .cmd, .bat, .vbs, .sch, .jsp, .php, .asp, .java, .jar, .class, .mp3, .wav, .swf, .fla, .wmv, .mpg, .vob, .mpeg, .asf, .avi, .mov, .mp4, .mkv, .flv, .wma, .mid, .m3u, .m4u, .svg, .psd, .tiff, .tif, .raw, .gif, .png, .bmp, .jpg, .jpeg, .iso, .backup, .zip, .rar, .tgz, .tar, .bak, .ARC, .vmdk, .vdi, .sldm, .sldx, .sti, .sxi, .dwg, .pdf, .wk1, .wks, .rtf, .csv, .txt, .msg, .pst, .ppsx, .ppsm, .pps, .pot, .pptm, .pptx, .ppt, .xltm, .xltx, .xlc, .xlm, .xlt, .xlw, .xlsb, .xlsm, .xlsx, .xls, .dotm, .dot, .docm, .docx, .doc, Targeted file extension Wannacry Technical Overview
  • 26. 26McAfee Foundstone Services Format of the Encrypted file Wannacry Technical Overview
  • 27. 27McAfee Foundstone Services § 3 walllets 50 Bitcoins (115 000€) Bitcoin Wallet Wannacry Technical Overview
  • 28. PROFESSIONAL SERVICES How to Recover Your Files
  • 29. 29McAfee Foundstone Services § Wannacry uses AES encryption to encrypt files. § Then the AES key is encrypted in RSA. § The RSA private key is generated dynamically in memory. § The keys are immediately destroying. Wannacry Encryption How to Recover Your Files
  • 30. 30McAfee Foundstone Services § Wannacry uses 2 functions to destroy the keys in memory: § CryptDestroyKey: free the memory that the key used. § CryptReleaseContext: release the Cryptography Service Provider (CSP). § French Security Researcher discovered that these functions does not release the prime numbers into the memory. § Allowing the victim to generate the private key if the memory is not freeing. § Wannakiwi is a tool that looks for the prime number in the memory. https://github.com/gentilkiwi/wanakiwi The bug How to Recover Your Files
  • 32. 32McAfee Foundstone Services § Wannacry inspired several other attackers. § After this attack we saw many other variants that spread the same manner and use the EternalBlue Exploit. § New variant of Wannacry were used (no kill switch…). § Adylkuzz which used the same exploit to spread. § EternalRocks § UIWIX Ransomware Wannacry Legacy
  • 34. 34McAfee Foundstone Services § Threat intelligence is a key to know what’s happened in the Infosec World! § Shadow Brokers was known since one year. § The leak was published in April 2017 § Patch Management is crucial! § Wannacry exploited a known vulnerability CVE-2017-0144. § Microsoft published the March 14 the security update MS17-010 § Disable unnecessary services! § The SMB is not use everywhere § Disable if not needed. Vulnerability Lessons Learned
  • 35. 35McAfee Foundstone Services Security § Teach your people! § Train your security team for Malware Analysis § Perform user awareness training for users § Follow the best practices against Ransomware threat! § Backup file § Manage the user and admin right § Create an Incident Response Program! § Do the right things when an incident occurs. Lessons Learned
  • 37. 37McAfee Foundstone Services § Wannacry is not an advanced Ransomware, however the worm capabilities allows it to spread very quickly. § EquationGroup exploit leak let powerful tools for attackers. § The Ransomware threats are still evolving to be more powerful. § Malware are still growing so does attack surfaces § Security best practices still efficient (Backup, Update, Awareness…) § Setup advanced malware detection technics like Sandboxing and machine learning Conclusion
  • 38. Q & A
  • 39. McAfee, the McAfee logo and [insert <other relevant McAfee Names>] are trademarks or registered trademarks of McAfee LLC or its subsidiaries in the U.S. and/or other countries. Other names and brands may be claimed as the property of others. Copyright © 2017 McAfee LLC.