-----BEGIN PGP SIGNED MESSAGE-----
Hardened PHP Project
-= Security Advisory =-
Advisory: Multiple vulnerabilities in vTiger CRM
Release Date: 2005/11/24
Last Modified: 2005/11/24
Author: Christopher Kunz <firstname.lastname@example.org>
Application: vTiger 4.2 and prior
Severity: Cross-Site Scripting, SQL injection and information
disclosure, password hash disclosure, authentication bypass,
local file disclosure, remote code execution
Risk: High / Critical (depending on server configuration)
Vendor Status: Vendor informed. No fix available.
vtiger  is an open source customer relationship management system (CRM)
which is maintained by an indian company with the same name. It has been
forked off the SugarCRM project  in an earlier stage, thus a number of
issues reported by GulfTech Security in  are also present in vtiger. An
additional layer of insecurity has obviously been introduced by the devel-
opers, enabling malicious users to log in to the CRM without any creden-
tials whatsoever and execute remote code.
1) XSS issues-a-plenty
As James Bercegay reported, there is an abundance of XSS problems all
over the CRM, with only a few examples being the following:
- a malicious local user could create a contact, lead, account, poten-
tial or other data set that includes script code in any field. Typi-
cal fields would be first or last name, but nearly every other field
is possible, too. Then, the malicious user could send the link to
that contact to the administrator - and have the script code do what-
ever DOM operation is necessary to elevate privileges.
- Even easier and without any inside knowledge needed:
('document.cookie')%3C/script%3E (as reported by James).
- Since the variable $_SERVER['PHP_SELF'] is used for most form actions,
and also for creating internal links, the string "><script>alert('xss')
</script> can be used to create a path-info XSS that exploits any
logged-in user. The URI parameters are irrelevant and have been
ommitted to keep the example clean.
2) Remote XSS in RSS
vtiger features a comprehensive RSS aggregation module, allowing users
to read all their favorite blogs, news sites or other feeds from within
the CRM. However, no input checking is performed before aggregated feeds
are sent to the client. A malicious blog, news site or other feed could
socially engineer a user into aggregating it and then use script code to
elevate their privileges via DOM.
We are featuring this as a different attack class since the vector does
not require the CRM user to click on any links - being subscribed to an
seemingly interesting blog is enough to fall victim to this attack.
3) Authentication Bypass
If the php.ini setting "magic_quotes_gpc" is set to "Off", which is the
setting provided in php.ini-recommended, an attacker can bypass the
authentication process completely, by entering a fabricated user name.
Since the login form is prone to SQL injection (like any other form),
a username like "foo' or '%'='" leads to the following SQL statement:
This query returns 1 row with the administrator's credentials. This re-
sult set is used to determine that authentication was successful.
The attacker is now logged into the CRM system as the administrator and
can perform tasks like uploading the whole CRM instance to a remote sys-
tem, display system information - and of course mess around with the
4) User credential disclosure via SQL Injection
Again, if magic_quotes_gpc is Off, a logged-in user can manipulate many
form fields into displaying arbitrary values, including user names and
passwords. Again, similar issues were reported by GulfTech - we have
found some more injection vulnerabilities like this one:
This discloses all usernames and passwords in the bugtracker ticket list.
5) Unsafe file inclusion
The "action" and "module" parameters are prone to manipulation, allowing
display of arbitrary files on the server that runs vtiger. A similar bug
was reported for SugarCRM in the advisory described by CVE-2004-1227,
however the problem is far more widespread.
Since variables from GET, POST, COOKIE and SESSION are passed to
include() calls mostly without any checking, they can be abused to in-
clude any file on the local file system, by utilizing the %00 character
to null-terminate the include call.
6) Arbitrary code execution
Although remote file inclusion is not possible - all include() statements
are invariably prepended with relative paths - there is an easy way to
execute arbitrary code. Since vtiger does some extensive logging at every
stage of a user's session, one can just enter PHP code in any field, GET
parameter or wherever, and be sure that the code will be inserted into
a log message. A typical log message with injected PHP code looks like
Fri Sep 16 15:43:10 2005,627  DEBUG VT - Message ->query being
executed : select crmentity.crmid, crmentity.smownerid,[truncated]
where crmentity.deleted=0 AND potentialname like '<?php phpinfo() ?>%'
Every log message is by default saved to the log file 'vtigercrm.log',
which by default resides in a directory accessible for the web server.
Using the vulnerability outlined in 5), an attacker can include the log
file into the CRM suite, prompting any included PHP code to be executed.
Proof of Concept:
Apart from the examples mentioned above, the Hardened PHP Project is not
going to release any PoC for these vulnerabilities to the public.
16. September 2005 - Vendor informed.
10. October 2005 - Follow-up to vendor.
24. November 2005 - public disclosure
Since there is currently no fixed version available, you should protect your
vTiger installation with the following measures:
1. Restrict access to vtigercrm*.log via .htaccess
2. Switch register_globals to Off.
3. Turn magic_quotes_gpc off.
4. Install the Hardening-Patch for PHP to disable %00 URL characters.
You can discuss this and other vulnerabilities in our forum at
http://forum.hardened-php.net/ - an up-to-date list of advisories can be
found at http://www.hardened-php.net/.
pub 1024D/0A864AA1 2004-04-17 Hardened-PHP Signature Key
Key fingerprint = 066F A6D0 E57E 9936 9082 7E52 4439 14CC 0A86 4AA1
Copyright 2005 Christopher Kunz / Hardened PHP Project. All rights reserved.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
-----END PGP SIGNATURE-----