SecChrome is a security-hardened launcher for Chrome or Chromium on Linux. It acts as a wrapper that leverages powerful Linux kernel features—seccomp and ptrace—to confine the browser process, limiting the impact of potential vulnerabilities.
Web browsers are complex applications and a primary target for exploitation. While browser vendors implement their own sandboxing, SecChrome provides an additional, configurable layer of defense. It enforces system call-level access control policies, ensuring that even if a vulnerability is exploited within the browser, the attacker's ability to harm the underlying system is severely restricted.
The core principle is to enforce a "least privilege" environment. The browser is only given the permissions it absolutely needs to function, and high-risk actions like arbitrary code execution, file system access, or network connections are blocked by default.
- Dual Sandboxing Engines: Choose between two powerful sandboxing technologies:
- Seccomp-notify: A high-performance kernel feature that filters syscalls with minimal overhead (typically <10%). Ideal for production environments.
- Ptrace: A classic process tracing mechanism that requires no special privileges and offers deep inspection of syscall arguments. Ideal for development, debugging, or restricted container environments.
- Adaptive Mode Selection: Automatically chooses the best engine based on available kernel features and permissions, but can also be configured manually.
- Fine-Grained Access Control: Enforce strict rules for:
- File System Access: Control which files and directories the browser can read from or write to.
- Program Execution: Prevent the browser from executing unauthorized programs.
- System Call Filtering: Configure allow/deny rules for specific system calls to harden the sandbox at the kernel level.
- Out-of-the-Box Policies: Comes with a default security policy that is strict enough to block common attack vectors while still allowing normal browsing functions.
- Configurable and Extensible: All policies are defined in a simple
config.yamlfile, making it easy to customize the sandbox for your specific needs. - Detailed Auditing: In
ptracemode, every syscall can be logged, providing full visibility into the browser's behavior for security audits and threat analysis.
Ensure you have the following dependencies installed:
gccmakecmakelibseccomp-dev(or equivalent for your distribution)
An installation script is provided for convenience:
./install_dependencies.shOnce the dependencies are installed, build the project:
mkdir -p build && cd build && cmake .. && makeThe launcher binary will be created at build/secure_chrome_launcher.
Note: You should setup config at config.yaml before running the application.
- Copy the example configuration:
cp config.example.yaml config.yaml - Edit
config.yaml:- Set
chrome_binaryto the path of your Chrome/Chromium executable. - Choose the security mode (
seccomp_notifyorptrace_enabled). - Customize the
file,exec, andwritelists under therulessection to match your requirements.
- Set
SecChrome supports two main types of rules: Path-Based Access Rules and Syscall Rules, allowing for layered, fine-grained control.
These rules govern access to the filesystem and program execution. They operate on a whitelist (default-deny) basis: access is denied unless a rule explicitly allows it.
Format:
[action],[type],[path]
- action:
allowordeny(optional, defaults toallow). - type: The matching strategy
exact: Matches the path exactly.prefix: Matches everything under the specified directory.suffix: Matches files with the specified extension.prefix_suffix: Matches files with a specific extension under a directory.
- path: The file path or pattern.
Examples:
allow,exact,/bin/ls: Explicit exact allow.allow,prefix,/var/log: Recursively allow access to/var/log.allow,prefix_suffix,/lib/*.so: allow access to/lib/*.so.allow,suffix,.log: Allow any file ending in.log.
Note:
Avoid broadly whitelisting your home directory (e.g. allow,prefix,/home/...) unless you fully understand the security impact.
Prefer forcing Chrome profile/cache into a dedicated directory (e.g. --user-data-dir=/tmp/chrome-profile) and whitelisting only that directory.
For the exec list, you will need to add the paths to your chrome executables. For example:
allow,exact,/path/to/chrome/chromeallow,exact,/path/to/chrome/chrome-sandboxallow,exact,/path/to/chrome/chrome_crashpad_handler
These rules provide low-level control over the system calls a process can make. They operate on a blacklist (default-allow) basis: all syscalls are permitted unless a rule explicitly denies them. This is necessary for compatibility with complex applications like Chrome.
Format:
[action],[syscall_name]
- action:
allowordeny. - syscall_name: The name of the system call (e.g.,
clone,socket,setuid).
Behavior:
- A default blocklist of high-risk syscalls (e.g.,
ptrace,mount) is enforced. denyrules add to this blocklist.allowrules can be used to override a default block, re-enabling a specific syscall.
Note: Syscalls related to file access (open, openat) and program execution (execve, execveat) are reserved and cannot be configured here; they are managed by the Path-Based Access Rules.
Examples:
deny,socket: Blocks thesocketsyscall, preventing all network connections.allow,ptrace: Overrides the default block on theptracesyscall.
To start the sandboxed browser, run the secure_chrome_launcher executable from the build directory.
The launcher accepts several command-line arguments:
--config=<path>: Specify the path to theconfig.yamlfile. If not provided, it defaults toconfig.yamlin the current directory.[chrome flags]: Any arguments provided before a--separator are passed directly to the Chrome executable.-- [chrome flags]: Any arguments provided after a--separator are also passed directly to the Chrome executable.
Basic Usage:
./build/secure_chrome_launcher -headless --dump-dom https://example.comSpecifying a config file
./build/secure_chrome_launcher --config=my_config.yaml -headless --dump-dom https://example.comFor detailed documentation, please refer to:
- Docker Deployment Guide: Step-by-step guide for building and running SEChrome in Docker containers
- Solution Documentation: Comprehensive technical documentation covering architecture, configuration, troubleshooting, and best practices
Contributions are welcome! Please feel free to open an issue or submit a pull request.
This project is licensed under the MIT License.