fix(cdp): gate file:// navigation behind --allow-file-access
GHSA-q55h-vfv9-qcr5. Any process able to reach the CDP port could
send Page.navigate {"url":"file:///etc/shadow"} and read arbitrary
local files (the process's UID's worth of read access). When obscura
runs as root inside Docker or as a systemd service that translates
straight into /etc/shadow, /root/.ssh/id_rsa, /proc/1/environ, etc.
Validate at the CDP boundary, not in obscura-net, so direct CLI
callers ("obscura fetch file://...") keep working. A new
BrowserContext.allow_file_access flag defaults to false; Page.navigate
returns an error when the requested URL is file:// and the flag is
off. CdpContext::new_with_security threads the flag from the server
entry point, and "obscura serve --allow-file-access" opts in for
local-HTML testing workflows.
Tested:
- Default obscura serve: CDP Page.navigate {file:///etc/passwd} ->
refused with descriptive error.
- obscura serve --allow-file-access: same call succeeds.
- obscura fetch file://... CLI path: unchanged, still reads the file.
- All earlier PoCs (GHSA-6pj9 JS->file SOP, GHSA-4789 sub-resource
SSRF, GHSA-4789 CSS template injection) still pass.
- cargo test --workspace clean.
This commit is contained in:
1 parent
ac0efd1798
commit
18dc796df0
6 files changed
+75
-7
No files matched your search
@@ -11,6 +11,14 @@ pub struct BrowserContext {
|
||||
pub robots_cache: Arc<RobotsCache>,
|
||||
pub obey_robots: bool,
|
||||
pub stealth: bool,
|
||||
/// When true, CDP-driven navigation to file:// URLs is permitted.
|
||||
/// Default is false: a remote CDP client cannot point the browser
|
||||
/// at /etc/shadow even if Obscura is running as a privileged user.
|
||||
/// Flip on via `obscura serve --allow-file-access` for legitimate
|
||||
/// local-HTML testing workflows. The CLI's own `obscura fetch
|
||||
/// file://...` path is unaffected because it does not go through
|
||||
/// the CDP server.
|
||||
pub allow_file_access: bool,
|
||||
}
|
||||
|
||||
impl BrowserContext {
|
||||
@@ -26,6 +34,7 @@ impl BrowserContext {
|
||||
robots_cache: Arc::new(RobotsCache::new()),
|
||||
obey_robots: false,
|
||||
stealth: false,
|
||||
allow_file_access: false,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,6 +75,7 @@ impl BrowserContext {
|
||||
robots_cache: Arc::new(RobotsCache::new()),
|
||||
obey_robots: false,
|
||||
stealth,
|
||||
allow_file_access: false,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user