Syndicate

Syndicate content

Flattr


Flattr this

If you like this, you can use flattr. ;)

Imprint

About
eMail: wishinet at gmail . com
PGP ID: 0xCCCA5E74

Jabber: wishi@jabber.ccc.de

Applying sandbox-exec around Safari with a single click

txttxt

Isolating it



To a certain degree it makes sense to allow the web-browser accessing all readable files on the system. But JUST to a certain degree. Todays threats evolve to target web-browsers' interactive functions. Safari has vulnerabilities.

In any case the following restriction-set is just an experiment. sandbox-exec is an Apple utility that isolates certain services and applications since MacOS Leopard. Maybe it won't be there tomorrow. It's not officially documented and developers aren't encouraged to use sandbox.h jet, as far as I know. Nevertheless the Google NativeClient project is going to use it as the "Outer Sandbox" as far as I'm concerned.

The Launcher



Create the following Apple-Script:


do shell script "sandbox-exec -f /Users/wishi/policies/sandbox-safari.sb /Applications/Safari.app/Contents/MacOS/Safari"



Change the pathname after the -f parameter. I guess your Safari, if you aren't using version 4 in the developer preview, is in /Applications. If you're using the version 4 preview: I just tested it with 3.2.1. Latter works fine.

The .sb policy



You can find similar policy files at several places. I didn't create this entirely. - just stole here and there ;).


(version 1)
(debug deny) ; Use (debug all) to see every action)
(allow network-outbound)
(allow signal)
(allow ipc-posix-shm) ; Needed for POSIX shared memory
;(allow process-exec (regex #"^/Applications/Safari.app/*"))
(allow sysctl-read)
(allow file-read-metadata)
(allow signal)
(allow process*)
;(allow mach*)
(allow mach-lookup)
;(allow process-exec (regex "^/System/Library/CoreServices/*"))
;; Allow to read these files:
(allow file-read*
(regex
#"^/Users/wishi/$"
#"^/Users/wishi/Downloads"
#"^/Users/wishi/Library"
#"^/Users/wishi/Public"
#"^/Users/wishi/Sites"
#"^/Applications/Safari.app"
#"^/Library/*"
#"^/System/Library/*"
#"^/usr/lib/*"
#"^/usr/share/*"
#"^/private/*"
#"^/dev/*"
)
)
;; Allow to write these files:
(allow file-write*
(regex
#"^/Users/wishi/Downloads/*"
#"^/Volumes/foo/bar/*"
#"^/Users/wishi/Library/.*"
#"^/private/var/*"
#"^/dev/dtracehelper"
)
)
(deny default)



Change the path stuff according to your system setup. Your username isn't wishi. So your Home-directory differs.
Save this file in ~/policies for example. Now save the Apple-Script as a .app-program with the Scripteditor.app. Move the program to /Applications, drag it into the Dock. Ready!


Have fun,
wishi

Post new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.

Save the nature. Don't print this!


I provide textual exports for every blog entry. However let's save the nature together. The nature is everything around us. Every being should be respected. Save the nature - don't print too much.


Die Umgehung dieser Ausdrucksperre ist nach § 95a UrhG verboten!
Inhaltlich Verantwortlicher gemäß § 10 Absatz 3 MDStV: Marius Ciepluch - Anschrift via eMail. Die eMail Adresse entnehmen sie dem Impresseum dieser englischsprachigen Seite.
Aus Datenschutzgründen habe ich weder offiziellen noch behördlichen Schriftverkehr via eMail. Dazu ist die postalische, beim Dienstleister hinterlegte, Anschrift zu verwenden.

Datenerfassung

Es werden keine personenbezogenen Daten erfasst. Logdaten werden anonymisiert.