News for hackers. Stuff that matters.
Re:80% of the Web Powered by PHP (2017) by nkozyra on Friday March 22, 2019 @09:28AM (#19462297)
Even though it had no paramaterized/prepared queries and made injection issues abundant?
Re:80% of the Web Powered by PHP (2017) by buboard on Friday March 22, 2019 @09:43AM (#19462417)
not a fault of the library itself. also, mysqli_* has the same issue, was not removed
Re:80% of the Web Powered by PHP (2017) by nkozyra on Friday March 22, 2019 @10:07AM (#19462616)
It doesn't matter whose fault it is; if it provides no mechanism for prepared queries, it should be replaced.

mysqli_ has prepared queries, so it offers an immediate improvement.

Re:80% of the Web Powered by PHP (2017) by teh_klev on Friday March 22, 2019 @10:58AM (#19463123)
You missed my point. All developers did was replace their mysql_* calls with mysqli_* calls but skipped out on the parameterising step. Sure they're using a parameterised capable API, but they're not actually parameterising their queries.

In the real world dropping the mysql_* API achieved next to bugger all, we still ended up with a bunch sites with exactly the same SQL injection vulns.

Re:80% of the Web Powered by PHP (2017) by nkozyra on Friday March 22, 2019 @11:09AM (#19463261)
> All developers did was replace their mysql_*

They did? All of them? Nobody moved to paramaterized queries?

Re:80% of the Web Powered by PHP (2017) by teh_klev on Friday March 22, 2019 @11:15AM (#19463329)
When you work for a mass market shared hoster you get to see all sorts of ugliness, dirty hacks, incompetence and just plain lazyness.
Re:80% of the Web Powered by PHP (2017) by ars on Friday March 22, 2019 @01:52PM (#19465008)
New code sure? But existing code? Especially large projects? No.
Re:80% of the Web Powered by PHP (2017) by nkozyra on Friday March 22, 2019 @04:52PM (#19466818)
I am 100% a LOT of projects fall under this umbrella, but:

1) this is not an argument for leaving an inferior library in the language

2) plenty of people do update their software, for old code and large projects. Why not push people toward the better library?

Re:80% of the Web Powered by PHP (2017) by creeble on Friday March 22, 2019 @10:52AM (#19463059)
Why couldn't the mysql_ library just have added prepared queries? I've never understood this (not a PHP programmer, just someone who has had to patch a dozen sites that were suddenly broken once).
Re:80% of the Web Powered by PHP (2017) by lugg on Friday March 22, 2019 @11:11AM (#19463280)
MySQL libraries are extensions.

The mysqli library was likely a full rewrite in another extension. Extensions, at least that kind, at that time, didn't use/have namespaces.

Keep in mind this is a legacy code base with a function called mysql_real_escape string, like if you're at that point you're so far past gone you've lost all hope.

Re:80% of the Web Powered by PHP (2017) by buboard on Friday March 22, 2019 @02:42PM (#19465598)
> like if you're at that point you're so far past gone you've lost all hope.

for a 25 year library, thats not at all too bad. And even PHP developers admit that the lib was "not broken"

Re:80% of the Web Powered by PHP (2017) by reaperducer on Friday March 22, 2019 @11:19AM (#19463377)
mysqli_ has prepared queries, so it offers an immediate improvement.

Only if they're used. If mysqli_ required prepared statements, then it would be different. But the sins that were committed with mysql_* could still be committed with mysqli_*.

Re:80% of the Web Powered by PHP (2017) by nkozyra on Friday March 22, 2019 @02:39PM (#19465566)
Absolutely, the idea was to provide prepared queries while allowing people to migrate their code.

The point wasn't "this fixed the injection problem" it was that it provided a solution not available for mysql_

Re:80% of the Web Powered by PHP (2017) by buboard on Friday March 22, 2019 @02:45PM (#19465632)
> It doesn't matter whose fault it is

it does for old code. and many people prefer a website with bugs than a website that doesn't work at all. And any website that was vulnerable to mysql_* attacks should have already been hacked out of existence by now.

Re:80% of the Web Powered by PHP (2017) by ddebernardy on Friday March 22, 2019 @12:24PM (#19464094)
Unless something has changed since the early 2000s, `mysqli_` doesn't have a gazillion PHP/MySQL tutorials that are riddled with insecure code. That alone was a good reason to deprecate `mysql_`.