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

85mod_include.adv.txt

85mod_include.adv.txt
Posted Oct 26, 2004
Authored by Crazy Einstein

The mod_include module in Apache 1.3.31 is susceptible to a buffer overflow that allows for arbitrary code execution.

tags | advisory, overflow, arbitrary, code execution
SHA-256 | 055d7f5955acdb2a54ae5d8fe0303663f38e57ee7640eff8edfe63a8e6520ded

85mod_include.adv.txt

Change Mirror Download
-------------------------------------
PUBLIC ADVISORY of xCrZx /18.10.2004/
=====================================

I. Intro
II. Details
III. Exploitation
IV. Solution
V. Outro


--------
I. Intro
========

mod_include is an apache standard module which allow users to
use some features in their html pages such as include file,
exec commands, echo, etc.

-----------
II. Details
===========

There is an overflow in get_tag() function, that was found by
me inside of mod_include.c:

static char *get_tag(pool *p, FILE *in, char *tag, int tagbuf_len, int dodecode)
{
...
term = c;
while (1) {
GET_CHAR(in, c, NULL, p);
[1] if (t - tag == tagbuf_len) {
*t = '\0';
return NULL;
}
/* Want to accept \" as a valid character within a string. */
if (c == '\\') {
[2] *(t++) = c; /* Add backslash */
GET_CHAR(in, c, NULL, p);
if (c == term) { /* Only if */
[3] *(--t) = c; /* Replace backslash ONLY for terminator */
}
}
else if (c == term) {
break;
}
[4] *(t++) = c;
}
*t = '\0';
...
}

as we can see there is a [1] check to determine the end of tag buffer
but this check can be skiped when [2] & [4] conditions will be occured
at the same time without [3] condition.

So attacker can create malicious file to overflow static buffer, on
which tag points out and execute arbitrary code with privilegies of
httpd child process.

for example, an overflow can be occured from handle_echo:
(or other similar functions handle_*())

static int handle_echo(FILE *in, request_rec *r, const char *error)
{
char tag[MAX_STRING_LEN];
...
while (1) {
if (!(tag_val = get_tag(r->pool, in, tag, sizeof(tag), 1))) {
return 1;
}
...

-----------------
III. Exploitation
=================

Exploit was created by me :) and successfully tested on apache 1.3.31 under
Linux RH9.0 (Shrike).

Vuln versions of apache: 1.3.x

------------
IV. Solution
============

To fix this vulnerability you must change one line in get_tag() function:

[1] if (t - tag == tagbuf_len) {

to

[1'] if (t - tag >= tagbuf_len-1) {

--------
V. Outro
========

y0das old shao lin techniq ownz u :) remember my words
http://lbyte.ru/16-masta_killa-16-mastakilla-mad.mp3

shoutz to: m00, LByte, ech0, ha1fsatan, 0xbadc0ded and others :)

and special hello to my parents :)


Copyright (C) xCrZx /18.10.2004/
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