home *** CD-ROM | disk | FTP | other *** search
/ Power Hacker 2003 / Power_Hacker_2003.iso / Exploit and vulnerability / w00w00 / patches / linux-2.4.18-resetopen.patch < prev    next >
Encoding:
Text File  |  2002-04-12  |  4.0 KB  |  125 lines

  1. This patch is for Linux 2.4.18.  It hacks in a sysctl'able option to
  2. send a SYN/ACK back during a reset (IPV4 only).  This should irritate
  3. those who scan for open ports.  This breaks RFC, so your mileage may
  4. vary. A special hello to all things w00w00. - 4/11/2002
  5.  
  6. usage: patch -p0 < linux-2.4.18-resetopen.patch
  7.  
  8. - dmess0r a.k.a. Evan Brewer <dm@eleet.st> -
  9.  
  10. diff -urN linux-2.4.18.orig/Documentation/Configure.help linux/Documentation/Configure.help
  11. --- linux-2.4.18.orig/Documentation/Configure.help    Mon Feb 25 11:37:51 2002
  12. +++ linux/Documentation/Configure.help    Sat Mar 23 02:46:09 2002
  13. @@ -24382,6 +24382,13 @@
  14.    information:  http://www.candelatech.com/~greear/vlan.html  If unsure,
  15.    you can safely say 'N'.
  16.  
  17. +All TCP ports appear open
  18. +CONFIG_NET_IPV4_SEND_RESET_OPEN
  19. +  This option will enable the sending of SYN/ACK bits as part of the
  20. +  TCP reset response to sending a SYN to a closed port.  Effectively, this
  21. +  option will confuse port scanners into thinking all ports scanned,
  22. +  (regardless of their actual state) are open.  IPV4 only at the moment.
  23. +
  24.  #
  25.  # A couple of things I keep forgetting:
  26.  #   capitalize: AppleTalk, Ethernet, DOS, DMA, FAT, FTP, Internet,
  27. diff -urN linux-2.4.18.orig/arch/i386/config.in linux/arch/i386/config.in
  28. --- linux-2.4.18.orig/arch/i386/config.in    Mon Feb 25 11:37:52 2002
  29. +++ linux/arch/i386/config.in    Sat Mar 23 02:15:23 2002
  30. @@ -425,3 +425,6 @@
  31.  fi
  32.  
  33.  endmenu
  34. +
  35. +# dmess0r
  36. +source security/Config.in
  37. diff -urN linux-2.4.18.orig/include/linux/sysctl.h linux/include/linux/sysctl.h
  38. --- linux-2.4.18.orig/include/linux/sysctl.h    Fri Mar 15 23:29:46 2002
  39. +++ linux/include/linux/sysctl.h    Sat Mar 23 01:40:17 2002
  40. @@ -289,7 +289,12 @@
  41.      NET_TCP_ADV_WIN_SCALE=87,
  42.      NET_IPV4_NONLOCAL_BIND=88,
  43.      NET_IPV4_ICMP_RATELIMIT=89,
  44. +#ifdef    CONFIG_NET_IPV4_SEND_RESET_OPEN
  45. +    NET_IPV4_ICMP_RATEMASK=90,
  46. +    NET_IPV4_SEND_RESET_OPEN=91    /* dmess0r */
  47. +#else
  48.      NET_IPV4_ICMP_RATEMASK=90
  49. +#endif
  50.  };
  51.  
  52.  enum {
  53. diff -urN linux-2.4.18.orig/net/ipv4/sysctl_net_ipv4.c linux/net/ipv4/sysctl_net_ipv4.c
  54. --- linux-2.4.18.orig/net/ipv4/sysctl_net_ipv4.c    Tue Oct 30 15:08:12 2001
  55. +++ linux/net/ipv4/sysctl_net_ipv4.c    Sat Mar 23 01:45:24 2002
  56. @@ -45,6 +45,11 @@
  57.  extern int inet_peer_gc_mintime;
  58.  extern int inet_peer_gc_maxtime;
  59.  
  60. +#ifdef    CONFIG_NET_IPV4_SEND_RESET_OPEN
  61. +/* From tcp_input.c, dmess0r */
  62. +extern int sysctl_tcp_v4_send_reset_open;
  63. +#endif
  64. +
  65.  #ifdef CONFIG_SYSCTL
  66.  static int tcp_retr1_max = 255; 
  67.  static int ip_local_port_range_min[] = { 1, 1 };
  68. @@ -219,6 +224,12 @@
  69.       &sysctl_icmp_ratelimit, sizeof(int), 0644, NULL, &proc_dointvec},
  70.      {NET_IPV4_ICMP_RATEMASK, "icmp_ratemask",
  71.       &sysctl_icmp_ratemask, sizeof(int), 0644, NULL, &proc_dointvec},
  72. +#ifdef    CONFIG_NET_IPV4_SEND_RESET_OPEN
  73. +    /* dmess0r */
  74. +    {NET_IPV4_SEND_RESET_OPEN, "tcp_v4_send_reset_open",
  75. +     &sysctl_tcp_v4_send_reset_open, sizeof(int), 0640, NULL,
  76. +     &proc_dointvec},
  77. +#endif
  78.      {0}
  79.  };
  80.  
  81. diff -urN linux-2.4.18.orig/net/ipv4/tcp_ipv4.c linux/net/ipv4/tcp_ipv4.c
  82. --- linux-2.4.18.orig/net/ipv4/tcp_ipv4.c    Mon Feb 25 11:38:14 2002
  83. +++ linux/net/ipv4/tcp_ipv4.c    Sat Mar 23 01:47:12 2002
  84. @@ -65,6 +65,8 @@
  85.  
  86.  extern int sysctl_ip_dynaddr;
  87.  
  88. +int sysctl_tcp_v4_send_reset_open;
  89. +
  90.  /* Check TCP sequence numbers in ICMP packets. */
  91.  #define ICMP_MIN_LENGTH 8
  92.  
  93. @@ -1059,6 +1061,17 @@
  94.          rth.ack = 1;
  95.          rth.ack_seq = htonl(ntohl(th->seq) + th->syn + th->fin
  96.                      + skb->len - (th->doff<<2));
  97. +#ifdef    CONFIG_NET_IPV4_SEND_RESET_OPEN
  98. +        /* sysctl'able assailant irritation, dmess0r */
  99. +        if(sysctl_tcp_v4_send_reset_open) {
  100. +            rth.ack = 1;
  101. +            rth.rst = 0;
  102. +            rth.syn = 1;
  103. +
  104. +            if(th->fin)
  105. +                rth.fin = 1;
  106. +        }
  107. +#endif
  108.      }
  109.  
  110.      memset(&arg, 0, sizeof arg); 
  111. diff -urN linux-2.4.18.orig/security/Config.in linux/security/Config.in
  112. --- linux-2.4.18.orig/security/Config.in    Wed Dec 31 16:00:00 1969
  113. +++ linux/security/Config.in    Sat Mar 23 02:38:52 2002
  114. @@ -0,0 +1,10 @@
  115. +#
  116. +# Security configuration, dmess0r
  117. +#
  118. +mainmenu_option next_comment
  119. +comment 'Security'
  120. +
  121. +if [ "$CONFIG_SYSCTL" != "n" ]; then
  122. +   bool '  All TCP ports appear open' CONFIG_NET_IPV4_SEND_RESET_OPEN
  123. +fi
  124. +endmenu
  125.