0
I was taking a look at some projects on the internet that involve security and came across the following code.
All requests to the site were redirected to index.php
for mod_rewrite
, the connection to the database was made with PDO, using Prepared statements, everything was in the pattern, however I went to take a look at the index and I came across this code
/** O projeto permite somente slugs com 250 caracteres **/
if (isset($_GET['params']) && (strlen($_GET['params']) > 250))
{
header('HTTP/1.0 403 Forbidden');
die('<b>O endereço atual excede os limites de segurança</b>');
}
I thought it was very strange and I decided to go down to check.
I used the sqlmap to do some tests and the same did not get results. I took this line that I posted above and did the tests again, basically it didn’t change at all except in the Apache logs that I could see that the sqlmap strings were "passing", instead of being "Barradas" by the script and generating 403 errors.
To secure the application and save server resources, the code above is a preventive or unnecessary measure?
I think the word "security" in this case is being used in a figurative sense (i.e. a very large Slug could cause bugs in other parts of the application for whatever reasons). and not in the literal sense. But it’s just a hunch...
– mgibsonbr
There’s nothing in what you posted that reinforces security with respect to SQL Injection. The script only prevents the application from proceeding if Slug is more than 250 characters long and triggers a security warning if it occurs. As already mentioned, it is an exaggeration because it is not about safety, but about business rules and also because the GET method is limited to 255 characters. In short, it is a very coarse gambiarra. Applied confusingly by firing a 403 Forbidden with message about safety.
– Daniel Omine
It’s confusing to give an answer. If you can change the question to something more relevant, at least relevant to the title or modify the title according to the text, I think it might become feasible
– Daniel Omine