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

1333htpasswd.txt

1333htpasswd.txt
Posted Oct 29, 2004
Authored by Larry W. Cashdollar | Site vapid.ath.cx

It appears that the new Apache release 1.3.33 still is susceptible to a local buffer overflow discovered in htpasswd under release 1.3.31.

tags | advisory, overflow, local
SHA-256 | e6a9149037f4b1d66672b62767ea68f40b7ee59f1984ddb9aa2e324192efe4ef

1333htpasswd.txt

Change Mirror Download
This was posted on the full-disclosure list sept 16 2004 by
Luiz Fernando.

http://archives.neohapsis.com/archives/fulldisclosure/2004-09/0547.html

The nessus check for this vulnerability recommends upgrading to
Apache version 1.3.32:

http://cgi.nessus.org/plugins/dump.php3?id=14771

But in Apache 1.3.33:

lachoy# grep strcpy /install/src/apache_1.3.33/src/support/htpasswd.c
strcpy(record, user);
strcpy(pwfilename, argv[i]);
strcpy(user, argv[i + 1]);
strcpy(password, argv[i + 2]);
strcpy(scratch, line);

It is still vulnerable.

I patched my version that seemed to thwart the exploit offered by
Luiz. Here is the diff:

root@bokchoy:~/tes/apache_1.3.33/src/support# diff -uN htpasswd.orig.c
htpasswd.c
--- htpasswd.orig.c 2004-10-28 18:20:13.000000000 -0400
+++ htpasswd.c 2004-10-28 18:17:25.000000000 -0400
@@ -202,9 +202,9 @@
ap_cpystrn(record, "resultant record too long", (rlen - 1));
return ERR_OVERFLOW;
}
- strcpy(record, user);
+ strncpy(record, user,MAX_STRING_LEN - 1);
strcat(record, ":");
- strcat(record, cpw);
+ strncat(record, cpw,MAX_STRING_LEN - 1);
return 0;
}

@@ -410,14 +410,14 @@
fprintf(stderr, "%s: filename too long\n", argv[0]);
return ERR_OVERFLOW;
}
- strcpy(pwfilename, argv[i]);
+ strncpy(pwfilename, argv[i], MAX_STRING_LEN-1);
if (strlen(argv[i + 1]) > (sizeof(user) - 1)) {
fprintf(stderr, "%s: username too long (>%lu)\n", argv[0],
(unsigned long)(sizeof(user) - 1));
return ERR_OVERFLOW;
}
}
- strcpy(user, argv[i + 1]);
+ strncpy(user, argv[i + 1],MAX_STRING_LEN-1);
if ((arg = strchr(user, ':')) != NULL) {
fprintf(stderr, "%s: username contains illegal character
'%c'\n",
argv[0], *arg);
@@ -429,7 +429,7 @@
(unsigned long)(sizeof(password) - 1));
return ERR_OVERFLOW;
}
- strcpy(password, argv[i + 2]);
+ strncpy(password, argv[i + 2],MAX_STRING_LEN - 1 );
}

#ifdef WIN32
@@ -553,7 +553,7 @@
putline(ftemp, line);
continue;
}
- strcpy(scratch, line);
+ strncpy(scratch, line,MAX_STRING_LEN -1);
/*
* See if this is our user.
*/


Larry W. Cashdollar
http://vapid.ath.cx
Login or Register to add favorites

File Archive:

September 2024

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close