Skip to content

fix(security): validate URL scheme and block SSRF in browser_navigate - #2695

Closed
dieutx wants to merge 2 commits into
NousResearch:mainfrom
dieutx:fix/browser-url-scheme-validation
Closed

fix(security): validate URL scheme and block SSRF in browser_navigate#2695
dieutx wants to merge 2 commits into
NousResearch:mainfrom
dieutx:fix/browser-url-scheme-validation

Conversation

@dieutx

@dieutx dieutx commented Mar 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • browser_navigate() passes URLs directly to the browser subprocess with no scheme validation
  • file://, javascript:, data: URLs can be used to read local files or execute code in the browser context
  • Private network addresses are also reachable via the browser (SSRF)
  • Fix: restrict to http/https schemes and add SSRF check via the existing url_safety.is_safe_url() module

Security Impact

  • file:///etc/shadow or file:///root/.hermes/.env could read local files via browser rendering
  • javascript: could execute code in the browser context
  • http://169.254.169.254/ could reach cloud metadata endpoints
  • Affects gateway users (Telegram/Discord) where prompt injection can control the URL
  • Severity: HIGH

How to reproduce

Before fix, these URLs pass without any validation:

browser_navigate("file:///etc/shadow")
browser_navigate("javascript:alert(document.cookie)")
browser_navigate("data:text/html,<script>...</script>")

How to test

  • 6 new tests: file:// blocked, javascript: blocked, data: blocked, ftp: blocked, http allowed, https allowed
  • All tests pass

Platform tested

  • Linux

dieutx added 2 commits March 24, 2026 06:52
browser_navigate passes URLs directly to the browser subprocess with
no scheme validation. file://, javascript:, and data: URLs can be used
to read local files or execute code in the browser context. Private
network addresses (localhost, metadata endpoints) are also reachable.

Restrict to http/https schemes and add SSRF check via url_safety
before the browser command is dispatched.
Move url_safety import to module level as _is_browser_url_safe so
tests can mock it. Update test_browser_navigate_returns_policy_block
to bypass SSRF check so the website policy path is tested correctly.
@dieutx

dieutx commented Mar 26, 2026

Copy link
Copy Markdown
Contributor Author

Closing — this was addressed in #3058 which is already merged.

@dieutx dieutx closed this Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant