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

cern-pss.txt

cern-pss.txt
Posted Feb 4, 2000
Authored by Scrippie

CERN 3.0A Heap overflow advisory - There is a heap overflow that wastes memory space in the CERN/3.0A webserver. Close to 50000 bytes of the heap will be ruined! DoS example included.

tags | exploit, overflow
SHA-256 | 489fc3d42f1e7f2c642902f70308d9caefba877586655086add9c34454afe5b3

cern-pss.txt

Change Mirror Download
         #$%$#$%$#$%$#$%$#$%$#$%$#$%$#$%$#$%$#$%$#
$% CERN 3.0A Heap overflow advisory %$
#$%$#$%$#$%$#$%$#$%$#$%$#$%$#$%$#$%$#$%$#
$% By Scrippie %$
#$ Phreak.nl $#
$%$#$%$#$%$#$%$#$%$#$%$#$%$#$%$#$%$#$%$#$
#$ Love To: Maja, Dopey, Hester $#
$%$#$%$#$%$#$%$#$%$#$%$#$%$#$%$#$%$#$%$#$

there is a heap overflow that wastes memory space in the CERN/3.0A webserver.
Offending source code file is: Daemon/Implememtation/HTScript.c
Offending function is: PUBLIC int HTCallScript ARGS1(HTRequest *, req)
Offending Code snippet:

else { /* Try replacing unknown suffix with .pp */
char *test = (char*)malloc(strlen(HTReqScript) + 4);
char *s;
CTRACE(stderr, "Trying...... to find executable by appending .pp\n");
strcpy(test, HTReqScript);
s = strrchr(test, '.');
strcat(test, ".pp"); /* Try appending .pp */
CTRACE(stderr, "Trying...... \"%s\"\n", test);
if (-1==access(test, X_OK)) { /* Then try replacing suffix with .pp */
if (s) {
*s = 0;
strcat(s, ".pp");
CTRACE(stderr, "Bad luck.... now trying \"%s\"\n", test);
if (-1==access(test, X_OK)) { /* INVALID */
if (!(msg = (char*)malloc(3*strlen(test) + 100)))
outofmem(__FILE__, "HTCallScript");

sprintf(msg,
"Bad script request -- none of '%s' and '%s.pp' is executable",
HTReqScript, test );
free(test);

So we see that test is malloced to hold HTReqScript + ".pp\0" after which
HTReqScript is copied to test, the dot is located and .pp is appended.
We note that strcat() does not just append ".pp" to the string, but rather
".pp\0".
Now, if the HTReqScript did contain a suffix CERN will go and use the char
pointer s to overwrite the suffix of HtReqScript.
If the HtRequest with the new ".pp" suffix cannot be found we print an error
message.
It seems CERN allocates 3*strlen(test) + 100 bytes for our error string...
Probabely some 100 for our static string and the rest for HtReqScript and test.
Sadly, the strcat on test will have limited the lenght of the test string, but
NOT of HtReqScript, so making sure we have a lot of characters after our
seperating dot overflows the heap.
Consider a HtReqScript of 1 A a dot and 50000 A's - now we get something like:

HtReqScript - somewhere around 50000 bytes (50003)
Test - the same as HtReqScript + 4 (50007)

After putting ".pp\0" into place however in our test array we get:

strlen(test) - 1 A, 1 dot, pp - hmmm, 3 bytes

Now our msg will be:

3*3+100=109 - by far enough to hold test, but by far NOT enough to hold
HtReqScript. Close to 50000 bytes of the heap will be ruined!
It's unlikely that this flaw is exploitable, since there is nothing on the
heap after the malloced msg, but I'd sure like to hear any ideas.

/* Scrip kids DoS attack section */

iLikeDossing# lynx http://www.lart.org/cgi-bin/A.`perl -e 'print"A" x 50000'`

Repeat several times and see memory usage jump to remarkable heights :)

/* End of script kiddies section */

A lot of thanks go to dvorak for pointing out to me that most webservers
seem to suffer some sort of flaw in their script parsing routines and for
telling me to take a look at HTScript.c

A quick patch:

--- HTScript.back Wed Jan 26 22:18:44 2000
+++ HTScript.c Wed Jan 26 22:19:52 2000
@@ -894,7 +894,7 @@
strcat(s, ".pp");
CTRACE(stderr, "Bad luck.... now trying \"%s\"\n", test);
if (-1==access(test, X_OK)) { /* INVALID */
- if (!(msg = (char*)malloc(3*strlen(test) + 100)))
+ if (!(msg = (char*)malloc(strlen(HTReqScript)+strlen(test) + 100)))
outofmem(__FILE__, "HTCallScript");

sprintf(msg,

(Isn't a unified diff a beautifull thing :-)

A big hooray to: #phreak.nl
A lots of love to: Dopey, Maja, Hester
Thanks to: dvorak

Cheers,

Scrippie - ronald@grafix.nl
Login or Register to add favorites

File Archive:

July 2024

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