Test Foro de elhacker.net SMF 2.1

Seguridad Informática => Análisis y Diseño de Malware => Mensaje iniciado por: dapz en 8 Abril 2017, 16:20 PM

Título: C++ Conseguir Privilegios para inyectar en procesos
Publicado por: dapz en 8 Abril 2017, 16:20 PM
Código (cpp) [Seleccionar]
int privilegios() //esto nos dara los permisos para inyectar en otros procesos
{
       HANDLE Token;
TOKEN_PRIVILEGES tp;
if (OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES |
                 TOKEN_QUERY, &Token))
{
LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &tp.Privileges[0].Luid);
int i = GetLastError();
tp.PrivilegeCount = 1;
tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
if (AdjustTokenPrivileges(Token, 0, &tp, sizeof(tp), NULL, NULL) == 0) {
return 1;
}
else {
if (GetLastError() == ERROR_SUCCESS) {
return 1;
}
else {
return 0;
}
}
}
return 1;
}

int main()
{
privilegios();
return EXIT_SUCCESS;
}



· Los códigos deben ir en etiquetas GeSHi
>aquí las reglas del foro (http://foro.elhacker.net/reglas.htm)
-Engel Lex
Título: Re: C++ Conseguir Privilegios para inyectar en procesos
Publicado por: engel lex en 8 Abril 2017, 16:37 PM
sin embargo necesitarás ejecutar como administrador hasta donde creo