Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/documentation/modules/exploit/multi/http/churchinfo_upload_exec.md
Views: 11784
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.
wget https://master.dl.sourceforge.net/project/churchinfo/churchinfo/1.3.0/churchinfo-1.3.0.tar.gz
tar -xvf churchinfo-1.3.0.tar.gz
sudo docker run -i -t -p "9090:80" -v ${PWD}/churchinfo:/app mattrayner/lamp:0.8.0-1804-php7
.sudo docker ps -a
and find the container ID that was created and which is now running.sudo docker exec -it *container ID* /bin/bash
Inside the new prompt:
mysqladmin -u root -p create churchinfo
and press the ENTER key when prompted for the password.cd /app/churchinfo/SQL
mysql -u root -p churchinfo < Install.sql
and press the ENTER key when prompted for the password.apt-get install nano
if you want to use Nano.nano /app/churchinfo/Include/Config.php
.Set the
$sUSER
variable to'root'
.Set the
$sPASSWORD
variable to''
.Set the
$sRootPath
variable to'/churchinfo'
. This should be default though.Set the
$URL[0]
tohttp://localhost/churchinfo/Default.php
.Exit out of
nano
and run/etc/init.d/apache2 restart
Log in at
http://127.0.0.1:9090/churchinfo/Default.php
with the usernameAdmin
and passwordchurchinfoadmin
.This should cause the app to redirect to a password change form.
Specify the old password, aka
churchinfoadmin
and then specify the new password twice and submit the form.Go to
http://127.0.0.1:9090/churchinfo/PersonEditor.php
and fill out the form with as much detail as possible.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.
Start
msfconsole
use exploit/multi/http/churchinfo_upload_exec
Set the target
RHOST
,APPBASE
,USERNAME
, andPASSWORD
values.Optional: Set the target
RPORT
if the ChurchInfo server is running on a different port than port 80.Optional:
set SSL true
if the target is using SSL for ChurchInfo.Select the payload of choice or leave default.
Set the
LHOST
to your system.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:
This will enable additional information and details about the exploit as it is launched.