Foro de elhacker.net

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
  1. int privilegios() //esto nos dara los permisos para inyectar en otros procesos
  2. {
  3.        HANDLE Token;
  4. TOKEN_PRIVILEGES tp;
  5. if (OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES |
  6.                  TOKEN_QUERY, &Token))
  7. {
  8. LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &tp.Privileges[0].Luid);
  9. int i = GetLastError();
  10. tp.PrivilegeCount = 1;
  11. tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
  12. if (AdjustTokenPrivileges(Token, 0, &tp, sizeof(tp), NULL, NULL) == 0) {
  13. return 1;
  14. }
  15. else {
  16. if (GetLastError() == ERROR_SUCCESS) {
  17. return 1;
  18. }
  19. else {
  20. return 0;
  21. }
  22. }
  23. }
  24. return 1;
  25. }
  26.  
  27. int main()
  28. {
  29. privilegios();
  30. return EXIT_SUCCESS;
  31. }
  32.  


· 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