SlideShare une entreprise Scribd logo
1  sur  49
PDF ATTACK
A Journey from the Exploit Kit to the Shellcode
Jose Miguel Esparza @EternalTodo
• Jose Miguel Esparza
• Senior Cybercrime Analyst at Fox-IT
– Malware, Botnets, C&Cs, Exploit Kits, …
• Security Researcher at Home ;p
– PDF, NFC, …
• http://eternal-todo.com
• @EternalTodo on Twitter
Who am I
Jose Miguel Esparza @EternalTodo
• A Journey from the Exploit Kit to the Shellcode
– Exploit Kits: the source of evil
– PDF basics
– Some basic peepdf commands
– Analyzing PDF exploits
• Extracting and analyzing shellcodes
– Obfuscation of PDF files
Agenda
Jose Miguel Esparza @EternalTodo
• Linux distribution
– Libemu / Pylibemu
– V8 / PyV8
• Last peepdf version
– Checkout from the repository or update!
Requirements
Jose Miguel Esparza @peepdf
• Best way to infect a computer
• Effective and fresh exploits
– IE
– Java
– PDF
– Flash
– …
• Average of 6-7 exploits
Exploit Kits: the source of evil
Jose Miguel Esparza @EternalTodo
Exploit Kits: the source of evil
Jose Miguel Esparza @EternalTodo
Exploit Kits: the source of evil
Java 7u11
Java Byte Verify
Java CMM
Java < 7u17
• Most used nowadays
– BlackHole
– Neutrino
– RedKit
– CoolPack
– Styx
– Nuclear
– …
Exploit Kits: the source of evil
KahuSecurity
Jose Miguel Esparza @peepdf
• Infection steps
– Visit injected website / Click SPAM link
– Redirection (maybe more than one)
– Obfuscated Javascript
– Plugin detection
– Trying exploits
– Done!
Exploit Kits: the source of evil
Jose Miguel Esparza @peepdf
• Traffic Distribution Systems (TDS)
– Country specific attacks
– TDS + Exploit Kits = WIN!
Exploit Kits: the source of evil
Jose Miguel Esparza @EternalTodo
• Analyzing exploit kits
– Avoiding researchers
• Filtering by User-Agent and/or Referer
• Blocking IPs
• One-time infections
• Country filters
Exploit Kits: the source of evil
Jose Miguel Esparza @EternalTodo
• Analyzing obfuscated Javascript code
– The “easy” way
• Automatic tools
– Online services
» Wepawet
» JSUNPACK
– Low-interaction honeyclient
» Thug
• You can miss some info
Exploit Kits: the source of evil
Jose Miguel Esparza @EternalTodo
• Analyzing obfuscated Javascript code
– The traditional way
• Executing different stages of JS code
– Beautify the code
– Looking for the eval function
» s/eval/print/
– Hooking the eval function with Javascript engines
• Looking for exploits / shellcodes
• You cannot miss any detail
Exploit Kits: the source of evil
Jose Miguel Esparza @peepdf
• Analyzing obfuscated Javascript code
– The traditional way
• Let’s play ;)
Exploit Kits: the source of evil
Jose Miguel Esparza @peepdf
• PDF format?
• PDF structure?
• Objects?
• Filters?
PDF basics
Jose Miguel Esparza @EternalTodo
Header
Body
Cross reference table
Trailer
Jose Miguel Esparza @peepdf
• Body
– Sequence of objects
– Object types
• Boolean: true false
• Numbers: 123 -98 4. -.002 123.6
• Strings: (hola) <686f6c61>
– 68 (h) 6f (o) 6c (l) 61 (a)
• Names: /Type /Filter
• Dictionaries: << /Type /Catalog /Root 1 0 R >>
• Arrays: [ 1.0 (test) <</Length 273>> ]
• Streams
PDF basics
Jose Miguel Esparza @EternalTodo
PDF basics
Jose Miguel Esparza @peepdf
• Object types
– Indirect objects
• Reference: “object_id generation_number R”
PDF basics
Jose Miguel Esparza @EternalTodo
• Object types
– Indirect objects
• Reference: “object_id generation_number R”
PDF basics
Jose Miguel Esparza @peepdf
• Tree structure  References
• Root node
– /Catalog
• If an element isn’t in the downward path from the
/Catalog DOES NOT EXIST
PDF basics
Jose Miguel Esparza @EternalTodo
• You can use just a text editor!!
PDF basics
Jose Miguel Esparza @EternalTodo
“peepdf sounds like the Swiss army knife of
PDF security apps”
peepdf
http://peepdf.eternal-todo.com
Jose Miguel Esparza @EternalTodo
• Characteristics
– Python
– Command line
– Interactive console (colorized)
– Included in REMnux and BackTrack / Kali Linux
peepdf
http://peepdf.eternal-todo.com
Jose Miguel Esparza @EternalTodo
peepdf
http://peepdf.eternal-todo.com
Jose Miguel Esparza @EternalTodo
• Characteristics
– Command file option
• Batch / Automation
– XML output
– Easily updated from repository
peepdf
http://peepdf.eternal-todo.com
Jose Miguel Esparza @peepdf
• Why peepdf?
– Support for:
• Encryption
• Object Streams (compressed objects)
• Most used filters
• FlateDecode / LZWDecode Parameters
– Javascript Analysis
– Shellcode emulation
peepdf
Jose Miguel Esparza @peepdf
• Why peepdf?
– Shows Suspicious Elements
– Shows potential Vulnerabilities
– Powerful Interactive Console
– Easy extraction of objects / JS code / shellcode
– PDF Obfuscation
– Alive project!!
peepdf
Jose Miguel Esparza @peepdf
• Recent commits
– s/Spidermonkey/PyV8/g
peepdf
Jose Miguel Esparza @peepdf
• Recent commits
– vtcheck
peepdf
Jose Miguel Esparza @peepdf
• Commands
– Console
• help
• log
• open
• reset
• quit
• exit
peepdf
Jose Miguel Esparza @peepdf
• Commands
– Showing information
• Whole document
– info
– tree
– offsets
– hash
– bytes
– metadata
– changelog
– save_version
– errors
peepdf
Jose Miguel Esparza @peepdf
• Commands
– Showing information
• Objects
– object
– rawobject
– stream
– rawstream
– references
– hash
peepdf
Jose Miguel Esparza @peepdf
• Commands
– Extracting information
• Output redirection is possible
– set
» set output file path_to_my_file
» set output variable myVar
peepdf
Jose Miguel Esparza @peepdf
• Commands
– Extracting information
• Shell redirection is easier ;)
– Files
» stream 6 > stream6_file
» js_code 12 >> pdf_js_code_file
– Variables
» js_unescape variable myVar $> unescaped_sh
» rawstream 5 $>> all_my_rawstreams_var
peepdf
Jose Miguel Esparza @peepdf
• Commands
– Javascript functions
• js_code
• js_eval
• js_analyse
• js_unescape
• js_join
peepdf
Jose Miguel Esparza @peepdf
• Commands
– Shellcode emulation
• sctest
– pylibemu: libemu wrapper for Python
peepdf
Jose Miguel Esparza @peepdf
• Commands
– Modification / Creation
• modify
• filters
• decode
• encode
• encode_strings
• embed
• encrypt
• malformed_output
• create
• save
peepdf
Jose Miguel Esparza @peepdf
• Commands
– Misc
• set
• search
• show
• xor
• xor_search
peepdf
Jose Miguel Esparza @EternalTodo
• How to identify malicious files
– Suspicious elements
• /Action
• /OpenAction
• /AA
• /AcroForm
• /Names
• /JavaScript
• /EmbeddedFile
• Known vulnerabilities
Analyzing PDF exploits
Jose Miguel Esparza @peepdf
• Most used vulnerabilities
– LibTiff (TIFF images)
– Collab.collectEmailInfo
– Collab.getIcon
– Doc.media.newPlayer
– …
Analyzing PDF exploits
Jose Miguel Esparza @peepdf
• How to identify malicious files
– Obfuscation
• Strange codification in objects
• Encryption
• Malformed objects
• Embeded PDFs
• Javascript
Analyzing PDF exploits
Jose Miguel Esparza @EternalTodo
• How to identify malicious files
– Patterns
• One page without content
• Big objects
• Gaps between objects (offsets)
• Strange structure
• Characteristic strings
– Metadata
– Tools
Analyzing PDF exploits
Jose Miguel Esparza @EternalTodo
• How to identify malicious files
– Malformed documents
• Headers
• Objects Tags
Analyzing PDF exploits
Jose Miguel Esparza @EternalTodo
• Practicing all the theory
• Not a sample exploit, a real one
• Extracting the interesting parts
• Extracting the shellcode
• Analyzing the shellcode
Analyzing real exploits
Jose Miguel Esparza @peepdf
• Playing with real exploits
Analyzing real exploits
Jose Miguel Esparza @peepdf
• Some developments based on peepdf
– SWF Mastah (Brandon Dixon)
Using peepdf as a library
Jose Miguel Esparza @peepdf
• Remove characteristic strings
• Split up Javascript code (/Names)
• If the code is in:
– String octal encoding (143172)
– Stream filters (not usual, parameters)
• Compress (object streams)
• Encrypt (default password)
• Malform (endobj, header)
• Nest PDFs
PDF obfuscation
THANKS!!
Jose Miguel Esparza
jesparza AT eternal-todo.com
http://eternal-todo.com
@EternalTodo

Contenu connexe

Dernier

The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
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
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
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
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
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
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
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
 
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
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????blackmambaettijean
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
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
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 

Dernier (20)

The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
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
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
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
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
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
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
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
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
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.
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 

En vedette

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 

En vedette (20)

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 

PDF Attack: A Journey from the Exploit Kit to the Shellcode

  • 1. PDF ATTACK A Journey from the Exploit Kit to the Shellcode Jose Miguel Esparza @EternalTodo
  • 2. • Jose Miguel Esparza • Senior Cybercrime Analyst at Fox-IT – Malware, Botnets, C&Cs, Exploit Kits, … • Security Researcher at Home ;p – PDF, NFC, … • http://eternal-todo.com • @EternalTodo on Twitter Who am I
  • 3. Jose Miguel Esparza @EternalTodo • A Journey from the Exploit Kit to the Shellcode – Exploit Kits: the source of evil – PDF basics – Some basic peepdf commands – Analyzing PDF exploits • Extracting and analyzing shellcodes – Obfuscation of PDF files Agenda
  • 4. Jose Miguel Esparza @EternalTodo • Linux distribution – Libemu / Pylibemu – V8 / PyV8 • Last peepdf version – Checkout from the repository or update! Requirements
  • 5. Jose Miguel Esparza @peepdf • Best way to infect a computer • Effective and fresh exploits – IE – Java – PDF – Flash – … • Average of 6-7 exploits Exploit Kits: the source of evil
  • 6. Jose Miguel Esparza @EternalTodo Exploit Kits: the source of evil
  • 7. Jose Miguel Esparza @EternalTodo Exploit Kits: the source of evil Java 7u11 Java Byte Verify Java CMM Java < 7u17
  • 8. • Most used nowadays – BlackHole – Neutrino – RedKit – CoolPack – Styx – Nuclear – … Exploit Kits: the source of evil KahuSecurity
  • 9. Jose Miguel Esparza @peepdf • Infection steps – Visit injected website / Click SPAM link – Redirection (maybe more than one) – Obfuscated Javascript – Plugin detection – Trying exploits – Done! Exploit Kits: the source of evil
  • 10. Jose Miguel Esparza @peepdf • Traffic Distribution Systems (TDS) – Country specific attacks – TDS + Exploit Kits = WIN! Exploit Kits: the source of evil
  • 11. Jose Miguel Esparza @EternalTodo • Analyzing exploit kits – Avoiding researchers • Filtering by User-Agent and/or Referer • Blocking IPs • One-time infections • Country filters Exploit Kits: the source of evil
  • 12. Jose Miguel Esparza @EternalTodo • Analyzing obfuscated Javascript code – The “easy” way • Automatic tools – Online services » Wepawet » JSUNPACK – Low-interaction honeyclient » Thug • You can miss some info Exploit Kits: the source of evil
  • 13. Jose Miguel Esparza @EternalTodo • Analyzing obfuscated Javascript code – The traditional way • Executing different stages of JS code – Beautify the code – Looking for the eval function » s/eval/print/ – Hooking the eval function with Javascript engines • Looking for exploits / shellcodes • You cannot miss any detail Exploit Kits: the source of evil
  • 14. Jose Miguel Esparza @peepdf • Analyzing obfuscated Javascript code – The traditional way • Let’s play ;) Exploit Kits: the source of evil
  • 15. Jose Miguel Esparza @peepdf • PDF format? • PDF structure? • Objects? • Filters? PDF basics
  • 16. Jose Miguel Esparza @EternalTodo Header Body Cross reference table Trailer
  • 17. Jose Miguel Esparza @peepdf • Body – Sequence of objects – Object types • Boolean: true false • Numbers: 123 -98 4. -.002 123.6 • Strings: (hola) <686f6c61> – 68 (h) 6f (o) 6c (l) 61 (a) • Names: /Type /Filter • Dictionaries: << /Type /Catalog /Root 1 0 R >> • Arrays: [ 1.0 (test) <</Length 273>> ] • Streams PDF basics
  • 18. Jose Miguel Esparza @EternalTodo PDF basics
  • 19. Jose Miguel Esparza @peepdf • Object types – Indirect objects • Reference: “object_id generation_number R” PDF basics
  • 20. Jose Miguel Esparza @EternalTodo • Object types – Indirect objects • Reference: “object_id generation_number R” PDF basics
  • 21. Jose Miguel Esparza @peepdf • Tree structure  References • Root node – /Catalog • If an element isn’t in the downward path from the /Catalog DOES NOT EXIST PDF basics
  • 22. Jose Miguel Esparza @EternalTodo • You can use just a text editor!! PDF basics
  • 23. Jose Miguel Esparza @EternalTodo “peepdf sounds like the Swiss army knife of PDF security apps” peepdf http://peepdf.eternal-todo.com
  • 24. Jose Miguel Esparza @EternalTodo • Characteristics – Python – Command line – Interactive console (colorized) – Included in REMnux and BackTrack / Kali Linux peepdf http://peepdf.eternal-todo.com
  • 25. Jose Miguel Esparza @EternalTodo peepdf http://peepdf.eternal-todo.com
  • 26. Jose Miguel Esparza @EternalTodo • Characteristics – Command file option • Batch / Automation – XML output – Easily updated from repository peepdf http://peepdf.eternal-todo.com
  • 27. Jose Miguel Esparza @peepdf • Why peepdf? – Support for: • Encryption • Object Streams (compressed objects) • Most used filters • FlateDecode / LZWDecode Parameters – Javascript Analysis – Shellcode emulation peepdf
  • 28. Jose Miguel Esparza @peepdf • Why peepdf? – Shows Suspicious Elements – Shows potential Vulnerabilities – Powerful Interactive Console – Easy extraction of objects / JS code / shellcode – PDF Obfuscation – Alive project!! peepdf
  • 29. Jose Miguel Esparza @peepdf • Recent commits – s/Spidermonkey/PyV8/g peepdf
  • 30. Jose Miguel Esparza @peepdf • Recent commits – vtcheck peepdf
  • 31. Jose Miguel Esparza @peepdf • Commands – Console • help • log • open • reset • quit • exit peepdf
  • 32. Jose Miguel Esparza @peepdf • Commands – Showing information • Whole document – info – tree – offsets – hash – bytes – metadata – changelog – save_version – errors peepdf
  • 33. Jose Miguel Esparza @peepdf • Commands – Showing information • Objects – object – rawobject – stream – rawstream – references – hash peepdf
  • 34. Jose Miguel Esparza @peepdf • Commands – Extracting information • Output redirection is possible – set » set output file path_to_my_file » set output variable myVar peepdf
  • 35. Jose Miguel Esparza @peepdf • Commands – Extracting information • Shell redirection is easier ;) – Files » stream 6 > stream6_file » js_code 12 >> pdf_js_code_file – Variables » js_unescape variable myVar $> unescaped_sh » rawstream 5 $>> all_my_rawstreams_var peepdf
  • 36. Jose Miguel Esparza @peepdf • Commands – Javascript functions • js_code • js_eval • js_analyse • js_unescape • js_join peepdf
  • 37. Jose Miguel Esparza @peepdf • Commands – Shellcode emulation • sctest – pylibemu: libemu wrapper for Python peepdf
  • 38. Jose Miguel Esparza @peepdf • Commands – Modification / Creation • modify • filters • decode • encode • encode_strings • embed • encrypt • malformed_output • create • save peepdf
  • 39. Jose Miguel Esparza @peepdf • Commands – Misc • set • search • show • xor • xor_search peepdf
  • 40. Jose Miguel Esparza @EternalTodo • How to identify malicious files – Suspicious elements • /Action • /OpenAction • /AA • /AcroForm • /Names • /JavaScript • /EmbeddedFile • Known vulnerabilities Analyzing PDF exploits
  • 41. Jose Miguel Esparza @peepdf • Most used vulnerabilities – LibTiff (TIFF images) – Collab.collectEmailInfo – Collab.getIcon – Doc.media.newPlayer – … Analyzing PDF exploits
  • 42. Jose Miguel Esparza @peepdf • How to identify malicious files – Obfuscation • Strange codification in objects • Encryption • Malformed objects • Embeded PDFs • Javascript Analyzing PDF exploits
  • 43. Jose Miguel Esparza @EternalTodo • How to identify malicious files – Patterns • One page without content • Big objects • Gaps between objects (offsets) • Strange structure • Characteristic strings – Metadata – Tools Analyzing PDF exploits
  • 44. Jose Miguel Esparza @EternalTodo • How to identify malicious files – Malformed documents • Headers • Objects Tags Analyzing PDF exploits
  • 45. Jose Miguel Esparza @EternalTodo • Practicing all the theory • Not a sample exploit, a real one • Extracting the interesting parts • Extracting the shellcode • Analyzing the shellcode Analyzing real exploits
  • 46. Jose Miguel Esparza @peepdf • Playing with real exploits Analyzing real exploits
  • 47. Jose Miguel Esparza @peepdf • Some developments based on peepdf – SWF Mastah (Brandon Dixon) Using peepdf as a library
  • 48. Jose Miguel Esparza @peepdf • Remove characteristic strings • Split up Javascript code (/Names) • If the code is in: – String octal encoding (143172) – Stream filters (not usual, parameters) • Compress (object streams) • Encrypt (default password) • Malform (endobj, header) • Nest PDFs PDF obfuscation
  • 49. THANKS!! Jose Miguel Esparza jesparza AT eternal-todo.com http://eternal-todo.com @EternalTodo