Multiple vulnerabilities in WP Fastest Cache plugin
jetpack.com
jetpack.com
Here’s a report on 0.8.4.8:
https://www.acunetix.com/vulnerabilities/web/wordpress-plugi...
Here’s a report on 0.8.7.4:
https://www.acunetix.com/vulnerabilities/web/wordpress-plugi...
I could go on (all night) but I trust you all get the point. I have two questions.
First, at what point can we say “Emre, you’re really bad at writing code. There are lots of other jobs. Find another.”
Second and more importantly for the future of the web, how can we as an industry protect innocent users from projects like this?? This monstrosity has over 1 million active installs and the chuckle head doesn’t have a fucking clue how to write SQL.
Pro tip: If you have trouble measuring the effect of your caching plugin, it probably means its effect is neglegible.
If you really feel you need a caching plugin, WP Super Cache is written by the company that also writes Wordpress. I'd consider that the most trustworthy.
A properly set up caching plugin basically saves the pages as plain HTML and serve them with mod_rewrite instead of invoking PHP every time. The speed difference for an individual page load might not be that much for a properly optimized site, but the overall resource usage will be much lower.
Is that what you believe or do you have benchmark results?
That serving static files use less resources than firing up PHP should hardly be surprising.
Sure, mod_lsapi and FastCGI are fast, and opcache is a godsend, but static files are still going to be faster than doing multiple MySQL queries, triggering plugins, rendering the HTML, doing whatever post-processing the plugins do, and then serving the result.
You can also write a minimal cache system in just ~2/300 lines of PHP that is still very efficient. So efficient you can even survive a hug of death from HN on a tiny VPS without a blink. I did it.
Yet, people seems so attracted to those bloated "fastest" plugins...
Source: hoster
My first question to you would be "Why wouldn't you bypass PHP and MySQL if you can?".
For some really basic site sure, you can go without caching, but for any reasonable degree of complexity not using caching is a foolish waste of hardware and end-user patience since we can be talking TTFB of 100-200 ms vs up to seconds.
The closest thing you'll get to serverless wordpress in one click. There is no wordpress caching plug-in I am aware of that will get you anywhere near.
Edit: I've also used WP Super Cache and W3 Total Cache quite extensively, both both of these have on some sites had a tendency to randomly clear the cache and I've never managed to figure out why. Cache Enabler has never done this.
> The authors were initially reluctant to acknowledge the CSRF issue, but after obtaining a second opinion from the WordPress plugin team, they fixed it in version 0.9.5.
In what world do you get notified there's a possibility for SQL injection in your code, and then not immediately fix it? This statement shows such arrogance, and little regard for the security of users.
The fundamental problem here is people and companies have got used to the idea they can get huge amounts of software for free, and expect it to be high quality and well maintained.
Personally, I wish programming was treated as "proper engineering", in the same way as bridge building -- there are standards, and you get in serious trouble if you build a bridge, it falls down, and it was clearly your fault.
Of course, people should still be allowed to "build a bridge in their backyard", they just have to put clear warning signs on it, and if a company uses an "illegal bridge", it's their fault when it falls down.
We might still get there, we are still in the early days, similar to when there were no building standards and they fell down / burnt down regularly. After there were enough major disasters, people started demanding better.
Qualitative systems like programming languages have an immeasurable amount of variation and complexity and are extremely difficult to monitor and enforce standards around.
What’s required is a better stack that is less error prone. If programmers can’t make the mistakes in the first place, they won’t happen.
Also, new building materials are created all the time, tested, then allowed if they meet fixed safety standards.
I'm missing WordPress responsability here. The amount of crap listed in the plugin store without any standar needs to be stopped.
It is your responsibility to verify your supply chain. If you can't do that, maybe you shouldn't operate a website that collects user information.
At least before cloud you would have to set up bare metal services which gave people an idea of what they were actually assembling. The fancy control panels and one click installs have created a group of overly entitled administrators who can't admin and won't take any responsibility for running shit, misconfigured, off the shelf services from companies they didn't even vet.
One should expect at least a red flag, but as always they just care about numbers.
You claim that WordPress has a responsibility to vet the submissions on their plugin repo in the same way that Apple vets apps on the app store.
I think this level of abstraction has made web operators lazy. I think WordPress.org has a responsibility to host everybody's code and that it is your responsibility as a website operator to vet that code before you let your server run it. Just because you pay for Github or financially contribute to an app on Github doesn't shield you from bad code that another Github user has submitted.
Nevermind WordPress and all of the plugins they host are GPLv2, which means.....(verbatim) "BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW."
I'd say that can pay for a proper developer or a security audit every once in a while.
Why in the hell are people still injecting strings into queries? In 2021??!
[1] https://developer.wordpress.org/reference/classes/wpdb/prepa...
static::$id = esc_sql($_GET["post"]);
And yeah, esc_sql() don't work in all cases (see here : https://developer.wordpress.org/reference/functions/esc_sql/...) and in this case it's vulnerable.
But the author did try to prevent SQL injections, and misuse of functions happens sometime ¯\_(ツ)_/¯. It's not that trivial when reading the code. A Stored XSS Via CSRF is also far from trivial.
In conclusion, we all write bugs. Some are tricky. Don't be so angry !
There are cases where it's more annoying to do stuff in plain SQL and where you'd have to concatenate strings. But this is not one of them, is a simple parameter that needs to be passed to the query.
But looking at this code, simply casting to an int with `(int) $id` in the `set_id()` method would have been enough.
(Fun "fact", I vaguely remember that, once upon a time, even things like parameters in limit/offsets weren't universally supported. Also, and correct me if I'm wrong, first class support for arrays (e.g., via any($1)) is relatively new).
We have 2 modes of using ODBC/SQL.
Almost tightly bound. Basically you have a bit of query string with question marks in it and you bind out your data points. Either for sending/receiving. Even passing in prepared strings could be an attack vector if you know what you are doing. As it breaks one of the 'rules' of secure programing trusting the client to tell you the correct thing. This however is the currently the only best way to do it, unless you go full on with the stored procedure pattern (which can still have injection attacks).
Loosely bound. Here is a totally composed string ready to go just run it. Also a good way to make easy SQL injection attacks.
Both involve string manipulation.
Then a requirement of that interface is it has to sort of kind of work with at least 4 different SQL systems. Anyone who has had to port stored procs between some of these different SQL systems, can attest to, that they are not the same, except in some very basic ways.
On top of that there are a lot of bad examples out there. But also once someone finally kind of gets something to work they may cut and paste that method. Which may or may not be good. Plus SQL has this stigma for many years of 'being hard'. I know I ended up as the 'SQL guy' for awhile because many in some of my orgs would not touch it.
That is what the runtime environments have to deal with. Some paper over it with an API abstraction, some are better than others.
Some plugins break it and the object cache leaves a lot to be desired but for a basic wordpress you can pretty much activate it and forget it.
I'm not a big fan of wordpress but am running it anyway for our corporate website (I'm the CTO) because it hits the good enough mark and it is just not worth my time trying to come up with something better.
The big advantage of the current setup: I don't have to micromanage it beyond making sure we have backups and the site stays up and running. Our sales and marketing people manage the content and I don't have to babysit them. Win, win for me because I have more interesting things to do then maintaining a website.
The downside: it's PHP and security vulnerabilities are a constant risk and worry with that. I just checked we are up to date and don't have this caching plugin installed. However, we have a constant stream of opportunistic bot traffic trying to exploit pretty much every vulnerability ever for wordpress, php, and php related tooling that we aren't even running. So, I'm more than a bit paranoid about any hypothetical way in.
On top of that, the most used multilingual plugin, WPML, while powerful and effective is a UX and UI nightmare...
Hopefully creating a performance team might help solve some of these issues
https://make.wordpress.org/core/2021/10/12/proposal-for-a-pe...
In the past decade they could have easily fixed a lot of key pains in WordPress, but on one side there are a bunch of amateurs WP users who just don't care and on the other, if they fix obvious security and performance issues, they can't sell "managed WordPress" that easily.
How hard is it to add a "staticize WordPress" toggle? Log in, WP is dynamic; log out, PHP stuff is rendered unexecutable. If WP had a native "static" mode, plugin authors would have to figure out a way to support it well in most cases.
Built-in CDN doesn't make any sense for the self-hosted version. But you can install a plethora of third party plugins for CDN, like Jetpack.
Multilingual support I can agree with. There are discussions ongoing about it and I do think it's going to drop some time in 2022, but for now you're relegated to solutions like Polylang. Polylang actually works really well out of the box, but it does not have 100% compatibility with every plugin.
That sort of thing would be perfect for WordPress and similar CMSs.
As noted by others many WP users don’t have access to the webserver or lack knowledge to configure it properly.
As someone who has written their own WP caching plugin, it's actually very convenient to perform the caching in PHP, because you can check for cookies and regex expressions for URLs, and there are many plugins that handle it well. For most sites I use a free one called Cache Enabler.
This way the request doesn’t touch php at all which is a big advantage.
There is only 1 plugin and it is the one we write our self which take care of caching and all custom needs. Each line of code in that plugin is double checked and properly tested before going in production.