skmd
01-10-2008, 12:38 PM
Hi guys
I did a scan for my site with "Acunetix Web Vulnerability Scanner"
and I found 4 Vulnerables in my registration page, all of them are about $_post.
I have a function "escapestring" that validate the $_POST before its continue (escapestring($_POST))
function EscapeString($text){
$text = htmlentities($text,ENT_NOQUOTES, "UTF-8");
$text = mysql_real_escape_string($text);
return $text;
}
But it seems its not enough cuz it returned the 4 vulnerables about each $_post
The POST variable name has been set to >"><ScRiPt%20%0a%0d>alert(39490.5803280903)%3B</ScRiPt>.
The POST variable name has been set to "+onmouseover=alert(39672.5858216319)+.
The POST variable name has been set to %00"'><ScRiPt%20%0a%0d>alert(39676.5858217477)%3B</ScRiPt>.
The POST variable name has been set to %00'"><ScRiPt%20%0a%0d>alert(39675.5858217477)%3B</ScRiPt>.
How can write a safe function to prevent those attacks??
I did a scan for my site with "Acunetix Web Vulnerability Scanner"
and I found 4 Vulnerables in my registration page, all of them are about $_post.
I have a function "escapestring" that validate the $_POST before its continue (escapestring($_POST))
function EscapeString($text){
$text = htmlentities($text,ENT_NOQUOTES, "UTF-8");
$text = mysql_real_escape_string($text);
return $text;
}
But it seems its not enough cuz it returned the 4 vulnerables about each $_post
The POST variable name has been set to >"><ScRiPt%20%0a%0d>alert(39490.5803280903)%3B</ScRiPt>.
The POST variable name has been set to "+onmouseover=alert(39672.5858216319)+.
The POST variable name has been set to %00"'><ScRiPt%20%0a%0d>alert(39676.5858217477)%3B</ScRiPt>.
The POST variable name has been set to %00'"><ScRiPt%20%0a%0d>alert(39675.5858217477)%3B</ScRiPt>.
How can write a safe function to prevent those attacks??