18 ms·
Disclosure: Another macOS privacy protections bypass
- sillysaurusx 6y agoMy sample exploit uploads some of your private data (your Top Sites, for example) to a server that I control, because that's an easy thing to do when I can run any JavaScript I want. Note that I'm not really collecting any data, as http://lapcatsoftware.com/test/ http://lapcatsoftware.com/test/ is a dead link. I used http so that you can see the private data being sent in a packet trace. Please don't do this when reproducing exploits. Yes, it's just source code, and yes, the url is dead. But it's still source code that, when compiled, will grab your real safari data and attempt to upload to a url that could be switched on. There's a difference between repro'ing an exploit and weaponizing an exploit. alert(1) is generally the best thing to aim for, or even alert(some user data) to illustrate the point. Whereas upload(some user data, my server) is a bit too close to the moral equivalent of `rm -rf $HOME/*`: all of these illustrate the point, but rm'ing a homedir is generally not a great thing to have in your repro; ditto for uploading real user data. exmaple.com was explicitly reserved for scenarios like this, which would accomplish the same thing safely. It may seem like a pedantic point, but it was something I was taught as a pentester: don't weaponize exploits; simply reproduce them. So my instincts kicked in, and it's impossible not to mention it. (That said, I don't mean to make a fuss – it's not a big deal in this case.) By the way, I found this post via the author's twitter: https://twitter.com/lapcatsoftware https://twitter.com/lapcatsoftware I've been following them for about a year now, and their tweets on Mac programming have been quite informative.
- jefftk 6y ago"example.com"?
- deleted 6y ago[deleted]
- filleokus 6y agoexample.com (among others) is reserved per https://tools.ietf.org/html/rfc2606 https://tools.ietf.org/html/rfc2606 It's very unlikely that those reserved domains will be controlled by someone nefarious in the foreseeable future. I've made it a habit to use them instead of something like "insertyourdomain.com" in example configurations or dummy data for tests (where I perhaps need a valid-looking domain). In the unlikely event that something is ever sent to it, example.com is a much better choice than just some random string, since someone could register it and accept that traffic.
- comfydragon 6y agoGP commenter said (note the typo): > exmaple.com was explicitly reserved for scenarios like this
- filleokus 6y agoAaah... Sorry. I'm guessing this is also why we perhaps should avoid even "example.com"-URL's if it's really bad if someone receives the traffic :-)
- aidos 6y agoNo expert, but even example.com isn't totally safe, right? According to the RFC (https://tools.ietf.org/html/rfc6761 https://tools.ietf.org/html/rfc6761), while these domains are reserved, nothing should treat them specially, so there's nothing to stop people having them routed somewhere else at the DNS level.
- gruez 6y agoAFAIK the domain is controlled by the IANA, so it's probably not too big of a security risk. If you really want to be paranoid you can set the site to be 0.0.0.0 or attacker.invalid.
- jefftk 6y agoattacker.invalid is good. So are <anything>.invalid, <anything>.test, or <anything>.example. They're all reserved and don't route.
- voxic11 6y agoMaybe on your system, but there is nothing in the standards which forbids them from being routable.
- gruez 6y agoBut by default they won't be routable. I guess you can shoot yourself in the foot and have entries in your /etc/hosts point to your attacker's site, but that's kind of hacking yourself.
- deleted 6y ago[deleted]
- morelisp 6y agoThe standard forbids (well, "should nots", which is the best you get most of the time) .invalid. from routing. It's supposed to be filtered at the nameserver API level and everything after that (cached DNS, authoritative DNS, registrar, etc.)
- DavidSJ 6y agoAnother problem with this demonstration is that by exfiltrating the data via HTTP, even if it ends up in /dev/null on the other side, the user’s ISP and anyone else in a position to sniff packets along the route can now know the user’s top sites.
- Nightshaxx 6y agoWhy would you run _any_ code with a known exploit on a personal machine with your personal data. At minimum make a new user and run it on there for heaven's sake.
- bluesign 6y agoThis sounds like a bug in safari more than osx tbh.
- cytzol 6y agoThe developer claims otherwise, that you can do the same with any app: https://twitter.com/lapcatsoftware/status/1277941392845811712 https://twitter.com/lapcatsoftware/status/127794139284581171...
- L3viathan 6y agoNo, Safari is just an easy way to exploit this bug. In principle, it works with any app that can be convinced to run arbitrary code by changing its resources. What Safari is doing isn't wrong and wouldn't cause an issue if TCC would check the entire app, including resources. It's true that you can't use this to copy the privileges of _any_ app, only of those that have this property.
- bluesign 6y agoIt works with any app that can be convinced to run arbitrary code. It is limiting the scope very much. TCC shouldnt check entire app for signature. Safari should verify its resources, is what I am saying
- kbumsik 6y ago> It works with any app that can be convinced to run arbitrary code. I guess any Electron apps and apps using webview for its local resources do it too.
- fortran77 6y agoCan you get a licensed copy of OSX without Safari? If not, it's part of the OS.
- bluesign 6y agoThere is separation between responsibilities, even those apps are apple apps. Basically if you can do with any app, it is OSX, otherwise apps fault Even apple guides state: You must also verify that the file you intend to read from or write to is the same file that you created.
- cytzol 6y agoI commented this on the Big Sur thread last week: > I was really hoping they'd take some time to address Catalina's glaring issues — its slowness, bugginess, just general sloppiness — and instead they did the opposite. I didn't include "security exploits" in that list because of course they're going to fix security exploits, right? Especially one that they're already aware of, and can reproduce — they wouldn't just sit on it in favour of making the UI glossier, right? Apple have just been getting so much wrong lately. This pretty much dashes any hopes I had of ever upgrading, because even if this particular flaw gets fixed by the time Big Sur comes out, there are almost certainly others that they've ignored. I expected to eventually have to grit my teeth and upgrade so I wasn't behind on security updates, but I guess that's not the case. Ugh, now I have to figure out how to mute that annoying (1) in System Preferences. I've heard they keep making it come back now.
- dan_hawkins 6y agoIt's getting even worse - with the most recent security update for Mojave I can no longer block Catalina from the available updates using `sudo softwareupdate --ignore "macOS Catalina"`. It always shows up now in System Preferences -> Software Update. Anyone nows how to block it effectively?
- Wowfunhappy 6y agoI shared your concerns prior to trying Big Sur, but in practice I'm somewhat shocked by how much I like it. Big Sur is very snappy on my aging 2015 Macbook Air, and I've encountered far fewer bugs than I'd expect in an initial developer preview, which bodes well for the final release. I like the visuals too, at least compared to Yosemite-era; Leopard-era still wins out overall. Using the OS has made me feel much better about the Mac as a platform, although I'm certainly still nervous.
- unicornfinder 6y agoOut of curiosity, would you say it's an improvement coming from Catalina? My confidence in the Mac was really shaken by Catalina but I'm genuinely ready to be impressed by Big Sur.
- nwellnhof 6y agoShouldn't 'Safari.app/Contents/Resources/HTMLViewController.js' be codesigned? Why does Safari launch at all if this file was modified?
- saagarjha 6y agoIIRC once an app is launched the resources are not checked again. Let me see if I can look up if this is documented somewhere.
- jonhermansen 6y agoWouldn't that kinda defeat the whole purpose of signing the app?
- saagarjha 6y ago¯\_(ツ)_/¯
- oefrha 6y ago> My personal opinion is that macOS privacy protections are mainly security theater and only harm legitimate Mac developers while allowing malware apps to bypass them through many existing holes such as the one I'm disclosing, and that other security researchers have also found. I feel that if you already have a hostile non-sandboxed app running on your Mac, then you're in big trouble regardless, so these privacy protections won't save you. The best security is to be selective about which software you install, to be careful to avoid ever installing malware on your Mac in the first place. There's a reason that my security research has focused on macOS privacy protections: my goal is to show that Apple's debilitating lockdown of the Mac is not justified by alleged privacy and security benefits. In that respect, I think I've proved my point, over and over again. In any case, you have the right to know that the systems you rely on for protection are not actually protecting you. Substitute "security" for "privacy" and you immediately see why the argument is flawed. "Other people and I have found bugs that bypass security features, ergo security features are security theater and only harm legitimate developers. Better have a free-for-all OS and be mindful of what you install." (Yes, you should be mindful of what you install, regardless.)
- Terretta 6y agoRight! Who needs seatbelts or airbags on a car with great brakes -- just be careful and don't drive into things. </s>
- _qulr 6y agoThis is not a useful analogy. You won't die or be horribly disfigured sitting at your keyboard. The tradeoffs of driving a car vs using a Mac are very different. They're not comparable.
- _qulr 6y agoIt's strange that the people who disagree with my "security theater" comment don't seem to be alarmed about the bug I disclosed, which is a very serious one if you really do believe that macOS privacy protections are important.
- aboringusername 6y ago> I'm not interested in waiting years for a bounty. I can't speak for anyone else, but my personal experience is that the Apple Security Bounty Program has been a disappointment, and I don't plan to participate again in the future. Yeah...Hint to Apple: When somebody discloses something, responsibly, you react to that with a proper process and understand you get 90 days in most cases as is industry standard (that's typically how Google Project Zero operates). Otherwise don't be surprised when exploits end up sold for much more on a black market because nobody wants to cooperate with you. Think we need a few more 0-days that cost Apple a few bad PR spins (as well as others like Valve) to make them wake up and actually have a proper process.
- rydre 6y agoI can confirm this! Back in 2017, I was 17 and found a flaw that affected the privacy of all browsers and required a web standards change. Google/Chromium (Andrew R. Whalley) paid me a good bounty for that, but Apple (mac, ios, iphone, watch) didn't pay. I didn't expect Mozilla to pay obviously since they were non profit.
- 3pt14159 6y agoWhat was the exploit? I've been sitting on one that's essentially as old as the web but I figured it was pointless to try to alert browers about it because too much functionality rests on it.
- XCabbage 6y agoDon't tease us - what was your exploit? Just from the description, I'm happy taking a guess that this is going to involve somehow exploiting the browser cache (e.g. via timing how long it takes to request an image from another domain that may or may not have previously been cached) to determine whether the user has visited a page. That was first written up by academics decades ago, and has since been independently invented by several people (me included), but wasn't fixed as of whenever I last checked a couple of years ago. Is my wild guess right? :)
- floatingatoll 6y ago> my goal is to show that Apple's debilitating lockdown of the Mac is not justified by alleged privacy and security benefits. In that respect, I think I've proved my point If every attempt to improve something were disproven by the presence of flaws, it would disprove all attempts to do anything with software ever. I get that people don't like the macOS privacy protection efforts, but that's no reason to construct a logical fallacy.
- _qulr 6y agoIt's interesting that you chose to omit "over and over again" from the end of the quote. I would also mention to this: > There are two fundamental flaws in TCC that make this exploit possible We know that TCC is a major burden for legitimate Mac apps. But is it a major burden for malware? That's the question, and it seems to me the answer is no. There are so many holes in this system, it only stops the good developers who wouldn't stoop to using the countless hacks readily available to malware developers.
- saagarjha 6y agoI think the biggest issue is that it’s been bolted on macOS, so it works nowhere near as well as it does on iOS. I’m sure you’re aware of the many other cases where there’s been holes in the macOS version of some enforcement because it was added later and without considering how it might fit ;)
- huslage 6y agoLocks on your house only protect you from people who use doors. I'm not sure this argument holds up either.
- _qulr 6y agoBut imagine if you only locked your front door and left your back door completely unlocked all the time. The front door lock would stop honest visitors from entering your home, but they probably didn't need to be stopped anyway, because they would knock before entering. Whereas criminals will neither knock nor use the front door.
- Spivak 6y agoThis is a scary exploit. If by modifying a bundle's resources you can coax an app to do something it shouldn't then an attacker can make a copy of the app with the malicious resources and assume the full privilege of the app. Or phrased differently. All installations of the same app have the same privilege.
- bengotow 6y agoWait, so you can just duplicate an app that has more privileges than your app, modify it, and run it to exploit it's access? This is a pretty glaring security issue actually - after reading this, it seems like Apple's choice to track app permissions / security exceptions by the app's bundle ID and not its file path was a pretty big mistake. I wonder if this is a case of iOS security engineers working on macOS, forgetting that app bundle IDs aren't enforced by a central install flow on the platform?
- saagarjha 6y agoFile path is wrong, too. What should be checked is the bundle’s code signature.
- _qulr 6y agoIt does check the code signature. However, it's not a "deep check". The problem with doing a deep check, including all of the apps Resources, is that this can be very resource intensive, depending on the app. It's the reason why Xcode takes forever to "verify" on first launch. If there was a deep code signature check on every TCC check, you would see a lot of very long pauses.
- _qulr 6y agoYou can guarantee that the system apps haven't been tampered with, at their system file paths, because of System Integrity Protection. But all bets are off if you make a copy of a system app elsewhere on the disk.
- saagarjha 6y agoRight, I meant “deep code signature” rather than “executable code signature”, thanks for the correction. I think macOS has a thing where it only checks the former the first time you launch an app and not after that, so you can scribble all over the resources and the system won’t care. Presumably this was thought to not be a big deal, but you showed a pretty good example of how you could launch a data-only attack on the privileges associated with the program :)
- yardie 6y ago> macOS privacy protections are mainly security theater and only harm legitimate Mac developers while allowing malware apps to bypass them through many existing holes such as the one I'm disclosing So this is just another abuse of the term "security theatre." Door locks, for example, are legitimate security. There are plenty of lock picking sets on the market. But that does not mean door locks do not work. TCC works because a casual user isn't trying to override it. But if it didn't exist then users would have no protection at all. It still comes down to the person sitting behind the computer is in complete command of it. And security knowledge is the best security you can buy.
- Wowfunhappy 6y ago> It still comes down to the person sitting behind the computer is in complete command of it. No I'm not. If I had complete command, I could actually turn off the damn prompts so my own scripts worked.
- yardie 6y agoIf you are physically in front of it and have admin privileges there probably is a non-trivial way to disable those prompts. Disabling SIP and all sorts of protections is involved.
- Wowfunhappy 6y agoI've tried! I keep SIP off anyway, so it's certainly possible, but Apple neglected to actually give us a mechanism for turning off TCC, and I'm not an OS developer. There isn't a boot flag, or a process you can disable, or anything like that.
- _qulr 6y agoAdmin privileges are not involved in any way.
- programAgaib 6y agoSecurity theatre works for Apple. Customers buy the products and can logically say "I value my security so I buy Apple products".
- t0mmyb0y 6y ago"I didn't expect Mozilla to pay obviously since they were non profit." In 2017 Mozilla made a ton of money off google. Yes, Mozilla makes their money selling your search.
- Ansil849 6y agoWhenever I read an independent disclosure in an area I'm unfamiliar with such as this, involving the failure of the vendor to engage with the security researcher , I'm always presented with a parsing dilemma: is the vendor justified in ignoring the exploit because it is not really as severe as the author makes it out to be - or is the author correct and this is a serious vulnerability which the vendor has ignored/let slip through the cracks?
- _qulr 6y agoI'm not even claiming the vulnerability is serious. But when there's a bug bounty involved, the question is whether the vendor is ever going to pay, or the vendor is just leading the bug reporter on to keep it quiet for as long as possible.
- _qulr 6y agoApple doesn't pay a bounty until after they release a fix. So if Apple decided to de-prioritize a bug, you never get paid. But Apple doesn't tell if you they've de-prioritized a bug, they just want you to remain silent forever, and they say "We're still investigating."
- searchableguy 6y agoI don't understand how big companies are always penny-pinchers in this area. Anyone got a glue?
- Ansil849 6y agoMy armchair theory is that there is a bit of hubris involved: in-house developers are hesitant to admit they've been 'bested' by a stranger on the internet, and so downplay or even just have blinders on against recognizing in the first place the severity of the issue. Though to be far, I think the flipside is also at times true - where the independent security researcher believes the anthill they've found is a mountain.
- Wowfunhappy 6y agoMinor correction for the author, TCC was not introduced in Mojave. It's actually present on the 10.9 ("Mavericks") machine I'm using right now, where it controls which apps are allowed to use UI scripting. Like on modern systems, this is all stored in a database called "tcc.db", and it can be reset with the Terminal command "tccutil". This 10.9 incarnation on TCC is much weaker, however. It doesn't apply to most Apple Events—only UI scripting—and once the user whitelists an application, that application can control any other app on the machine. Also, because SIP wasn't introduced until 10.11, there was originally nothing to stop an application with admin privileges from editing tcc.db directly and whitelisting itself—as Dropbox later did!
- deleted 6y ago[deleted]
- mindfulhack 6y ago> My personal opinion is that macOS privacy protections are mainly security theater I really disagree. This feature has revealed that Google Drive by default spies on my ~/Downloads folder - something it has no business doing, nor did I ever intend for it to do. I actually love the many things Apple are implementing to improve user privacy from third-party apps and services right now. To an extent, their privacy brand actually is real, and helpful. Just don't expect any privacy from Apple themselves (and by extension the government). At least they help reduce Google and Facebook's rampant surveillance. That's some good news, in today's era of tech.