SlideShare a Scribd company logo
Mount(ain) of Bugs
Csaba Fitzl


Twitter: @theevilbit
whoami
• author of "macOS Control Bypasses" at
Offensive Security


• ex red/blue teamer


• macOS bug hunter


• husband, father


• hiking, trail running 🥾 🏔
pwd
agenda
1. MACF


2. the mount system call


3. disk arbitration service


4. CVE-2017-7170 (Patric Wardle) - Snif
fi
ng Authorization References


5. CVE-2017-2533 (pwn2own) - Mount yourself a root shell


6. CVE-2020-9771 - TCC bypass via snapshot mounting


7. CVE-2021-1784 - TCC bypass via mounting over com.apple.TCC


8. CVE-2021-30782 - TCC bypass via AppTranslocation service


9. CVE-2021-26089 - Fortinet Forticlient installer LPE


10. other tricks and new bugs
MACF


-


Mandatory Access Control Framework
MACF
• origin: TrustedBSD MAC


• implemented in kernel


• policy modules extend the
kernel


• can place hooks in supported
location


• very powerful
MACF
• very - very powerful


• was part of KDK till OS X 10.12 (never of
fi
cially supported)


• mac.h header was removed


• available in xnu: `security/mac.h`, `security/mac_framework.h`, `mac_vfs.h`


• examples: AppleMobileFileIntegrity, Sandbox, EndpointSecurity,
Quarantine (=Gatekeeper)
MACF
• typical callout from xnu: mac_......
MACF
MACF
• MAC_CHECK


• iterates over all policy
frameworks


• mpo_... (mac_policy.h)
mount system calls
VFS
• macOS uses Virtual Filesystem Switch (VFS)


• origin: Solaris


• used in most *nix based systems


• abstracts speci
fi
c
fi
le system implementation


• MACF callouts at speci
fi
c points - hooked by the Sandbox
mount system call
fl
ow
disk arbitration service
diskarbitration - the basics
• system wide service, de
fi
ned in:


• /System/Library/LaunchDaemons/com.apple.diskarbitrationd.plist


• XPC: com.apple.DiskArbitration.diskarbitrationd


• manage disk mounting, unmounting


• calls mount/unmount system calls under the hood
diskarbitration - why we like it?
• runs as root


• unsandboxed


• XPC service accessible from
application sandbox


• opensource
diskarbitration - the checks
• to prevent abuse, it has to
con
fi
rm:


• if the caller sandboxed


• if the mount point owner ==
caller process owner (see
CVE later)


• DAServer.c


• _DAServerSessionQueueRe
quest function
CVE-2017-7170 - Snif
fi
ng
Authorization References on macOS
CVE-2017-7170 - credits
• found by Patrick Wardle


• details: https://objective-see.com/blog/blog_0x55.html
CVE-2017-7170 - background
• authorization can be passed between processes via
AuthorizationExternalForm


• security_authtrampoline


• old method


• executes privileged actions


• uses external authorization reference
CVE-2017-7170 - vulnerability
• AuthorizationExecuteWithPrivileges wrote the
external form out to $TMPDIR/random
fi
le


• write - unlink quickly


• if we can hold of the ref we can use it


• but! we can unlink $TMPDIR and point it to
somewhere else


• RAMdisk


• possibly also works by mounting over $TMPDIR
CVE-2017-7170 - exploitation
• we create a RAMdisk at $TMPDIR


• wait for an authorization reference to be written


• scan the raw RAMdisk for the token


• use it once security_authtrampoline authorized it :)
CVE-2017-2533 (pwn2own) -
Mount yourself a root shell
CVE-2017-2533 - credits
• was found by the "phoenhex" team, Niklas Baumstark and Samuel Groß


• part of the pwnown 2017 exploit chain


• details: https://phoenhex.re/2017-06-09/pwn2own-diskarbitrationd-
privesc
CVE-2017-2533 - the vulnerability
• disk arbitration service, (DARequest.c)


• check if mount point exists


• check if owned by the user (resolves
path)


• no further checks


• TOCTOU
CVE-2017-2533 - the exploit
• race:


• create a symlink pointing to a user owned directory


• call diskarbitration


• repoint the symlink to a root owned directory after the ownership check


• if mount successful: stop


• need to mount a disk image where the user has write access (EFI
partition)
CVE-2020-9771 - TCC bypass
via snapshot mounting
CVE-2020-9771 - the vulnerability
• APFS supports snapshots


• mount the snapshot in custom location, which falls outside of TCC's
protection


• access all
fi
les (read-only)


• mount with ”noowners” access every user’s
fi
les
CVE-2020-9771 - the
fi
x
• snapshot mounting requires Full Disk Access => problem


• even low privilege users can access other's
fi
le


• under the hood: MACF callout
CVE-2021-1784 - TCC bypass via
mounting over com.apple.TCC
CVE-2021-1784 -the vulnerability
• base case: user’s TCC DB
fi
le is protected


• but! We can mount over the directory


• prepare a new TCC.db
fi
le, new disk image


• mount over “~/Library/Application Support/com.apple.TCC”


• pro
fi
t 🤑


• bug collision with: Mikko Kenttälä (@Turmio_)
CVE-2021-30782 - TCC bypass
via AppTranslocation service
App Translocation
• makes NULLFS mount (not copy) when downloaded app
fi
rst run


• destination: $TMPDIR/AppTranslocation/d/d/Some.app


• open source as part of Security.


• library: libsecurity_translocate


• binary: /usr/libexec/lsd
CVE-2021-30782 - the vulnerability
• Add Quarantine attribute to “Library”


• Call the com.apple.security.translocation XPC service


• (XPC client is also open source)


• Map Library to $TMPDIR/AppTranslocation/d/d/Library


• Access all
fi
les
CVE-2021-30782 - POC
CVE-2021-30782 - the
fi
x
• new sandbox checks


• read - source


• mount - destination


• + sandbox check on mount point
access
CVE-2021-26089 - Fortinet
FortiClient installer LPE
CVE-2021-26089
• the installer uses several log
fi
les
inside /tmp/


• one: fctinstallpost.log


• being written as root


•
fi
xed content
CVE-2021-26089
• symlink attack


• we can do arbitrary overwrite


• code execution - ?


• overwrite periodic scripts
CVE-2021-26089
• the log will be treated as a script


• each line is executed


• pick: /Volumes/FortiClient/
fctdata/conf


• make a DMG
fi
le, mount it, place
a
fi
le at the above link


• will be run as root
Other generic installer trick
trick
• installer: writes
fi
les to:


• /tmp/
fi
xedname/bla/bla/bla


• we can create a mount over /tmp/
fi
xedname with noowners


• during install we can modify any
fi
les


• no race condition even if installer tries to delete /tmp/
fi
xedname
fi
rst
pipeline
bugs to be
fi
xed
• full TCC bypass


• full sandbox escape


• admin con
fi
g TCC bypass
Csaba Fitzl


Twitter: @theevilbit
Further resources
Links
• https://www.zerodayinitiative.com/advisories/ZDI-21-693/


•
Icons
•
fl
aticon.com


• xnimrodx


• Freepik

More Related Content

What's hot

GateKeeper - bypass or not bypass?
GateKeeper - bypass or not bypass?GateKeeper - bypass or not bypass?
GateKeeper - bypass or not bypass?Csaba Fitzl
 
SANS DFIR Prague: PowerShell & WMI
SANS DFIR Prague: PowerShell & WMISANS DFIR Prague: PowerShell & WMI
SANS DFIR Prague: PowerShell & WMIJoe Slowik
 
DevOops Redux Ken Johnson Chris Gates - AppSec USA 2016
DevOops Redux Ken Johnson Chris Gates  - AppSec USA 2016DevOops Redux Ken Johnson Chris Gates  - AppSec USA 2016
DevOops Redux Ken Johnson Chris Gates - AppSec USA 2016Chris Gates
 
Everyone Matters In Infosec 2014
Everyone Matters In Infosec 2014Everyone Matters In Infosec 2014
Everyone Matters In Infosec 2014Micah Hoffman
 
SANS @Night Talk: SQL Injection Exploited
SANS @Night Talk: SQL Injection ExploitedSANS @Night Talk: SQL Injection Exploited
SANS @Night Talk: SQL Injection ExploitedMicah Hoffman
 
IIS Tilde Enumeration Vulnerability
IIS Tilde Enumeration VulnerabilityIIS Tilde Enumeration Vulnerability
IIS Tilde Enumeration VulnerabilityMicah Hoffman
 
Lares from LOW to PWNED
Lares from LOW to PWNEDLares from LOW to PWNED
Lares from LOW to PWNEDChris Gates
 
There is No Server: Immutable Infrastructure and Serverless Architecture
There is No Server: Immutable Infrastructure and Serverless ArchitectureThere is No Server: Immutable Infrastructure and Serverless Architecture
There is No Server: Immutable Infrastructure and Serverless ArchitectureSonatype
 
Container Security
Container SecurityContainer Security
Container SecurityJie Liau
 
[Wroclaw #7] Why So Serial?
[Wroclaw #7] Why So Serial?[Wroclaw #7] Why So Serial?
[Wroclaw #7] Why So Serial?OWASP
 
Hacker's Practice Ground - Wall of Sheep workshops - Defcon 2015
Hacker's Practice Ground - Wall of Sheep workshops - Defcon 2015 Hacker's Practice Ground - Wall of Sheep workshops - Defcon 2015
Hacker's Practice Ground - Wall of Sheep workshops - Defcon 2015 lokeshpidawekar
 
So. many. vulnerabilities. Why are containers such a mess and what to do abou...
So. many. vulnerabilities. Why are containers such a mess and what to do abou...So. many. vulnerabilities. Why are containers such a mess and what to do abou...
So. many. vulnerabilities. Why are containers such a mess and what to do abou...Eric Smalling
 
How to discover 1352 Wordpress plugin 0days in one hour (not really)
How to discover 1352 Wordpress plugin 0days in one hour (not really)How to discover 1352 Wordpress plugin 0days in one hour (not really)
How to discover 1352 Wordpress plugin 0days in one hour (not really)Larry Cashdollar
 
DEVNET-2003 Coding 203: Python - User Input, File I/O, Logging and REST API C...
DEVNET-2003	Coding 203: Python - User Input, File I/O, Logging and REST API C...DEVNET-2003	Coding 203: Python - User Input, File I/O, Logging and REST API C...
DEVNET-2003 Coding 203: Python - User Input, File I/O, Logging and REST API C...Cisco DevNet
 

What's hot (20)

GateKeeper - bypass or not bypass?
GateKeeper - bypass or not bypass?GateKeeper - bypass or not bypass?
GateKeeper - bypass or not bypass?
 
SANS DFIR Prague: PowerShell & WMI
SANS DFIR Prague: PowerShell & WMISANS DFIR Prague: PowerShell & WMI
SANS DFIR Prague: PowerShell & WMI
 
DevOops Redux Ken Johnson Chris Gates - AppSec USA 2016
DevOops Redux Ken Johnson Chris Gates  - AppSec USA 2016DevOops Redux Ken Johnson Chris Gates  - AppSec USA 2016
DevOops Redux Ken Johnson Chris Gates - AppSec USA 2016
 
Everyone Matters In Infosec 2014
Everyone Matters In Infosec 2014Everyone Matters In Infosec 2014
Everyone Matters In Infosec 2014
 
SANS @Night Talk: SQL Injection Exploited
SANS @Night Talk: SQL Injection ExploitedSANS @Night Talk: SQL Injection Exploited
SANS @Night Talk: SQL Injection Exploited
 
IIS Tilde Enumeration Vulnerability
IIS Tilde Enumeration VulnerabilityIIS Tilde Enumeration Vulnerability
IIS Tilde Enumeration Vulnerability
 
Lares from LOW to PWNED
Lares from LOW to PWNEDLares from LOW to PWNED
Lares from LOW to PWNED
 
Kali kinux1
Kali kinux1Kali kinux1
Kali kinux1
 
There is No Server: Immutable Infrastructure and Serverless Architecture
There is No Server: Immutable Infrastructure and Serverless ArchitectureThere is No Server: Immutable Infrastructure and Serverless Architecture
There is No Server: Immutable Infrastructure and Serverless Architecture
 
Node.js vs Play Framework
Node.js vs Play FrameworkNode.js vs Play Framework
Node.js vs Play Framework
 
Container Security
Container SecurityContainer Security
Container Security
 
[Wroclaw #7] Why So Serial?
[Wroclaw #7] Why So Serial?[Wroclaw #7] Why So Serial?
[Wroclaw #7] Why So Serial?
 
Revoke-Obfuscation
Revoke-ObfuscationRevoke-Obfuscation
Revoke-Obfuscation
 
Hacker's Practice Ground - Wall of Sheep workshops - Defcon 2015
Hacker's Practice Ground - Wall of Sheep workshops - Defcon 2015 Hacker's Practice Ground - Wall of Sheep workshops - Defcon 2015
Hacker's Practice Ground - Wall of Sheep workshops - Defcon 2015
 
So. many. vulnerabilities. Why are containers such a mess and what to do abou...
So. many. vulnerabilities. Why are containers such a mess and what to do abou...So. many. vulnerabilities. Why are containers such a mess and what to do abou...
So. many. vulnerabilities. Why are containers such a mess and what to do abou...
 
Designing & Building Secure Web APIs
Designing & Building Secure Web APIsDesigning & Building Secure Web APIs
Designing & Building Secure Web APIs
 
How to discover 1352 Wordpress plugin 0days in one hour (not really)
How to discover 1352 Wordpress plugin 0days in one hour (not really)How to discover 1352 Wordpress plugin 0days in one hour (not really)
How to discover 1352 Wordpress plugin 0days in one hour (not really)
 
DEVNET-2003 Coding 203: Python - User Input, File I/O, Logging and REST API C...
DEVNET-2003	Coding 203: Python - User Input, File I/O, Logging and REST API C...DEVNET-2003	Coding 203: Python - User Input, File I/O, Logging and REST API C...
DEVNET-2003 Coding 203: Python - User Input, File I/O, Logging and REST API C...
 
Injection flaw teaser
Injection flaw teaserInjection flaw teaser
Injection flaw teaser
 
DevSec Defense
DevSec DefenseDevSec Defense
DevSec Defense
 

Similar to Csaba fitzl - Mount(ain) of Bugs

macOS Vulnerabilities Hiding in Plain Sight
macOS Vulnerabilities Hiding in Plain SightmacOS Vulnerabilities Hiding in Plain Sight
macOS Vulnerabilities Hiding in Plain SightCsaba Fitzl
 
20+ Ways to Bypass Your macOS Privacy Mechanisms
20+ Ways to Bypass Your macOS Privacy Mechanisms20+ Ways to Bypass Your macOS Privacy Mechanisms
20+ Ways to Bypass Your macOS Privacy MechanismsSecuRing
 
Road to Opscon (Pisa '15) - DevOoops
Road to Opscon (Pisa '15) - DevOoopsRoad to Opscon (Pisa '15) - DevOoops
Road to Opscon (Pisa '15) - DevOoopsGianluca Varisco
 
CI / CD / CS - Continuous Security in Kubernetes
CI / CD / CS - Continuous Security in KubernetesCI / CD / CS - Continuous Security in Kubernetes
CI / CD / CS - Continuous Security in KubernetesSysdig
 
Gianluca Varisco - DevOoops (Increase awareness around DevOps infra security)
Gianluca Varisco - DevOoops (Increase awareness around DevOps infra security)Gianluca Varisco - DevOoops (Increase awareness around DevOps infra security)
Gianluca Varisco - DevOoops (Increase awareness around DevOps infra security)Codemotion
 
Containerizing your Security Operations Center
Containerizing your Security Operations CenterContainerizing your Security Operations Center
Containerizing your Security Operations CenterJimmy Mesta
 
Watch How The Giants Fall: Learning from Bug Bounty Results
Watch How The Giants Fall: Learning from Bug Bounty ResultsWatch How The Giants Fall: Learning from Bug Bounty Results
Watch How The Giants Fall: Learning from Bug Bounty Resultsjtmelton
 
Digital Forensics and Incident Response in The Cloud Part 3
Digital Forensics and Incident Response in The Cloud Part 3Digital Forensics and Incident Response in The Cloud Part 3
Digital Forensics and Incident Response in The Cloud Part 3Velocidex Enterprises
 
Symfony finally swiped right on envvars
Symfony finally swiped right on envvarsSymfony finally swiped right on envvars
Symfony finally swiped right on envvarsSam Marley-Jarrett
 
Continuous Security
Continuous SecurityContinuous Security
Continuous SecuritySysdig
 
Thotcon - All aboard the Fail Whale
Thotcon - All aboard the Fail WhaleThotcon - All aboard the Fail Whale
Thotcon - All aboard the Fail WhaleErin Willingham
 
Owning computers without shell access 2
Owning computers without shell access 2Owning computers without shell access 2
Owning computers without shell access 2Royce Davis
 
Docker and Puppet for Continuous Integration
Docker and Puppet for Continuous IntegrationDocker and Puppet for Continuous Integration
Docker and Puppet for Continuous IntegrationGiacomo Vacca
 
OpenCloudDay 2014: Deploying trusted developer sandboxes in Amazon's cloud
OpenCloudDay 2014: Deploying trusted developer sandboxes in Amazon's cloudOpenCloudDay 2014: Deploying trusted developer sandboxes in Amazon's cloud
OpenCloudDay 2014: Deploying trusted developer sandboxes in Amazon's cloudNetcetera
 
Docker在豆瓣的实践 刘天伟-20160709
Docker在豆瓣的实践 刘天伟-20160709Docker在豆瓣的实践 刘天伟-20160709
Docker在豆瓣的实践 刘天伟-20160709Tianwei Liu
 
Cloud Device Insecurity
Cloud Device InsecurityCloud Device Insecurity
Cloud Device InsecurityJeremy Brown
 
Devoxx France 2015 - The Docker Orchestration Ecosystem on Azure
Devoxx France 2015 - The Docker Orchestration Ecosystem on AzureDevoxx France 2015 - The Docker Orchestration Ecosystem on Azure
Devoxx France 2015 - The Docker Orchestration Ecosystem on AzurePatrick Chanezon
 
Lions, Tigers and Deers: What building zoos can teach us about securing micro...
Lions, Tigers and Deers: What building zoos can teach us about securing micro...Lions, Tigers and Deers: What building zoos can teach us about securing micro...
Lions, Tigers and Deers: What building zoos can teach us about securing micro...Sysdig
 
Container Runtime Security with Falco
Container Runtime Security with FalcoContainer Runtime Security with Falco
Container Runtime Security with FalcoMichael Ducy
 
Docker - Demo on PHP Application deployment
Docker - Demo on PHP Application deployment Docker - Demo on PHP Application deployment
Docker - Demo on PHP Application deployment Arun prasath
 

Similar to Csaba fitzl - Mount(ain) of Bugs (20)

macOS Vulnerabilities Hiding in Plain Sight
macOS Vulnerabilities Hiding in Plain SightmacOS Vulnerabilities Hiding in Plain Sight
macOS Vulnerabilities Hiding in Plain Sight
 
20+ Ways to Bypass Your macOS Privacy Mechanisms
20+ Ways to Bypass Your macOS Privacy Mechanisms20+ Ways to Bypass Your macOS Privacy Mechanisms
20+ Ways to Bypass Your macOS Privacy Mechanisms
 
Road to Opscon (Pisa '15) - DevOoops
Road to Opscon (Pisa '15) - DevOoopsRoad to Opscon (Pisa '15) - DevOoops
Road to Opscon (Pisa '15) - DevOoops
 
CI / CD / CS - Continuous Security in Kubernetes
CI / CD / CS - Continuous Security in KubernetesCI / CD / CS - Continuous Security in Kubernetes
CI / CD / CS - Continuous Security in Kubernetes
 
Gianluca Varisco - DevOoops (Increase awareness around DevOps infra security)
Gianluca Varisco - DevOoops (Increase awareness around DevOps infra security)Gianluca Varisco - DevOoops (Increase awareness around DevOps infra security)
Gianluca Varisco - DevOoops (Increase awareness around DevOps infra security)
 
Containerizing your Security Operations Center
Containerizing your Security Operations CenterContainerizing your Security Operations Center
Containerizing your Security Operations Center
 
Watch How The Giants Fall: Learning from Bug Bounty Results
Watch How The Giants Fall: Learning from Bug Bounty ResultsWatch How The Giants Fall: Learning from Bug Bounty Results
Watch How The Giants Fall: Learning from Bug Bounty Results
 
Digital Forensics and Incident Response in The Cloud Part 3
Digital Forensics and Incident Response in The Cloud Part 3Digital Forensics and Incident Response in The Cloud Part 3
Digital Forensics and Incident Response in The Cloud Part 3
 
Symfony finally swiped right on envvars
Symfony finally swiped right on envvarsSymfony finally swiped right on envvars
Symfony finally swiped right on envvars
 
Continuous Security
Continuous SecurityContinuous Security
Continuous Security
 
Thotcon - All aboard the Fail Whale
Thotcon - All aboard the Fail WhaleThotcon - All aboard the Fail Whale
Thotcon - All aboard the Fail Whale
 
Owning computers without shell access 2
Owning computers without shell access 2Owning computers without shell access 2
Owning computers without shell access 2
 
Docker and Puppet for Continuous Integration
Docker and Puppet for Continuous IntegrationDocker and Puppet for Continuous Integration
Docker and Puppet for Continuous Integration
 
OpenCloudDay 2014: Deploying trusted developer sandboxes in Amazon's cloud
OpenCloudDay 2014: Deploying trusted developer sandboxes in Amazon's cloudOpenCloudDay 2014: Deploying trusted developer sandboxes in Amazon's cloud
OpenCloudDay 2014: Deploying trusted developer sandboxes in Amazon's cloud
 
Docker在豆瓣的实践 刘天伟-20160709
Docker在豆瓣的实践 刘天伟-20160709Docker在豆瓣的实践 刘天伟-20160709
Docker在豆瓣的实践 刘天伟-20160709
 
Cloud Device Insecurity
Cloud Device InsecurityCloud Device Insecurity
Cloud Device Insecurity
 
Devoxx France 2015 - The Docker Orchestration Ecosystem on Azure
Devoxx France 2015 - The Docker Orchestration Ecosystem on AzureDevoxx France 2015 - The Docker Orchestration Ecosystem on Azure
Devoxx France 2015 - The Docker Orchestration Ecosystem on Azure
 
Lions, Tigers and Deers: What building zoos can teach us about securing micro...
Lions, Tigers and Deers: What building zoos can teach us about securing micro...Lions, Tigers and Deers: What building zoos can teach us about securing micro...
Lions, Tigers and Deers: What building zoos can teach us about securing micro...
 
Container Runtime Security with Falco
Container Runtime Security with FalcoContainer Runtime Security with Falco
Container Runtime Security with Falco
 
Docker - Demo on PHP Application deployment
Docker - Demo on PHP Application deployment Docker - Demo on PHP Application deployment
Docker - Demo on PHP Application deployment
 

Recently uploaded

10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka DoktorováCzechDreamin
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaCzechDreamin
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor TurskyiFwdays
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Thierry Lestable
 
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀DianaGray10
 
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Julian Hyde
 
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...CzechDreamin
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersSafe Software
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...Product School
 
UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1DianaGray10
 
Agentic RAG What it is its types applications and implementation.pdf
Agentic RAG What it is its types applications and implementation.pdfAgentic RAG What it is its types applications and implementation.pdf
Agentic RAG What it is its types applications and implementation.pdfChristopherTHyatt
 
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCustom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCzechDreamin
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomCzechDreamin
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesBhaskar Mitra
 
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekCzechDreamin
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupCatarinaPereira64715
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualityInflectra
 
UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2DianaGray10
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Product School
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Product School
 

Recently uploaded (20)

10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara Laskowska
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
 
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
 
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1
 
Agentic RAG What it is its types applications and implementation.pdf
Agentic RAG What it is its types applications and implementation.pdfAgentic RAG What it is its types applications and implementation.pdf
Agentic RAG What it is its types applications and implementation.pdf
 
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCustom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
 
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří Karpíšek
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 

Csaba fitzl - Mount(ain) of Bugs

  • 1. Mount(ain) of Bugs Csaba Fitzl Twitter: @theevilbit
  • 2. whoami • author of "macOS Control Bypasses" at Offensive Security • ex red/blue teamer • macOS bug hunter • husband, father • hiking, trail running 🥾 🏔
  • 3. pwd
  • 4. agenda 1. MACF 2. the mount system call 3. disk arbitration service 4. CVE-2017-7170 (Patric Wardle) - Snif fi ng Authorization References 5. CVE-2017-2533 (pwn2own) - Mount yourself a root shell 6. CVE-2020-9771 - TCC bypass via snapshot mounting 7. CVE-2021-1784 - TCC bypass via mounting over com.apple.TCC 8. CVE-2021-30782 - TCC bypass via AppTranslocation service 9. CVE-2021-26089 - Fortinet Forticlient installer LPE 10. other tricks and new bugs
  • 6. MACF • origin: TrustedBSD MAC • implemented in kernel • policy modules extend the kernel • can place hooks in supported location • very powerful
  • 7. MACF • very - very powerful • was part of KDK till OS X 10.12 (never of fi cially supported) • mac.h header was removed • available in xnu: `security/mac.h`, `security/mac_framework.h`, `mac_vfs.h` • examples: AppleMobileFileIntegrity, Sandbox, EndpointSecurity, Quarantine (=Gatekeeper)
  • 8. MACF • typical callout from xnu: mac_......
  • 10. MACF • MAC_CHECK • iterates over all policy frameworks • mpo_... (mac_policy.h)
  • 12. VFS • macOS uses Virtual Filesystem Switch (VFS) • origin: Solaris • used in most *nix based systems • abstracts speci fi c fi le system implementation • MACF callouts at speci fi c points - hooked by the Sandbox
  • 15. diskarbitration - the basics • system wide service, de fi ned in: • /System/Library/LaunchDaemons/com.apple.diskarbitrationd.plist • XPC: com.apple.DiskArbitration.diskarbitrationd • manage disk mounting, unmounting • calls mount/unmount system calls under the hood
  • 16. diskarbitration - why we like it? • runs as root • unsandboxed • XPC service accessible from application sandbox • opensource
  • 17. diskarbitration - the checks • to prevent abuse, it has to con fi rm: • if the caller sandboxed • if the mount point owner == caller process owner (see CVE later) • DAServer.c • _DAServerSessionQueueRe quest function
  • 19. CVE-2017-7170 - credits • found by Patrick Wardle • details: https://objective-see.com/blog/blog_0x55.html
  • 20. CVE-2017-7170 - background • authorization can be passed between processes via AuthorizationExternalForm • security_authtrampoline • old method • executes privileged actions • uses external authorization reference
  • 21. CVE-2017-7170 - vulnerability • AuthorizationExecuteWithPrivileges wrote the external form out to $TMPDIR/random fi le • write - unlink quickly • if we can hold of the ref we can use it • but! we can unlink $TMPDIR and point it to somewhere else • RAMdisk • possibly also works by mounting over $TMPDIR
  • 22. CVE-2017-7170 - exploitation • we create a RAMdisk at $TMPDIR • wait for an authorization reference to be written • scan the raw RAMdisk for the token • use it once security_authtrampoline authorized it :)
  • 23. CVE-2017-2533 (pwn2own) - Mount yourself a root shell
  • 24. CVE-2017-2533 - credits • was found by the "phoenhex" team, Niklas Baumstark and Samuel Groß • part of the pwnown 2017 exploit chain • details: https://phoenhex.re/2017-06-09/pwn2own-diskarbitrationd- privesc
  • 25. CVE-2017-2533 - the vulnerability • disk arbitration service, (DARequest.c) • check if mount point exists • check if owned by the user (resolves path) • no further checks • TOCTOU
  • 26. CVE-2017-2533 - the exploit • race: • create a symlink pointing to a user owned directory • call diskarbitration • repoint the symlink to a root owned directory after the ownership check • if mount successful: stop • need to mount a disk image where the user has write access (EFI partition)
  • 27.
  • 28. CVE-2020-9771 - TCC bypass via snapshot mounting
  • 29. CVE-2020-9771 - the vulnerability • APFS supports snapshots • mount the snapshot in custom location, which falls outside of TCC's protection • access all fi les (read-only) • mount with ”noowners” access every user’s fi les
  • 30. CVE-2020-9771 - the fi x • snapshot mounting requires Full Disk Access => problem • even low privilege users can access other's fi le • under the hood: MACF callout
  • 31. CVE-2021-1784 - TCC bypass via mounting over com.apple.TCC
  • 32. CVE-2021-1784 -the vulnerability • base case: user’s TCC DB fi le is protected • but! We can mount over the directory • prepare a new TCC.db fi le, new disk image • mount over “~/Library/Application Support/com.apple.TCC” • pro fi t 🤑 • bug collision with: Mikko Kenttälä (@Turmio_)
  • 33.
  • 34. CVE-2021-30782 - TCC bypass via AppTranslocation service
  • 35. App Translocation • makes NULLFS mount (not copy) when downloaded app fi rst run • destination: $TMPDIR/AppTranslocation/d/d/Some.app • open source as part of Security. • library: libsecurity_translocate • binary: /usr/libexec/lsd
  • 36. CVE-2021-30782 - the vulnerability • Add Quarantine attribute to “Library” • Call the com.apple.security.translocation XPC service • (XPC client is also open source) • Map Library to $TMPDIR/AppTranslocation/d/d/Library • Access all fi les
  • 38.
  • 39. CVE-2021-30782 - the fi x • new sandbox checks • read - source • mount - destination • + sandbox check on mount point access
  • 41. CVE-2021-26089 • the installer uses several log fi les inside /tmp/ • one: fctinstallpost.log • being written as root • fi xed content
  • 42. CVE-2021-26089 • symlink attack • we can do arbitrary overwrite • code execution - ? • overwrite periodic scripts
  • 43. CVE-2021-26089 • the log will be treated as a script • each line is executed • pick: /Volumes/FortiClient/ fctdata/conf • make a DMG fi le, mount it, place a fi le at the above link • will be run as root
  • 44.
  • 46. trick • installer: writes fi les to: • /tmp/ fi xedname/bla/bla/bla • we can create a mount over /tmp/ fi xedname with noowners • during install we can modify any fi les • no race condition even if installer tries to delete /tmp/ fi xedname fi rst
  • 48. bugs to be fi xed • full TCC bypass • full sandbox escape • admin con fi g TCC bypass