Post Pacific  

Go Back   Post Pacific > Восстановленный архив > Темы без сохранившегося раздела

Notices

 
 
Thread Tools Search this Thread Display Modes
Old 31.07.2007, 11:40   #1
FidoW
Архивный участник
 
Join Date: Sep 2005
Posts: 1,014
Default

Quote:
Originally Posted by Guaresnay View Post
In that case, ask for old pass, encrypt it, then u check if that password is the same that the password stored using the binary function for SQL..
its like..
PHP Code:
$query = "SELECT account, password FROM user_auth with (nolock) WHERE account = '".$_POST['account']."' AND password = CONVERT(binary, ".encrypt($_POST['oldpass']).")";
$link = mssql_query ($query);
if(!
mssql_num_rows($link)){
       
$error = "wrong password";
} 
SQL injecction possible with that query... be carefull...
Code:
WHERE account = '".$_POST['account']."' AND
' OR 1=1; --
FidoW is offline  
Old 31.07.2007, 12:55   #2
ZeniMax
Архивный участник
 
Join Date: May 2006
Posts: 209
Default

Yes I know but for now its for test. After I test I Put this L2cp modded function:

Code:
function seguridad1($strh) {
	$banwordshh = array ("'", ",", ";", "--", "%", "-", "SELECT", "DROP", "UPDATE", "QUERY", "%", "IN", "UNION, "\"", "'");
	if ( eregi ( "[a-zA-Z0-9]+", $strh ) ) {
		$strh = str_replace ( $banwordshh, '', strtolower ( $strh ) );
	} else {
		$strh = NULL;
	}
	return $strh;
}
___
$account = $_POST['cuenta'];
$cuenta = seguridad1($cuenta);

query ("SELECT blababa WHERE account = '$cuenta'");
If you know another way to create more functions for more security please tell :P (I know you maybe create more secure functions and you dont want to revelate ((For avoid cheaters)) ).

PS: I dont know but the array for the query always its blank result!!.
ZeniMax is offline  
Old 31.07.2007, 13:39   #3
Guaresnay
Архивный участник
 
Join Date: Oct 2005
Posts: 113
Default

Quote:
Originally Posted by FidoW View Post
SQL injecction possible with that query... be carefull...
Code:
WHERE account = '".$_POST['account']."' AND
' OR 1=1; --
It was just to give a basic idea..

Quote:
Originally Posted by ZeniMax View Post
Yes I know but for now its for test. After I test I Put this L2cp modded function:

Code:
function seguridad1($strh) {
	$banwordshh = array ("'", ",", ";", "--", "%", "-", "SELECT", "DROP", "UPDATE", "QUERY", "%", "IN", "UNION, "\"", "'");
	if ( eregi ( "[a-zA-Z0-9]+", $strh ) ) {
		$strh = str_replace ( $banwordshh, '', strtolower ( $strh ) );
	} else {
		$strh = NULL;
	}
	return $strh;
}
___
$account = $_POST['cuenta'];
$cuenta = seguridad1($cuenta);

query ("SELECT blababa WHERE account = '$cuenta'");
If you know another way to create more functions for more security please tell :P (I know you maybe create more secure functions and you dont want to revelate ((For avoid cheaters)) ).

PS: I dont know but the array for the query always its blank result!!.
In your example you are changing every posted account and in most cases it will look for an unexisting account.
Try using something like this:
PHP Code:
$account = trim($_POST['account']);
if ((!
eregi("^[[:alnum:]]{2,14}$", $account)) || (eregi("[[:space:]]{1,}", $account))){
    
$error = "Invalid Account";
}
if(!
$error){
    
mssql_query("lalala");
}else{
    print 
$error;
} 
Then you can add some java script to ur code to add some more security.
Guaresnay is offline  
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 20:00.