DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Browser Sandboxing: Always Wear Your Seatbelt!

When it comes to browser security, always wear your seatbelt!

Christopher Lamb user avatar by
Christopher Lamb
CORE ·
Jan. 10, 19 · Analysis
Like (2)
Save
Tweet
Share
4.57K Views

Join the DZone community and get the full member experience.

Join For Free

To understand how modern browsers are sandboxed, we need to understand, first, how modern sandboxes work. There's a variety of them available, from chroot to the SELinux sandbox to the app sandbox on Apple products. We're looking at the app sandbox, and in order to understand how it really works, we're going to start with it's predecessor — Seatbelt.

Seatbelt was originally the codename for this sandboxing technology out of Apple. Like many catchy codenames, it stuck, and it ended up being the product name. Now, when first released, it wasn't really available to the developer community, but it was the basis for sandboxing important system software. Like Safari, it ends up.

Seatbelt was originally based on the TrustedBSD mandatory access control (MAC) framework. Which makes sense, as BSD provides the UNIX compatibility layer via Darwin in *OS. Seatbelt is more configurable than TrustedBSD's mandatory access control though. After all, MAC systems aren't built to provide user-level control over system objects. They require administrators to define policies for an entire system, as opposed to discretionary access control (DAC) systems, which allow users to determine protections. Now, seatbelt does expose this MAC framework to users, but it does so differently than DAC systems do.

DAC systems allow users to arbitrarily change object access rules. For example, you can arbitrarily change the permissions associated with a file you own on just about any computer system — this is an example of discretionary control.

MAC systems don't give you this kind of flexibility. Basically, you get the access you get, and you just have to live with it.

Seatbelt is different. You configure policies over the program, then execute the program governed by that group of policies. You can change policies on the program prior to invocation, but not after. But how does it do this?

Seatbelt uses four different components to do its thing. It has a dynamic library you can use to initialize and configure a process sandbox. This library,  libsandbox.1.dylib, exports a group of functions you can use to control a sandbox (but not, interestingly,  sandbox_init()). It also uses a mach server that deals with logging from the kernel in relation to a sandboxed programs and sandboxes. Finally, it uses two kernel extensions too — one that uses the TrustedBSD interfaces for policy enforcement, and another that provides regex matching for defined policies.

When operating, the  sandbox_init() call will take policies defined in TinyScheme into binary encodings used by the kernel. This binarized data is then passed into  mac_syscall() TrustedBSD system call, which then passes the request to the Sandbox.kext kernel extension. The  Sandbox.kext extension applies the policies.

At this point, sensitive, hooked calls are directed through the  Sandbox.kext subsystem, which then enforces defined policies on that process. Information on the state of the sandboxed process is then passed back to userspace via the mach logging server.

Next, we're going to dive into the details of the userspace configuration calls and how they work.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • The Future of Cloud Engineering Evolves
  • Using the PostgreSQL Pager With MariaDB Xpand
  • Spring Cloud: How To Deal With Microservice Configuration (Part 1)
  • Kotlin Is More Fun Than Java And This Is a Big Deal

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: