SlideShare uma empresa Scribd logo
1 de 28
Andsec Security Conference
4th Editon
R3MF – R3v3rs1ng on
Mach-O File
Ricardo L0gan
Security Specialist with over 15 years of
experience, malware research enthusiastic,
pentest and reverse engineering. I’ve a solid
knowledge on topics like network security,
hardening and tuning across multiple platforms
such as Windows, Linux, OS X and Cisco.
Beginner in programming languages as Python, C
and Assembly.
At the Brazil, I contribute with some security
conferences organizations such as SlackShow
Community, bSides SP and Hackers to Hackers
Conference (H2HC).
Member # RTFM 💀 C○||cL/V€ #
### Long live Open Source - Use Linux (Slackware) ###
$Whoami
0x00 Motivation of Research
0x01 The Mach-O Format
0x02 Demo I (crackme)
0x03 Tricks for Reversing
0x04 Demo II (malware)
0x05 Conclusions / Q & (MAYBE 0/) A
Agenda
0x00 Motivation Of Research
For Fun ;) 0/
- malware
- crackmes
0x00 Motivation Of Research
0x00 Motivation Of Research
.OSA --> ZIP:
 PremierOpinion
 upgrade.xml
Mac.BackDoor.OpinionSpy.3
Names: MacOS_X/OpinionSpy.A (Microsoft),
Mac.BackDoor.OpinionSpy.3 (F-Secure),
Mac.BackDoor.OpinionSpy.3 (Trend)
OSX_KAITEN.A
Names: MacOS_X/Tsunami.A (Microsoft),
OSX/Tsunami (McAfee),
OSX/Tsunami-Gen (Sophos),
OSX/Tsunami.A (F-Secure),
OSX_CARETO.A
Names: MacOS:Appetite-A [Trj] (Avast)
OSX/BackDoor.A (AVG)
Trojan.OSX.Melgato.a (Kaspersky)
OSX/Backdoor-BRE (McAfee)
Backdoor:MacOS_X/Appetite.A (Microsoft)
OSX/Appetite-A (Sophos)
Binary:
/tmp/.z
itunes212.{BLOCKED}pdt.com
0x01 The Mach-o Format
The mach-o is a Universal (fat) binaries (for i386
x86_64 ppc ppc64 armv6 armv7), this format was adopted as
the standard in OS X from version 10.6 on.
We are currently in version 10.11.5 (El Capitan).
Binary (Linux)
Binary (Windows)
Binary (OS X)
0x01 The Mach-o Format
0x01 The Mach-o Format
Magic Number: File Signatures
0x01 The Mach-o Format
0x01 The Mach-o Format
Structs on File:
- Code is located in __TEXT section.
- Linked libraries in LC_LOAD_DYLIB commands.
- The entrypoint is defined at LC_UNIXTHREAD or LC_THREAD.
0x01 The Mach-o Format HEADER
LOAD_COMMANDS
0x01 The Mach-o Format
SECTIONS
0x01 The Mach-o Format
0x01 The Mach-o Format
0x01 The Mach-o Format
0x01 The Mach-o Format
0x01 The Mach-o Format
0x01 The Mach-o Format
0x02 Demo I
Demo 01 Crackme
Binary: cryptorev
Level: easy
Detail: cryptorev is a binary mach-o the goal
is run binary and found the flag.
This demo don’t have protection in your code
just UPX (packer) and DEADBEEF in file ;)
0x03 Tricks for Reversing
When talking about malwares we have a lot of
techniques to make it difficult to analyze
(reversing the sample) like:
- Anti-Disassembly
- Anti-Debugging
- Obfuscation
- Anti-Vm
0x03 Tricks for Reversing
When an app is launched, the OS X kernel loads the app’s code and
data into the address space of a new process.
The kernel also loads the dynamic loader ( /usr/lib/dyld ) into
the process and passes control to it.
Source: https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-
Articles/OverviewOfDynamicLibraries.html#//apple_ref/doc/uid/TP40001873-SW1
0x03 Tricks for Reversing
Static Analysis
file -> determine file type
upx / binwalk -> compress or expand executable files
strings -> find the printable strings in a object, or other binary, file
strip -> remove symbols
hexEdit -> hex editor
Lipo -> create or operate on universal files
otool -> object file displaying tool like a objdump and ldd
nm -> display name list (symbol table)
codesign -> create and manipulate code signatures
machOView -> visual Mach-O file browser
class-dump -> utility for examining the Objective-C runtime information stored in
Mach-O files.
dtrace -> generic front-end to the DTrace facility
fs_usage -> report system calls and page faults related to filesystem activity in
real-time
xattr -> display and manipulate extended attributes
0x03 Tricks for Reversing
0x03 Tricks for Reversing
Dynamic Analysis
Xcode -> xcode is an (IDE) containing a suite of software development.
iDA Pro -> disassembler and debugger.
hopper -> tool used for disassemble, and decompile your 32/64bits mach-o
file.
lldb -> debugger
fseventer -> disk activity tool with a good graphical representation and
solid filter tool.
open snoop -> snoop file opens as they occur. Uses DTrace.
activity Monitor -> tool to help you keep your system in good shape.
procoxp -> It's a simple tool like a top get information accessible
by proc_info
tcpdump -> for dump and analisys traffic on a network
wireshark -> for dump and analisys traffic on a network
lsock -> based on PF_SYSTEM provider, you can get real time notifications
of socket activity like TCPView from SysInternals.
little Snitch -> network traffic monitoring and control.
On March 2016 appear the first Ransoware writing for
mach-o file on OSX System (KeRanger), Distributed by
client BitTorrent Transmission (v.2.90) This threat
has been fixed in version v.2.91 the client.
The latest version Gatekeeper OSX already block this
ransoware since the first sample published 0/!!!
0x04 Demo II
Demo 02 Ransoware Keranger
Hacking is a way of life
Reference
REVERSE Engineering Mac Malware - Defcon 22
https://www.defcon.org/images/defcon-22/dc-22-
presentations/Edwards/DEFCON-22-Sarah-Edwards-Reverse-
Engineering-Mac-Malware.pdf
OS X ABI Mach-O File Format Reference
https://developer.apple.com/library/mac/documentation/DeveloperT
ools/Conceptual/MachORuntime/index.html
Calling Convention
http://www.agner.org/optimize/calling_conventions.pdf
Thanks for my wife and brothers (C00ler, Slayer, Ygor Rogy, RTFM Team)
0x05 Conclusions
Question &(MAYBE ;) 0/)Answer
Contact: ricardologanbr@gmail.com
@l0ganbr
Download Presentation on: http://pt.slideshare.net/l0ganbr

Mais conteúdo relacionado

Mais procurados

Network Security Nmap N Nessus
Network Security Nmap N NessusNetwork Security Nmap N Nessus
Network Security Nmap N Nessus
Utkarsh Verma
 

Mais procurados (20)

Mobile Application Security
Mobile Application SecurityMobile Application Security
Mobile Application Security
 
Hacking Adobe Experience Manager sites
Hacking Adobe Experience Manager sitesHacking Adobe Experience Manager sites
Hacking Adobe Experience Manager sites
 
Secure coding presentation Oct 3 2020
Secure coding presentation Oct 3 2020Secure coding presentation Oct 3 2020
Secure coding presentation Oct 3 2020
 
Metasploit
MetasploitMetasploit
Metasploit
 
Reverse Engineering iOS apps
Reverse Engineering iOS appsReverse Engineering iOS apps
Reverse Engineering iOS apps
 
Introduction to penetration testing
Introduction to penetration testingIntroduction to penetration testing
Introduction to penetration testing
 
Footprinting and reconnaissance
Footprinting and reconnaissanceFootprinting and reconnaissance
Footprinting and reconnaissance
 
You can detect PowerShell attacks
You can detect PowerShell attacksYou can detect PowerShell attacks
You can detect PowerShell attacks
 
Hunting for Credentials Dumping in Windows Environment
Hunting for Credentials Dumping in Windows EnvironmentHunting for Credentials Dumping in Windows Environment
Hunting for Credentials Dumping in Windows Environment
 
Hunting for security bugs in AEM webapps
Hunting for security bugs in AEM webappsHunting for security bugs in AEM webapps
Hunting for security bugs in AEM webapps
 
Understanding Windows Access Token Manipulation
Understanding Windows Access Token ManipulationUnderstanding Windows Access Token Manipulation
Understanding Windows Access Token Manipulation
 
Network Security Nmap N Nessus
Network Security Nmap N NessusNetwork Security Nmap N Nessus
Network Security Nmap N Nessus
 
Threat Hunting
Threat HuntingThreat Hunting
Threat Hunting
 
2021 ZAP Automation in CI/CD
2021 ZAP Automation in CI/CD2021 ZAP Automation in CI/CD
2021 ZAP Automation in CI/CD
 
Reverse proxies & Inconsistency
Reverse proxies & InconsistencyReverse proxies & Inconsistency
Reverse proxies & Inconsistency
 
Red Team Methodology - A Naked Look
Red Team Methodology - A Naked LookRed Team Methodology - A Naked Look
Red Team Methodology - A Naked Look
 
MW_Arch Fastest_way_to_hunt_on_Windows_v1.01
MW_Arch Fastest_way_to_hunt_on_Windows_v1.01MW_Arch Fastest_way_to_hunt_on_Windows_v1.01
MW_Arch Fastest_way_to_hunt_on_Windows_v1.01
 
WTF is Penetration Testing v.2
WTF is Penetration Testing v.2WTF is Penetration Testing v.2
WTF is Penetration Testing v.2
 
PowerShell for Practical Purple Teaming
PowerShell for Practical Purple TeamingPowerShell for Practical Purple Teaming
PowerShell for Practical Purple Teaming
 
Attacker's Perspective of Active Directory
Attacker's Perspective of Active DirectoryAttacker's Perspective of Active Directory
Attacker's Perspective of Active Directory
 

Destaque

Seguranca da Informação - Conceitos
Seguranca da Informação - ConceitosSeguranca da Informação - Conceitos
Seguranca da Informação - Conceitos
Luiz Arthur
 

Destaque (7)

Roadsec 2016 Mach-o A New Threat
Roadsec 2016   Mach-o A New ThreatRoadsec 2016   Mach-o A New Threat
Roadsec 2016 Mach-o A New Threat
 
Why does InfoSec play bass?
Why does InfoSec play bass?Why does InfoSec play bass?
Why does InfoSec play bass?
 
Jedi Mind Tricks for Git
Jedi Mind Tricks for GitJedi Mind Tricks for Git
Jedi Mind Tricks for Git
 
2014 roadsec-slides-palestra
2014 roadsec-slides-palestra2014 roadsec-slides-palestra
2014 roadsec-slides-palestra
 
Aula 1 - Introdução a Segurança da Informação
Aula 1 - Introdução a Segurança da InformaçãoAula 1 - Introdução a Segurança da Informação
Aula 1 - Introdução a Segurança da Informação
 
Seguranca da Informação - Conceitos
Seguranca da Informação - ConceitosSeguranca da Informação - Conceitos
Seguranca da Informação - Conceitos
 
Segurança da Informação
Segurança da InformaçãoSegurança da Informação
Segurança da Informação
 

Semelhante a Andsec Reversing on Mach-o File

Crisis. advanced malware
Crisis. advanced malwareCrisis. advanced malware
Crisis. advanced malware
Yury Chemerkin
 
BIT204 1 Software Fundamentals
BIT204 1 Software FundamentalsBIT204 1 Software Fundamentals
BIT204 1 Software Fundamentals
James Uren
 

Semelhante a Andsec Reversing on Mach-o File (20)

H2HC - R3MF
H2HC - R3MFH2HC - R3MF
H2HC - R3MF
 
Nullbyte 6ed. 2019
Nullbyte 6ed. 2019Nullbyte 6ed. 2019
Nullbyte 6ed. 2019
 
Bsides SP 2015 - Mach-O - A New Threat
Bsides SP 2015 - Mach-O - A New ThreatBsides SP 2015 - Mach-O - A New Threat
Bsides SP 2015 - Mach-O - A New Threat
 
Strategies to design FUD malware
Strategies to design FUD malwareStrategies to design FUD malware
Strategies to design FUD malware
 
Assingment 5 - ENSA
Assingment 5 - ENSAAssingment 5 - ENSA
Assingment 5 - ENSA
 
Mmw mac malware-mac
Mmw mac malware-macMmw mac malware-mac
Mmw mac malware-mac
 
Intrusion Techniques
Intrusion TechniquesIntrusion Techniques
Intrusion Techniques
 
MacOS forensics and anti-forensics (DC Lviv 2019) presentation
MacOS forensics and anti-forensics (DC Lviv 2019) presentationMacOS forensics and anti-forensics (DC Lviv 2019) presentation
MacOS forensics and anti-forensics (DC Lviv 2019) presentation
 
Crisis. advanced malware
Crisis. advanced malwareCrisis. advanced malware
Crisis. advanced malware
 
Bsides Tampa Blue Team’s tool dump.
Bsides Tampa Blue Team’s tool dump.Bsides Tampa Blue Team’s tool dump.
Bsides Tampa Blue Team’s tool dump.
 
The Hacking Games - Operation System Vulnerabilities Meetup 29112022
The Hacking Games - Operation System Vulnerabilities Meetup 29112022The Hacking Games - Operation System Vulnerabilities Meetup 29112022
The Hacking Games - Operation System Vulnerabilities Meetup 29112022
 
Threats, Vulnerabilities & Security measures in Linux
Threats, Vulnerabilities & Security measures in LinuxThreats, Vulnerabilities & Security measures in Linux
Threats, Vulnerabilities & Security measures in Linux
 
BSides IR in Heterogeneous Environment
BSides IR in Heterogeneous EnvironmentBSides IR in Heterogeneous Environment
BSides IR in Heterogeneous Environment
 
LO-PHI: Low-Observable Physical Host Instrumentation for Malware Analysis
LO-PHI: Low-Observable Physical Host Instrumentation for Malware AnalysisLO-PHI: Low-Observable Physical Host Instrumentation for Malware Analysis
LO-PHI: Low-Observable Physical Host Instrumentation for Malware Analysis
 
Hacking Exposed: The Mac Attack
Hacking Exposed: The Mac AttackHacking Exposed: The Mac Attack
Hacking Exposed: The Mac Attack
 
Hacking Exposed: The Mac Attack
Hacking Exposed: The Mac AttackHacking Exposed: The Mac Attack
Hacking Exposed: The Mac Attack
 
The Log4Shell Vulnerability – explained: how to stay secure
The Log4Shell Vulnerability – explained: how to stay secureThe Log4Shell Vulnerability – explained: how to stay secure
The Log4Shell Vulnerability – explained: how to stay secure
 
Ceh v8 labs module 05 system hacking
Ceh v8 labs module 05 system hackingCeh v8 labs module 05 system hacking
Ceh v8 labs module 05 system hacking
 
BIT204 1 Software Fundamentals
BIT204 1 Software FundamentalsBIT204 1 Software Fundamentals
BIT204 1 Software Fundamentals
 
DEFCON 27 - ALEXANDRE BORGES - dot net malware threats
DEFCON 27 - ALEXANDRE BORGES - dot net malware threatsDEFCON 27 - ALEXANDRE BORGES - dot net malware threats
DEFCON 27 - ALEXANDRE BORGES - dot net malware threats
 

Último

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Último (20)

Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 

Andsec Reversing on Mach-o File

  • 1. Andsec Security Conference 4th Editon R3MF – R3v3rs1ng on Mach-O File
  • 2. Ricardo L0gan Security Specialist with over 15 years of experience, malware research enthusiastic, pentest and reverse engineering. I’ve a solid knowledge on topics like network security, hardening and tuning across multiple platforms such as Windows, Linux, OS X and Cisco. Beginner in programming languages as Python, C and Assembly. At the Brazil, I contribute with some security conferences organizations such as SlackShow Community, bSides SP and Hackers to Hackers Conference (H2HC). Member # RTFM 💀 C○||cL/V€ # ### Long live Open Source - Use Linux (Slackware) ### $Whoami
  • 3. 0x00 Motivation of Research 0x01 The Mach-O Format 0x02 Demo I (crackme) 0x03 Tricks for Reversing 0x04 Demo II (malware) 0x05 Conclusions / Q & (MAYBE 0/) A Agenda
  • 4. 0x00 Motivation Of Research For Fun ;) 0/ - malware - crackmes
  • 6. 0x00 Motivation Of Research .OSA --> ZIP:  PremierOpinion  upgrade.xml Mac.BackDoor.OpinionSpy.3 Names: MacOS_X/OpinionSpy.A (Microsoft), Mac.BackDoor.OpinionSpy.3 (F-Secure), Mac.BackDoor.OpinionSpy.3 (Trend) OSX_KAITEN.A Names: MacOS_X/Tsunami.A (Microsoft), OSX/Tsunami (McAfee), OSX/Tsunami-Gen (Sophos), OSX/Tsunami.A (F-Secure), OSX_CARETO.A Names: MacOS:Appetite-A [Trj] (Avast) OSX/BackDoor.A (AVG) Trojan.OSX.Melgato.a (Kaspersky) OSX/Backdoor-BRE (McAfee) Backdoor:MacOS_X/Appetite.A (Microsoft) OSX/Appetite-A (Sophos) Binary: /tmp/.z itunes212.{BLOCKED}pdt.com
  • 7. 0x01 The Mach-o Format The mach-o is a Universal (fat) binaries (for i386 x86_64 ppc ppc64 armv6 armv7), this format was adopted as the standard in OS X from version 10.6 on. We are currently in version 10.11.5 (El Capitan).
  • 8. Binary (Linux) Binary (Windows) Binary (OS X) 0x01 The Mach-o Format
  • 9. 0x01 The Mach-o Format Magic Number: File Signatures
  • 10. 0x01 The Mach-o Format
  • 11. 0x01 The Mach-o Format Structs on File: - Code is located in __TEXT section. - Linked libraries in LC_LOAD_DYLIB commands. - The entrypoint is defined at LC_UNIXTHREAD or LC_THREAD.
  • 12. 0x01 The Mach-o Format HEADER
  • 15. 0x01 The Mach-o Format
  • 16. 0x01 The Mach-o Format
  • 17. 0x01 The Mach-o Format
  • 18. 0x01 The Mach-o Format
  • 19. 0x01 The Mach-o Format
  • 20. 0x02 Demo I Demo 01 Crackme Binary: cryptorev Level: easy Detail: cryptorev is a binary mach-o the goal is run binary and found the flag. This demo don’t have protection in your code just UPX (packer) and DEADBEEF in file ;)
  • 21. 0x03 Tricks for Reversing When talking about malwares we have a lot of techniques to make it difficult to analyze (reversing the sample) like: - Anti-Disassembly - Anti-Debugging - Obfuscation - Anti-Vm
  • 22. 0x03 Tricks for Reversing When an app is launched, the OS X kernel loads the app’s code and data into the address space of a new process. The kernel also loads the dynamic loader ( /usr/lib/dyld ) into the process and passes control to it. Source: https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/DynamicLibraries/100- Articles/OverviewOfDynamicLibraries.html#//apple_ref/doc/uid/TP40001873-SW1
  • 23. 0x03 Tricks for Reversing
  • 24. Static Analysis file -> determine file type upx / binwalk -> compress or expand executable files strings -> find the printable strings in a object, or other binary, file strip -> remove symbols hexEdit -> hex editor Lipo -> create or operate on universal files otool -> object file displaying tool like a objdump and ldd nm -> display name list (symbol table) codesign -> create and manipulate code signatures machOView -> visual Mach-O file browser class-dump -> utility for examining the Objective-C runtime information stored in Mach-O files. dtrace -> generic front-end to the DTrace facility fs_usage -> report system calls and page faults related to filesystem activity in real-time xattr -> display and manipulate extended attributes 0x03 Tricks for Reversing
  • 25. 0x03 Tricks for Reversing Dynamic Analysis Xcode -> xcode is an (IDE) containing a suite of software development. iDA Pro -> disassembler and debugger. hopper -> tool used for disassemble, and decompile your 32/64bits mach-o file. lldb -> debugger fseventer -> disk activity tool with a good graphical representation and solid filter tool. open snoop -> snoop file opens as they occur. Uses DTrace. activity Monitor -> tool to help you keep your system in good shape. procoxp -> It's a simple tool like a top get information accessible by proc_info tcpdump -> for dump and analisys traffic on a network wireshark -> for dump and analisys traffic on a network lsock -> based on PF_SYSTEM provider, you can get real time notifications of socket activity like TCPView from SysInternals. little Snitch -> network traffic monitoring and control.
  • 26. On March 2016 appear the first Ransoware writing for mach-o file on OSX System (KeRanger), Distributed by client BitTorrent Transmission (v.2.90) This threat has been fixed in version v.2.91 the client. The latest version Gatekeeper OSX already block this ransoware since the first sample published 0/!!! 0x04 Demo II Demo 02 Ransoware Keranger
  • 27. Hacking is a way of life Reference REVERSE Engineering Mac Malware - Defcon 22 https://www.defcon.org/images/defcon-22/dc-22- presentations/Edwards/DEFCON-22-Sarah-Edwards-Reverse- Engineering-Mac-Malware.pdf OS X ABI Mach-O File Format Reference https://developer.apple.com/library/mac/documentation/DeveloperT ools/Conceptual/MachORuntime/index.html Calling Convention http://www.agner.org/optimize/calling_conventions.pdf Thanks for my wife and brothers (C00ler, Slayer, Ygor Rogy, RTFM Team)
  • 28. 0x05 Conclusions Question &(MAYBE ;) 0/)Answer Contact: ricardologanbr@gmail.com @l0ganbr Download Presentation on: http://pt.slideshare.net/l0ganbr

Notas do Editor

  1. Hi Guys my nickname is logan today I’m talk about mach-o files.
  2. This is a schedule for today
  3. I like research on malware but I’m not working in company antivirus or like this. I liked just for fun \0/… and I a member RTFM CTF Team and I like crackmes and solution problem like this.
  4. Using VirusTotal as a source for this research I see that in 2014 we don't have binaries submissions mach-o but it from 2015 already had a high number of submitted files and 2016 until the time this number has almost doubled. Now I ask you the virus actually detect and protect your computer against these threats? antivirus works well on windows and linux ? The detection of binary is basically (Common Pattern) whether by hooking the OS API (create / read / execute). This actually works in the x mac? If we think of the amount of malware (with different tricks to bypass) X companies (AV) to researchers working on new threats, we do not have an unfair fight?
  5. Here we have 3 goods example the binaries mach-o malware. In the last year i made a research about malware mach-o and this more common today. what is better? Infect host user mac os (problably have money) or infected host user windows don't have money?
  6. 64 = sixty four 86 = eighty-six 386 = three hundred eighty-six