
#Apple safari back browser runs risk zip file
We then opened this zip file in a hex editor and removed the entire first Local File Header.Ī simplified solution with less chance of breaking the central directory record would be to zip an application using the following command: zip -r test.zip test.app/Contents For example, we took an unsigned application named test.app and placed it in a zip file using the following command: ditto -c -k -keepParent path_to_unsigned_application zip_file We determined that the easiest way to confuse the BoM function is by ensuring that the root of the application is not the first local file header of the zip file. The application itself is all Gatekeeper looks for. Crafting the BypassĪs mentioned earlier, if the quarantine attribute gets applied to files or folders under the test.app directory, Gatekeeper is not triggered. Presumably, if we can keep our application’s root directory off this list of files, the extended attribute will not be applied to it. Although there is no documentation on BoM files being used with zip files, this function seems to imply there might be some low-level functionality that uses a BoM object to keep track of files extracted from zip files. Most notable here is the extractPKZip and copyQuarantine options. Using the lsbom command-line utility, BoM files can be printed on-screen. Looking inside the BoM file tells you which files were created by that software.
#Apple safari back browser runs risk software
The name of the BoM file tells you what software was installed or updated. Many power users are familiar with the /System/Library/Receipts directory, which holds a list of BoM files. BoM items can even be saved to files in binary format (using mkbom). For example, if an individual sends a directory to another user over AirDrop, a temporary BoM file is created on the sender’s system that holds a record of all the files that were sent in that transaction. These objects are used in many different places by Apple to keep a running list of file paths when a major file transaction occurs. To better understand the issue at hand, it helps to have some background on the Bill of Materials (BoM).

On the other, it is set to the test.app/Contents directory. On one, it is pointed at the test.app folder. What we noticed is that the root of the zip file points to two different locations. Upon comparing the zip file created with Butler to a zip file we created using a standard zip command-line utility, we noticed a subtle difference. After trying a few different combinations, we were indeed able to skip the Gatekeeper prompts when our custom zip file was downloaded via Safari. We surmised the way in which it was re-zipping the application was causing the bypass to accidentally occur, having no reason to believe that the website creators were aware of the bug.įor testing purposes, we built an application and ran it through the Butler command-line tool. Butler analyzes an uploaded application and re-zips it before hosting it for download. This tool allows them to easily manage the games which are hosted on their account.

Developers are encouraged to use an open-source Go-Lang command-line tool called Butler. This of course raised the question, “What’s so special about the zip files hosted on this website?” Fortunately, we were able to answer this question thanks to the great documentation that the site provides as to how games are handled. Since the bug only seems to exist when an auto-extraction occurs, we suspected a bug in this process. The process responsible for automatically unzipping downloaded applications is. By default, Safari has a built-in feature that is enabled that will automatically unzip applications held within a zip file after downloading them. We did note that many applications were delivered in the form of a zip file. Upon further testing, we noted that we would only receive the expected Gatekeeper prompts if the application was downloaded from a third-party web browser, such as Google Chrome. This made us very curious because not only were these applications being downloaded from the Internet but most were completely unsigned. After downloading and opening a handful of games, we noticed that many would not trigger an alert from Gatekeeper. While investigating websites that host a large number of third-party macOS applications, we came across the popular game hosting website itch.io, where many independent game developers host their games. After the user has chosen to run the program - regardless of the Gatekeeper prompts - the operating system will no longer prompt the user when launching this specific application in the future.

This is all due to the fact that applications downloaded for the first time have an extended attribute placed on them titled.
