Advanced Topic 42 of 51 Security & Cryptography
Sandboxing
Confining code to limit what it can affect.
How it works
Sandboxing runs code in a restricted environment that limits what it can access, so that compromise or bugs cannot easily harm the rest of the system. Techniques include operating-system mechanisms such as seccomp filters, namespaces, AppArmor and macOS App Sandbox, containers, virtual machines, language-level isolation such as WebAssembly and browser process sandboxes, and capability-based designs. A broker process may mediate any needed access.
Step-by-step walkthrough
- Untrusted code runs inside a restricted environment.
- It cannot read arbitrary files or open sockets.
- System calls are filtered.
- The host stays protected if the code is malicious.
- Browsers, containers and seccomp all use this idea.
Where it is used
Web browsers isolate each site and renderer, mobile operating systems confine apps, malware analysts detonate samples in sandboxes, and cloud platforms run untrusted functions and plug-ins this way.
Common pitfall
A sandbox is only as strong as its smallest hole: kernel bugs and misconfiguration allow escapes. Too-permissive policies defeat the purpose, and too-strict ones break functionality. Shared resources and side channels can still leak. Use defense in depth, minimal permissions and regularly updated runtimes.
Where it fits in the course
Sandboxing is topic 42 of 51 in Security & Cryptography, rated Advanced. It follows ASLR and Stack Canaries. The next topic is Trusted Execution Environments.
Practice and explore
- Open the interactive lesson, with a mini quiz.
- Take the Security & Cryptography quiz.
How to study this topic
- Read the explanation above and restate the definition in your own words.
- Open the interactive lesson and answer its mini quiz.
- Read the common pitfall, then write a short example that avoids it.
- Check your understanding in the Security & Cryptography quiz, and revisit the topic if you miss a question.
Frequently asked questions
What is Sandboxing?
Where do people use Sandboxing?
What is the most common mistake with Sandboxing?
What should I learn before this topic?
How can I practice it?
Is Sandboxing hard to learn?
How long does it take to learn Sandboxing?
Which topics are related to Sandboxing?
What should I study after Sandboxing?
Related topics
- ASLR and Stack Canaries (Security & Cryptography)
- Trusted Execution Environments (Security & Cryptography)
- Return-Oriented Programming (Security & Cryptography)
- Reverse Engineering (Security & Cryptography)