[UNIX] Network Query Tool Command Execution Vulnerability

From: support@securiteam.com
Date: 10/23/01


From: support@securiteam.com
To: list@securiteam.com
Subject: [UNIX] Network Query Tool Command Execution Vulnerability
Message-Id: <20011022222847.A9345138C9@mail.der-keiler.de>
Date: Tue, 23 Oct 2001 00:28:47 +0200 (CEST)

The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com
- - promotion

When was the last time you checked your server's security?
How about a monthly report?
http://www.AutomatedScanning.com - Know that you're safe.
- - - - - - - - -

  Network Query Tool Command Execution Vulnerability
------------------------------------------------------------------------

SUMMARY

 <http://www.shat.net/php/nqt/> Network Query Tool (NQT) is a one-stop
solution for getting information about a domain or IP address. Instead of
manually using different UNIX commands or visiting numerous websites to
"investigate" a host, just load Network Query Tool and enter the hostname
or IP. A security vulnerability in the product allows attackers to cause
it to execute arbitrary UNIX commands.

DETAILS

Network Query tool does not check for special meta-characters like:
&;`'"|*?~^()[]{}$. This allows any user to execute UNIX commands on web
server.

The problem can be found here:
if (! $msg .= trim(nl2br(`ping -c5 $target`)))
And here :
if (! $msg .= trim(nl2br(`dig any $target`)))
And here :
if (! $msg .= trim(nl2br(`/usr/sbin/traceroute $target`)))

Exploit:
Execute 'ls -l' command.
http://www.example.com/network_query.php?
portNum=80&queryType=all&target=www.someserver.com%3Bls+-l&Submit=Do+It
(NOTE: URL has been split into two lines)

Status:
The program's coders have been alerted.

Temporary fix:
Use this at the beginning of your PHP script:

$target = system(escapeshellcmd($target));

ADDITIONAL INFORMATION

The information has been provided by
<mailto:aurelien.cabezon@iSecureLabs.com> Cabezon Aur?lien.

========================================

This bulletin is sent to members of the SecuriTeam mailing list.
To unsubscribe from the list, send mail with an empty subject line and body to: list-unsubscribe@securiteam.com
In order to subscribe to the mailing list, simply forward this email to: list-subscribe@securiteam.com

====================
====================

DISCLAIMER:
The information in this bulletin is provided "AS IS" without warranty of any kind.
In no event shall we be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages.



Relevant Pages

  • Re: Where should I put my own perl command scripts ?
    ... the security hole which that provides the black hat. ... If you allow users to execute their own code at all they can short ... User can alias the broken command to run their own copy without the ... bigger danger of placing their path ahead of system. ...
    (comp.os.linux.misc)
  • [UNIX] Sendpage (Perl CGI) Remote Execution Vulnerability
    ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... vulnerability in the product allows attackers to execute arbitrary code. ... The offending line of code that allows us to execute our own command is ...
    (Securiteam)
  • Re: file search fails
    ... This IS a serious security issue. ... When we execute searches to find dangerous files, ... we've had to go back to using the DIR command because Vista's search missed so many files. ...
    (microsoft.public.windows.vista.general)
  • Re: Its COBOL, Jim, but not as we know it...
    ... ActiveX control has no more permissions on your system than a Java ... It is _you_ that has improved the security, ... MicroSoft system of signed authentication which is used by ActiveX controls. ... Microsoft email can automatically execute an attachment. ...
    (comp.lang.cobol)
  • [NEWS] DB2 on iSeries Stored Procedures Vulnerability
    ... Beyond Security would like to welcome Tiscali World Online ... This vulnerability lets an otherwise limited user execute iSeries ... This vulnerability lets a user execute REXX scripts. ... CL programs sources are kept in Source files. ...
    (Securiteam)