Unified Selenium Grid/Selenoid RCE with Firefox + Chrome auto-detection#21003
Open
Chocapikk wants to merge 3 commits intorapid7:masterfrom
Open
Unified Selenium Grid/Selenoid RCE with Firefox + Chrome auto-detection#21003Chocapikk wants to merge 3 commits intorapid7:masterfrom
Chocapikk wants to merge 3 commits intorapid7:masterfrom
Conversation
…etection Replace separate Chrome and Firefox modules with a single module that auto-detects available browsers and picks the best attack vector. Firefox profile handler preferred (unpatched on all Grid versions). Remove incorrect CSRF framing, sudo wrapper, add FileDropper and Selenoid support.
Contributor
Author
|
cc @Takahiro-Yoko - this unifies your Chrome and Firefox modules into a single module with auto-detection. Your original work is credited in the authors list and both old module paths are preserved via |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hello Metasploit Team,
This PR replaces the two existing SeleniumGreed modules (
selenium_greed_chrome_rce_cve_2022_28108andselenium_greed_firefox_rce_cve_2022_28108) with a single unified module that auto-detects available browsers and picks the best attack vector.Summary
Why a unified module? Both old modules target the same misconfiguration (unauthenticated WebDriver API) with different browser-specific payloads. There's no reason to maintain two separate modules for what is fundamentally the same exploit flow: enumerate browsers, create a session, execute code. The new module queries
/status, identifies the backend (Grid vs Selenoid), enumerates available browsers, and auto-selects the best vector.The CSRF framing was wrong. The original modules referenced CVE-2022-28108 (CSRF via non-JSON content types), but both modules sent
application/jsonrequests directly to the target. No CSRF involved, no victim browser needed. The actual attack is unauthenticated API abuse (CWE-306), which is what this module now correctly references.The bash/sudo wrapper is gone. The old Firefox module wrapped the payload in a shell script that checked for passwordless sudo and piped through
sudo su root -c /bin/bash. This is unreliable (assumes sudo exists and is passwordless) and unnecessary. The module now deliverspayload.encodeddirectly via the data URI handler. Users who land asselusercan privesc themselves - the default Docker images ship with passwordless sudo, but that's post-exploitation, not the module's job. This makes the exploit more reliable across different environments.Key changes:
selenium_greed_rce.rbwithmoved_fromaliases for both old module paths so existing references keep workingauto/firefox/chrome) - Firefox preferred since it works on all Grid versions (never patched), Chrome binary override as fallback for Grid < 4.11.0 and all Selenoid versionsFileDropperfor proper cleanup of FETCH payload artifactsFETCH_WRITABLE_DIRdefaults to/tmp- the Firefox handler's cwd is/(not writable byseluser), so the FETCH payload needs a writable dirFirefox profile handler - unpatched since 2021
The Firefox technique injects a custom profile with a
handlers.jsonmappingapplication/shto/bin/sh, then navigates to adata:application/shURI to trigger execution. This was reported in SeleniumHQ/selenium#9526 in May 2021. The Selenium team responded with documentation improvements and optional basic auth. The actual handler injection was never fixed and works on all Grid versions including the latest (4.40.0 at time of writing).Targets
python/meterpreter/reverse_tcpvia Chrome binary overridecmd/linux/http/x64/meterpreter/reverse_tcpvia fetch payload (both Chrome and Firefox)Vulnerable versions
Verification
Firefox (auto-detected) - selenium/standalone-firefox:4.40.0 on Ubuntu 24.04
Chrome (auto-detected) - selenium/standalone-chrome:4.10.0 on Ubuntu 24.04
Selenoid 1.11.3 - selenoid/chrome:128.0 on Ubuntu 24.04