News for hackers. Stuff that matters.
Re:Don’t try to sanitize input – escape output by tie_ on Thursday February 27, 2020 @03:00AM (#22431514)
This. I'm tired of people implying or right out stating that SQL injection is an input validation problem. Why couldn't you have foo' OR 1=1; as a title of your post? It is all good characters as far as text entry is concerned.

SQL injection is really a problem of how you pass parameters to your SQL layer. Parametrized queries are the (easy and widely available) solution. If you are concatenating input to your SQL queries, you're doing it wrong.

Re:Don’t try to sanitize input – escape output by squiggleblaz on Thursday February 27, 2020 @03:24AM (#22431614)
How many people named O'Brien are told they can't sign up, or passwords get rejected because they contain special characters?

It's crazy.

Even if you're using 1990s technology without parameterised queries, it's not like it's impossible to say `insert into users (name, motto) values ('O\'Brien', 'foo\' OR 1=1;')`.

Re:Don’t try to sanitize input – escape output by fwsgonzo on Thursday February 27, 2020 @08:03AM (#22432831)
Yep. I've stopped counting the amount of websites that force me to use weak passwords. It's crazy that this is still a thing in 2020.

I wish the controls on browsers came with a green V that implements best practices (8+ symbols, no filter) so that people who made websites understand that this is what they should conform to. Not their own misconceptions about password security.

Re:Don’t try to sanitize input – escape output by lodovic on Friday February 28, 2020 @06:45AM (#22442123)
I wish websites would stop enforcing a "password policy". An insecure password should be a choice. If you are so sure you cannot secure your site, leave authentication to a third party provider. All this leads to is zillions of user accounts that are used only once.
Re:Don’t try to sanitize input – escape output by hinkley on Friday February 28, 2020 @11:23PM (#22448802)
I’m sorry, your password must be 16 characters or less and contain no white space or punctuation.
Re:Don’t try to sanitize input – escape output by chaz6 on Friday February 28, 2020 @11:29AM (#22443917)
I have heard stories about people in Ireland struggling to get certain services because their name contains a Fada, but some of the identity paperwork they have is missing the Fada due to lack of support by computer systems.
Re:Don’t try to sanitize input – escape output by simias on Thursday February 27, 2020 @09:13AM (#22433380)
I blame PHP. Many webdevs active today started with it, and the standard library's solution to injections was escaping everything half a dozen times just in case. Because PHP being PHP nobody saw any red flags when they implemented a function named "mysql_real_escape_string". Apparently they've deprecated these functions since then, but the damage is done.
Re:Don’t try to sanitize input – escape output by ivanhoe on Thursday February 27, 2020 @12:04PM (#22435144)
But that's not a thing for 15 years or more? PDO was added around 2005, and even before that anyone in their right mind used mysqli extension for prepared statements. Since 2012 you can't even use the mysql extension without getting a depreciation warning.

And yes, in 90s php's security sucked, but that was nothing php specific, it was just the sentiment of that time. Everyone did it, in all languages. I remember using tons of $dbh->do() in Perl's DBI back then, intentionally avoiding to prepare statements for a quick and dirty stuff (and most of the scripts back then were quick and dirty stuff). It's in a big part because we were used to building desktop apps and thinking in terms of security that applied for them like being careful about your pointers and input strings lengths and stack overflows and stuff. Web was still pretty new thing.

Re:Don’t try to sanitize input – escape output by teh_klev on Thursday February 27, 2020 @01:11PM (#22435938)
> But that's not a thing for 15 years or more? PDO was added around 2005

Ex-shared hosting bod here, who had the joy of managing our PHP environments :(

Sadly in the real world, even after the great big (and pointless) act of deprecating and removing the mysql_* library, naive developers (and experienced ones that should've know better) just moved onto mysqli_* or PDO and still used string concatenation with raw inputs, instead of learning how to parameterise their queries.

Used to drive me flippin' nuts.

Re:Don’t try to sanitize input – escape output by ivanhoe on Friday February 28, 2020 @07:55AM (#22442427)
> naive developers (and experienced ones that should've know better) just moved onto mysqli_* or PDO and still used string concatenation with raw inputs, instead of learning how to parameterise their queries.

True, I stand corrected, I've just checked and Wordpress still does it just like that: https://github.com/WordPress/WordPress/blob/master/wp-includ...

Re:Don’t try to sanitize input – escape output by hinkley on Friday February 28, 2020 @11:37PM (#22448852)
The one and only time I argued with someone about PHP, the forum the guy ran got hacked the very next morning and was running a botnet of some sort. I was smug but quiet, and I never really thought about it but the timing makes me wonder if he thought I was involved.

Anyway, there’s a patch release the next day, and somewhere I find the diff. Now I can’t read PHP but I know what string concatenation looks like, especially if someone does a diff on it. I’ll be damned if the diff didn’t fix one SQL string concatenation that was less than five lines from code with the same structure. Scsry.

Re:Don’t try to sanitize input – escape output by nakkijono on Thursday February 27, 2020 @12:47PM (#22435651)
PHP and vulnerable example code is an additional thing. Most people just copypaste from tutorials. For example, the first search result for "PHP mysql example" gives you the wrong example first https://www.w3schools.com/php/php_mysql_select.asp