This is possibly a duplicate question, but I am unable to find the other one if it is.
I was looking for advice on how secure url rewriting is? Does it stop SQL injection, or XSS? If not, how would one circumvate it?
The reason I ask is because I am unsure of the process that rewriting takes. Am I right in believing that this URL could effectively be dangerous:
http://www.website.com/article/1‘ UNION ALL…
URL rewriting doesn’t have anything to do with preventing SQL injections! URL rewriting is mostly used to turn “ugly” URLS (like http://domain.com/index.php?name=1&value=2) into pretty URLs like http://domain.com/1/2).
It doesn’t prevent SQL injection at all. SQL injection must be prevented by making sure that user inputs do not contain characters that modify an SQL statement so that it does things that were not intended. Example:
You have an SQL Statement like:
And
$tableNameis a parameter that is entered by the user through a web form. Now the user could enterUsers; DROP TABLE Users; --. This would be bad:This, however, can not be solved by URL rewriting.