PHP 8.1.34 being installed still via GUI update. EOL & vulnerable to PHP2Shell?

Hi all,
I updated my Pi4 emonSD installation today, and noticed that it bumped PHP to v8.1.34 (though this seems to have a build date of 21st Oct when I use php --version to check it, which I don’t understand because according to PHP, it was last updated in Dec 2025 - PHP: PHP 8 ChangeLog )

Everything I’ve read today indicates to me that PHP 8.1 is well out of support, and is vulnerable to PHP2Shell (which coincidentally also hit the headlines on 21st Oct - PHP: News Archive - 2026

Am I jumping at shadows or have I missed something? I know theoretically an isolated emonpi is unlikely to be accessible from an internet source that might come knocking, hunting for a PHP2Shell hole to crawl into… but security-by-obscurity isn’t really security imo.

Are there plans for an upgrade to PHP 8.2 or higher (though tbf, that becomes EOL this December)? Or should my update have taken it higher and something’s gone wrong?

Any insight gratefully received! Thanks

Hello @BigJacko you are right and really we need to make a big step forward in the way we are deploying emonSD images and ensuring that the OS and full stack of emoncms dependencies are all updated alongside emoncms itself. We are currently working with @jeremypoulter on a solution that is similar to how Home Assistant deploy their setup. A lightweight buildroot with A/B partitions launching docker images that can be updated as a whole.

That’s great to hear, @TrystanLea and I look forward to it. I’d offer to help but I think somehow you’re way ahead of me in terms of skills there, but if I can be of any assistance, please let me know.

Turning to the now though, what do you think my chances would be if I invoked a local update to PHP 8.2 (the minimum version that is supposedly PHP2Shell-proof)? Is it likely to break a whole load of operational stuff, or just cause a bit of kerfuffle when doing later GUI updates? Has anyone managed this? I couldn’t find much on the forum when searching earlier, so I’m guessing this is fresh ground…

Or should I sit tight and wait for the new regime you’re referring to? As a dev myself I hate to be the guy asking for ETAs - I know what it’s like when people hold you to ransom over guesstimates later - but do you have a roadmap or a ballpark plan in place for this, or is it a case ‘when it’s done, it’s done?’ If there’s something in place I’ll probably just wait; I don’t think my emonpi is at massive risk currently (it’s not world-facing), but if it’s a mega-project that might take several months/years, perhaps I’ll have a go at a PHP update (after much backup and disaster-recovery steppage first, obvs!)

Cheers for all your hard efforts in any case, @TrystanLea - they are greatly appreciated!

Whilst not wanting to suggest that there is no problem with unpatched PHP, I found this article instructive…

Point taken, John. Instructive and amusing… but still… we patch :wink: And wisely so, imho.

I forgot to mention the other issue that is pressing - which has nothing to do with PHP, but is the other high-ranking CVE affecting Linux kernels generally this week: https://www.cve.org/CVERecord?id=CVE-2026-98438

MPTCP is enabled by default on the current EmonSD build, I think - certainly mine appears to be (use sudo sysctl - a | grep mptcp.enabled and if yours comes back with a 1, it’s enabled)

Again, unlikely to be a major risk behind a NATed router/LAN, but it’s still a risk, unless you’re 100% certain all the other devices sharing that LAN aren’t already pwned (or going to be).

Obviously some of my other Pi devices are still awaiting fixes from their normal aptsource, (except my Pi2 which was actually the first to get fixed), and we’re in the hands of the Raspberry Pi guys for those - but I can crank apt update && apt full-upgrade to my heart’s content on those SBCs, but not my emonSD Pi4 - that’s still dangling on 6.1.0-rpi8-rpi-v8 which is Jan 2024 vintage and should only be tweaked via the EmonPi GUI update system, really. Hopefully this is also on Trystan’s radar and earmarked for the new system too (if not, I hope it is now! :smiley: )

Wordfence is a protection software for the well-known WordPress software.
This blog https://www.wordfence.com/blog/2026/10/php2shell-update-still-no-confirmed-wordpress-compromises-and-answers-to-the-questions-were-hearing-most/ states in the very first sentence
" TL;DR: As of October 28, 2026, Wordfence is not aware of any WordPress site compromised through PHP2Shell (CVE-2026-109618 and CVE-2026-109619)."

That was published 3 days ago. It is probably worth reading a little more beyond that first sentence.

Your very welcome to run apt update && apt full-upgrade on your emonSD build. I did on mine last week and everything worked fine apart from the admin > components ui stopped showing git info which is a minor inconvenience.

What I need to do is go through each emonSD image version in the safe update list and run apt update and upgrade & full-upgrade and work out what works and what breaks and from there work out recovery from any issues that do arise. This is ideally needed as an interim or in-parallel solution to the buildroot+docker approach.

It’s probably a good idea to disable remote access via services such as dataplicity wormholes as well.

I was reading up about this for emoncms.org yesterday and disabled MPTCP, we dont have any services that use it so it wasnt exposed anyway but at least by disabling it it stops a new service from using it.

Sounds interesting.

If this means that there is to be a solution where emoncms runs by default as a Docker on a Pi, then compatibility with or extending it so that @alexandrecuer HA docker solution is merged might be a good idea. emoncms in an HA Docker is really great.

My understanding is that if MPTCP is enabled, all IPv4 TCP listeners are capable of MPTCP (regardless of whether or not they’re actively seeking to be used in that way) and thus the machine is vulnerable.

That would include services like SSH running on the emonpi, as well as the webserver handling graphing and apps, etc. Anything that listens for TCP connections.

I don’t think anything in the current emonSD bundle (or update-patches) actively disables MPTCP to override the default Bookworm-and-above system-wide setting of mptcp.enabled to true (1).

If anyone’s keen to disable this prior to an update in the EmonSD patching GUI, this might help:

First - background proof that mptcp.enabled = 1 is not coming from any script or config, and is actually a kernal compilation setting by default:

sudo grep -r "mptcp" /etc/sysctl.conf /etc/sysctl.d/ /lib/sysctl.d/ /usr/lib/sysctl.d/ 2>/dev/null

That’ll spit any mention of it out to the console (and errors to null). If the response from this command is empty/blank/nothing, then the mptcp.enabled setting is coming from somewhere else, not a config.

To confirm it’s enabled by default in the kernel at compile-time, check the compiler config options thus:
sudo modprobe configs 2>/dev/null; zgrep CONFIG_MPTCP /proc/config.gz || grep CONFIG_MPTCP /boot/config-$(uname -r)

That should return with:
CONFIG_MPTCP=y
confirming this is a kernel built-in choice, and not a config override.

Ok, so it’s there, it’s real, and it’s a kernel setting, if you’re with me this far.

Disabling it is easy enough using:
echo "net.mptcp.enabled=0" | sudo tee /etc/sysctl.d/99-disable-mptcp.conf
which should add it to a sysctl service startup config file (or make one if it doesn’t already exist).

Apply it with:
sudo sysctl --system

and confirm it actually made the change, with:
sysctl --system | grep mptcp.enabled
or the one I used before which was:
sudo sysctl -a | grep mptcp.enabled

Both/either should return:
net.mptcp.enabled = 0

and if so, you’re no longer vulnerable to CVE-2026-98432.

(My apologies for the number of steps, but I felt it was important to establish the proof of the fact that it IS enabled by default, and where it was enabled, and that it’s not just a case of 'turning it off in the file where it’s turned on - because such a file doesn’t exist, and a new one has to be made in the sysctl.d folder. I think it’s better people have the ability to confirm these steps themselves, and confer with other sources to be certain, rather than blindly type in stuff that a helpful stranger like me might recommend! :smiley: )

Again, useful insight, Robert, and you’re right to say that it’s worth reading beyond the first sentence.

The issues I’d take with this as a bellweather signal of ‘hey, it’s not so bad’, is that:
(a) Wordfence isn’t covering anything other than Wordpress installs, and Wordpress is by no means the only thing sitting on top of PHP (emonCMS case in point!).
(b) Wordfence is only installed by Wordpress admins that actually have a clue about security in the first place. It’s not a default plugin, and it will not be seeing all the zillions of people whose WP installs DO NOT have Wordfence! So WF are really looking at a sub-set of a sub-set of WP users who were potentially in the set of people (like me) who updated their PHP installs on Weds 21st the second the news broke (or before).

Furthermore, an entirely different source is reporting that there have been confirmed cases of compromises, some in organisations linked to the US Govt, albeit not on Wordpress! And those compromises have provided ‘useful’ (i.e. dangerous) starting points for privilege escalation and been shown to be actively used in a hostile fashion:

News report at Techradar:

Original research by Dream (the cybersecurity group that discovered it)

That is exactly why I brought it to everyone’s attention. We know Wordfence users represent only a small sample of PHP users, but even so, any detections in 4 million would indicate a significant problem even given that their claimed nil rate of detection definitely does not signify no problem.

Maybe our readers will at least find the references useful.

Incidentally, running sudo modprobe configs 2>/dev/null; zgrep CONFIG_MPTCP /proc/config.gz || grep CONFIG_MPTCP /boot/config-$(uname -r) for me returns
# CONFIG_MPTCP is not set (It is emonCMS low-write 11.16.8 on a very early emonPi1).
However, on an emonPi3 (emonCMS Version: low-write 11.19.8 and emonSD-10Mar26 but still running on a early RPi 2B, I do get CONFIG_MPTCP=y

Reading Linux's October 2026 TCP Use-After-Free: CVE-2026-98432 — Atlas it seems that turning off MPTCP only fixes the known working exploit but does not fix a wider TCP issue.

There are a couple of useful articles here that detail another temporary mitigation:

Useful articles on suitable temporary mitigations:

Hey @TrystanLea,

As a former Debian maintainer (although I would say I’m more “post distro” now - at work we’ve been slowly moving to whole OS builds using Buildstream & GNOME OS building our ostrees for us), looking at how the EmonScripts are put together makes me feel a bit itchy. :sweat_smile: I’ve played with the docker containers before and this always seemed like the right way to go - is there something I can do to help or test these?

I also successfully upgraded my emonHp to the latest of everything since Sury (a new internet hero!) updated the PHP builds on his repo. On the way I did epically run out of disk space and I saved a load (like 700MB) by tearing out all of the v6/v7 kernels (my emonHp is a Pi 4) and the whole rpicam stack whose dependencies are growing. I also ran into a deadlock where redis would not shut down, because it had no free disk space to write out its buffered events, and dpkg just sat forever while I worked out what was going on. Would it be worth applying some fixups/cleanups (less kernel images, remove camera stack, possibly also move redis off the / partition?) to EmonScripts?

My Claude found a litle bug-let in log2ram as well, Add missing trailing newline to log2ram.00_olddir by ramcq · Pull Request #4 · openenergymonitor/log2ram · GitHub which doesn’t really do much (logs basically all now go to volatile journald anyway) but makes logrotate spit an error every day.

One small win that looks worth investigating - if we port emoncms_mqtt from Mosquitto-PHP (compiled library) to php-mqtt (written in pure PHP and available from Composer) then we can switch to the packaged version of php-redis, and we won’t rely on building any local binary PHP pieces. This will make it much easier to switch PHP versions, either when building images/containers, or doing OTA updates on existing systems.

Would you be interested in me cooking a patch along these lines?

Cheers,
Rob

I think it’ll all boil down to which Linux version is installed @Robert.Wall - without looking it up (in a rush atm, sorry) - I think the MPTCP vuln affects versions of Debian that are Bookworm and above, so Debian 12 (bookworm) and 13 (trixie) possibly. Saying that, my Pi2 is trixie but it’s not enabled - but then it’s up-to-date and has already been patched by Raspberry OS updates directly. It’s also 32-bit, and I think that has a bearing on things, Bookworm or not. Raspberry still hasn’t released a fix for 64-bit Bookworm versions - I’m checking https://forums.raspberrypi.com/viewtopic.php?t=401496 daily to see, but so far I think it’s still being regression-tested or something. I’m aware it’s been fixed on Debian’s version upstream, so it’s in the hands of the Pi devs right now.

Dang, you’re spot on, Trystan. And I knew this too, but forgot that nuance! I read insights to that effect (it being not totally safe even when mptcp is disabled) elsewhere on day one but am evidently spinning too many plates and it fell out of my brain!

I think we’re all agreed on the basics though; there are risks, and if your emonPi is on a NATed LAN, they will be partially-mitigated to a great extent (and conversely highly elevated if your emonPi is world-reachable for any reason, thus this is really NOT RECOMMENDED).

But LAN hiding isn’t a complete answer long-term (if something else falls prey, you could still find your Pi victim to an ‘it’s inside the house’ attack), so patching is still a reasonably high priority.

Also, I confess I completely missed your post PHP 8.1.34 being installed still via GUI update. EOL & vulnerable to PHP2Shell? - #7 by TrystanLea in my rush yesterday, and I’m tempted to give it a whirl, but I still have PTSD from having done a similar set of updates on my Pi2 when it used to be my emonPi base, long, long ago. Other than a piece of code handling my homebrew meter pulse-counter circuit, and an injector into emoncms to log/graph it, I’ve been very careful on the new incarnation to keep everything vanilla (so no more running Node-RED on the same box and risking resource starvation, LOL!).

I think I’ll wait till the ‘official’ patch is out, just in case - and as said earlier, if there’s anything I can do to help, please reach out. Meantime, power to your elbow and sincere thanks for looking into all this. That was all I wanted to find out about when I first started this thread, and to let people know these issues can and might affect us. It’s great that you’re evidently taking this seriously, so I’ll sit tight and wait patiently. Good luck, and thanks in heaps!

I’m not sure if this is the right place to discuss this topic, but since I’ve seen some discussions about EmonSD, I’m taking this opportunity to point out the following:
For Raspberry Pi installations, there’s no EmonSD-style installation on SSD, whether on Pi 4 SSD/USB or Pi 5 SSD/NVMe.
If such an option existed, it would be much simpler to install everything via the command line using SSH.
Is this something that could be considered?
How many users might be interested in this type of installation?
Isn’t this the future alternative to SD cards?

As @TrystanLea mentioned I have been working on a replacement for EmonSD called EmonOS. It is based on HAOS (well more takes inspiration from). Basically it has a light weight, immutable OS that runs EmonCMS as a docker image, with data stored on a separate partition. The kernel and OS partitions can be updated separately.

So far I have a proof of concept which you can look at here GitHub - jeremypoulter/EmonOS · GitHub . It is very early stages but any feedback is welcome, but be aware it should not even be considered alpha, not least because it hasn’t been patched with all the updates for the issues of the last few weeks :wink: I will endeavour to rectify this in the next week or so.

Have you linked in with @alexandrecuer (Home Assistant Addon author) or @ramcq (above).

If we can have one docker solution that would be great.

I’d also suggest this should be hosted on OEM GitHub.

actually if the problem is updating (to what I understand), I think that buildroot is not (really) the key point, but I can misunderstand things :slight_smile:

the key point for HA to have a strong updating system is the use of a supervisor which is written in python and using the python docker sdk (pip install docker), running in its own docker container…