News for hackers. Stuff that matters.
Re:Go with PHP by janmo on Thursday May 11, 2023 @12:31AM (#35897534)
I worked for a company and we used the PHP ORM Propel. So in theory no SQL injections you would think, WRONG.

We used a function like findOne() (I don't recall exactly). It looked like this:

$resetTokens->findOne($GET['password-reset-token']);

The issue was that findOne would accept wildcards, so one could use ?password-reset-token=% in the URL and reset the password of any random users.

Re:Go with PHP by blindhippo on Thursday May 11, 2023 @12:46AM (#35897643)
... why would you pass $GET through to a logical layer with access to a data store write without sanitizing it?

This seems like a pretty basic thing to fix, but then I only have your snippet to go by.

Re:Go with PHP by oefrha on Thursday May 11, 2023 @01:37AM (#35898027)
That’s a parametrized API that’s supposed to be safe against injection, at least to anyone who’s ever used parametrized APIs and hasn’t read the documentation of this particular library in detail. That it supports wildcard makes as much sense as log4j executing code in textual messages.

If an ORM/builder casually puts = and LIKE in the same method, don’t touch it.

Re:Go with PHP by creamyhorror on Thursday May 11, 2023 @03:51AM (#35899122)
I think the webpage is talking specifically about Laravel. It ambiguously doesn't mention Laravel till later, but the code snippet looks like Laravel code. Laravel's ORM does sanitise strings.

The snippet also validates request inputs, so clearly it doesn't assume that inputs are safe.

Re:Go with PHP by _the_inflator on Thursday May 11, 2023 @06:03AM (#35900051)
I totally agree with everyone before me here on the issue of security.

If an app stands the stress test against say for example this comprehensive list(1), it can consider itself somewhat safe or at least benchmarked. Otherwise, only vague and unsubstantiated claims, which does not help PHP nor any other programming language or framework.

[1] https://github.com/payloadbox/xss-payload-list

Re:Go with PHP by hk1337 on Thursday May 11, 2023 @08:39AM (#35901208)
In both Symfony and Laravel these days they have their own request objects to help you get information on the request. You shouldn’t be reaching into the get or post variables directly like that.

i.e. $request->query(‘password-reset-token’);