資安筆記:PHP2Shell 漏洞——哪些軟體有風險,LocalPapa 為什麼不受影響

這是 LocalPapa Notes 的第三十二篇,這次不談新工具,談一則資安新聞:2026 年 10 月 21 日,PHP 發佈緊急安全更新,修補兩個被稱為 PHP2Shell 的漏洞。

先說結論:

  • LocalPapa 沒有使用 PHP,不受這次漏洞影響。 你在這個網站上不需要做任何事。下面會說明我們怎麼確認的。
  • 但你身邊很可能有用 PHP 的東西:WordPress 網站、家裡的 NAS、公司的防火牆管理頁面、電話總機。這些才是這篇真正想提醒的。

發生了什麼事

PHP 是一種寫網站伺服器的程式語言,WordPress、Drupal、Nextcloud、大量的主機管理面板和網通設備的管理頁面都用它。這次的兩個漏洞嚴重在三點:

  1. 不需要登入。攻擊者只要能連到網站就能嘗試。
  2. 不需要網站程式寫錯。問題出在 PHP 本身,網站寫得再小心也一樣。
  3. 可以遠端執行程式,等於拿到那台伺服器的控制權。這也是「PHP2Shell」這個名字的由來:從 PHP 拿到 shell。

PHP 官方給兩個漏洞的 CVSS v4.0 分數都是 9.2(滿分 10)。各家評估不完全一樣,例如 Red Hat 評為 8.1,但沒有人認為它不嚴重。

日期(2026) 事件
10 月 17 日AWS 回報已偵測到攻擊嘗試,比公開早四天
10 月 20 日細節在社群網站外流;PHP 官方發出預告
10 月 21 日PHP 發佈 8.5.12、8.4.27、8.3.36、8.2.35 修補;當天就觀察到攻擊與大範圍掃描
10 月 23 日PHP 另外公告一個相關但不同的漏洞 CVE-2026-115560(下面另外說明)
10 月 26 日美國 CISA 把 CVE-2026-109618 列入「已遭利用漏洞」清單
10 月 29 日Palo Alto Networks 確認有人把這個漏洞與 Linux 核心提權漏洞串在一起,攻擊對外開放的防火牆管理介面並取得 root 權限

Palo Alto 旗下 Unit 42 依自家遙測,估計網路上有超過 2,260 萬個可能受影響的對外 PHP 服務。

兩個漏洞,用白話說

CVE-2026-109618:記憶體用光時,留下一半的資料。 PHP 在讀取你送出的表單($_POST)時,會把欄位一筆一筆放進內部的表格。研究人員發現,表格的「筆數」會先加一,才去配置那一筆的記憶體。如果剛好在這一步記憶體用光,PHP 會中斷這次處理,但筆數已經多算了一筆。事後清理時,PHP 把那筆從沒放好的資料當成真的來處理,攻擊者就能藉此控制程式的走向。攻擊者只要送一個欄位名稱特別長、層層巢狀的表單,就能故意讓記憶體在這一步用光。

CVE-2026-109619:上一個請求的殘留,被下一個請求踩到。 一個 PHP 工作程序(worker)會連續處理很多個請求。有些記錄是整個工作程序共用的,卻指向只屬於某一個請求的記憶體。如果處理到一半遇到致命錯誤,這些記錄沒被清掉,下一個請求就會去讀一塊已經被釋放的記憶體。已確認的路徑有兩條:一條是「上傳進度追蹤」(session upload progress,預設開啟,網站沒有用到 session 也會執行),另一條是 PHP 8.5 新增的致命錯誤回溯功能。

兩者的共通點:都發生在網站自己的程式開始執行之前。 所以網站的登入頁、密碼保護、外掛的安全設定都擋不住,因為輪不到它們上場。

LocalPapa 為什麼不受影響

說「我們不受影響」很容易,所以以下是可以檢查的根據(2026 年 11 月 1 日實測):

  • 原始碼裡沒有任何 PHP 檔。 整個專案是 HTML、JavaScript、Markdown,加上本機用來產生頁面的 Python 與 Node 腳本,.php 檔案數是 0。
  • 網站是放在 Cloudflare Pages 的靜態檔案。 你打開一個工具頁,收到的是事先產生好的 HTML 檔,伺服器端不會為你執行任何程式。直接請求 https://localpapa.com/index.php、/wp-login.php 都回 404(不存在);用 PHP2Shell 那種巢狀欄位名稱的表單對首頁送出 POST,回的是 405(不接受這種請求)。根本沒有 PHP 會去解析那份表單。
  • 伺服器端只有兩段 JavaScript 小程式,跑在 Cloudflare Workers 上:一段是首頁的意見回饋表單,只接受 JSON 格式,而且要先通過 Cloudflare Turnstile 人機驗證;另一段讓內部文件路徑 /docs/ 一律回 404。它們不是 PHP,也不經過 PHP。

這不是運氣。LocalPapa 從一開始的原則就是檔案和資料留在你的裝置上:圖片壓縮、PDF 處理、八字排盤,全都在你的瀏覽器裡算。伺服器什麼都不必做,所以不需要伺服器程式;不存在的程式,就不會有漏洞。

但「這次不受影響」不等於「沒有風險」。我們的風險在別的地方,而且我們一樣要顧:

  • 帳號:GitHub(原始碼)與 Cloudflare(部署)帳號若被盜,攻擊者可以直接換掉網站內容。
  • 第三方腳本:Google Analytics、AdSense 與少數從 CDN 載入的函式庫,是在你瀏覽器裡執行的別人的程式。
  • 本機的建置工具:Python 與 Node 套件屬於供應鏈的一環。

PHP2Shell 跟我們無關,下一個漏洞就不一定了。

哪些軟體有風險

PHP 官方的說法是:所有處理網頁請求的 PHP 安裝都在範圍內,不論是 Apache mod_php(風險最高)、PHP-FPM、php-cgi、LiteSpeed 還是 FrankenPHP;8.5.12、8.4.27、8.3.36、8.2.35 之前的版本都算受影響,連早已停止支援的 PHP 5 也不例外。

下表整理各類常見軟體的狀況,資料截至 2026 年 10 月 28~30 日,各廠商狀態每天在變,請以廠商自己的公告為準。

類別 例子 狀況與該注意的事
網站與 CMSWordPress、Drupal、Joomla、Nextcloud、HumHub、自己寫的 PHP 網站漏洞在 PHP,更新 WordPress 本身沒用,要更新的是主機上的 PHP
虛擬主機與主機面板cPanel、Plesk、DirectAdmin、CyberPanel、CloudLinux多已推出修補,cPanel、Plesk 連已停止支援的 PHP 7.4~8.1 都出了修補版
雲端託管AWS Elastic Beanstalk、Azure App Service、Heroku、WordPress.com、Kinsta、WP Engine平台多已修好;你自己打包的容器(如 Cloud Run)要自己重建
家用/辦公室 NASQNAP、Synology、TerraMaster、UnraidQNAP 系統本體已修,但 Note Station 3、QuMagie 等部分 App 仍受影響;Synology 停止支援的 PHP 7.3 套件受影響;TerraMaster TOS 6 有用網頁伺服器功能的要升到 TOS 7
防火牆與網通設備的管理頁面Palo Alto PAN-OS、Juniper J-Web、Check Point、Cisco Expressway、pfSense、OPNsensePAN-OS 已確認遭實際攻擊;管理介面不該對網際網路開放
電話總機FreePBX、PBXact、VitalPBXFreePBX 17 已修;VitalPBX 4.0 仍附帶未修補的 PHP 8.1
開發環境XAMPP、WampServer、Laragon、MAMP、Laravel Herd、Docker 官方 PHP 映像都已出修補版;Docker 要重新拉映像並重建容器,舊容器不會自己變安全

荷蘭國家網路安全中心(NCSC-NL)在 GitHub 上維護一份追蹤清單,10 月 30 日的統計:追蹤 929 項產品,其中 217 項確認受影響、165 項已修補、345 項還在調查、201 項不受影響。「還在調查」的比「已修補」多,代表很多設備的修補還沒出來。

相對地,純靜態網站(GitHub Pages、Cloudflare Pages 的靜態部分、Netlify 等)不執行 PHP,不在範圍內。

你該做什麼

如果你只是上網的一般使用者:瀏覽別人的網站不會讓你的電腦中毒,風險在那個網站的伺服器和你存在上面的資料。你能做的是:

  • 檢查家裡的 NAS、路由器、防火牆有沒有新韌體或 App 更新。
  • 不要把這些設備的管理頁面開放到網際網路,需要遠端管理就用 VPN。

如果你有 WordPress 或用虛擬主機架站:

  • 在 WordPress 後台「工具 → 網站健康狀態 → 資訊 → 伺服器」可以看到 PHP 版本。
  • 直接問主機商是否已套用 10 月 21 日的 PHP 安全更新。 版本號不一定準:CloudLinux 等業者是把修補「移植」到舊版本上,修好之後版本號可能還是舊的。

如果你自己管伺服器或 VPS:

  • 從發行版(Ubuntu、Debian、RHEL 等都已推出)安裝修補後的 PHP 套件,然後重新啟動所有 PHP 工作程序(PHP-FPM、Apache)。只更新檔案不重啟,跑著的還是舊程式。
  • PHP 8.1 以下官方已不再修補,要升級或找提供長期支援的廠商。PHP 8.2 也將在 2026 年 12 月 31 日停止支援。
  • 暫時無法更新時,PHP 官方列了幾項只能降低風險、不能取代更新的設定:關閉上傳進度追蹤 session.upload_progress.enabled=0;PHP 8.5 另外設 fatal_error_backtraces=0;限制 post_max_size。這些要寫在 php.ini 或 FPM 設定裡並重啟,用 ini_set() 或 .user.ini 設定無效。
  • Cloudflare 等 WAF 已加上攔截規則(Cloudflare 連免費方案都有),但這是多一層防護,不是修補:攻擊者如果知道你伺服器的真實位址,可以繞過 WAF 直接連。
  • 檢查是否已被入侵,從 10 月 17 日開始回溯日誌:短時間內出現多筆 Allowed memory size ... exhausted 且位置是 Unknown on line 0 的錯誤(代表在程式執行前就失敗)、Apache 的 segfault 紀錄、網頁伺服器程序開出 shell。

另一個漏洞:CVE-2026-115560

10 月 23 日 PHP 另外公告了 CVE-2026-115560。它也和「上傳進度追蹤」有關,但觸發條件窄很多:網站必須在設定裡用 php_binary 或 php_serialize 格式存 session,又在程式執行時用 ini_set() 改回 php 格式,而且上傳進度追蹤沒關。10 月 21 日的更新沒有修到這個,官方會在下一次例行更新處理。在那之前的建議同樣是 session.upload_progress.enabled=0;如果你已經為 PHP2Shell 關掉了,就維持關閉。截至 10 月 26 日,還沒有它遭實際攻擊的報告。

最後

這次的漏洞讓我們重新確認一件事:最安全的程式,是不需要存在的程式。

LocalPapa 不受影響,不是因為我們修得快,而是因為「資料留在你的裝置上」這個設計,讓伺服器根本不需要處理你的東西。如果你也在做網站,值得問自己:這個功能真的需要伺服器嗎?能在瀏覽器裡做完的,就少一個要顧的漏洞。

參考資料

Security Note: PHP2Shell — Who Is at Risk, and Why LocalPapa Is Not

This is the thirty-second post on LocalPapa Notes. No new tool this time — instead, a security story: on 21 October 2026, PHP shipped an emergency security release for two vulnerabilities that have become known as PHP2Shell.

The short version:

  • LocalPapa does not use PHP and is not affected. There is nothing you need to do on this site. Below is how we checked.
  • But there is a good chance something around you does run PHP: a WordPress site, the NAS at home, the firewall's admin page at work, an office phone system. That is what this post is really about.

What happened

PHP is a language for writing web servers. WordPress, Drupal, Nextcloud, most hosting control panels and the admin pages of many network appliances are built on it. These two flaws are serious for three reasons:

  1. No login required. Anyone who can reach the site can try.
  2. The site does not have to contain a bug. The flaw is in PHP itself, so careful application code does not help.
  3. They allow remote code execution — in effect, control of the server. Hence the name: from PHP to a shell.

PHP rated both 9.2 out of 10 on CVSS v4.0. Assessments differ somewhat — Red Hat scored them 8.1 — but nobody calls them minor.

Date (2026) Event
17 OctAWS reports exploitation attempts, four days before disclosure
20 OctDetails leak on social media; PHP posts an advance notice
21 OctPHP ships 8.5.12, 8.4.27, 8.3.36 and 8.2.35; exploitation and mass scanning seen the same day
23 OctPHP announces a related but separate flaw, CVE-2026-115560 (see below)
26 OctUS CISA adds CVE-2026-109618 to its Known Exploited Vulnerabilities catalog
29 OctPalo Alto Networks confirms attackers chaining it with a Linux kernel privilege escalation to get root on internet-exposed firewall management interfaces

Palo Alto's Unit 42 estimated, from its own telemetry, more than 22.6 million internet-facing PHP instances that are potentially vulnerable.

The two flaws in plain words

CVE-2026-109618: running out of memory leaves half-built data behind. When PHP reads a submitted form ($_POST), it puts each field into an internal table. Researchers found that the table's entry count is incremented before memory for the new entry is allocated. If memory runs out at exactly that point, PHP aborts — but the count already includes an entry that was never set up. Cleanup later treats that entry as real, which gives an attacker a way to steer the program. A form with an extremely long, deeply nested field name is enough to make memory run out at that step on purpose.

CVE-2026-109619: leftovers from one request are used by the next. A PHP worker handles many requests in a row. Some worker-wide records point at memory owned by a single request. If a fatal error interrupts cleanup, those records survive and the next request reads memory that has already been freed. Two paths are confirmed: session upload progress (on by default, and active even if the site never uses sessions), and the fatal-error backtraces added in PHP 8.5.

What they share: both happen before the site's own code runs. Login pages, password protection and security plugins cannot stop them, because they never get a turn.

Why LocalPapa is not affected

Saying "we're not affected" is easy, so here is what can be checked (tested on 1 November 2026):

  • There is not a single PHP file in the source. The project is HTML, JavaScript and Markdown, plus Python and Node scripts that generate pages on our machine. The count of .php files is zero.
  • The site is static files on Cloudflare Pages. When you open a tool, you receive a pre-built HTML file; no code runs on a server for you. Requests for https://localpapa.com/index.php and /wp-login.php return 404 (not found). Posting a form with PHP2Shell-style nested field names to the home page returns 405 (method not allowed). There is no PHP to parse that form.
  • The only server-side code is two small JavaScript functions on Cloudflare Workers: one is the feedback form on the home page, which only accepts JSON and requires a Cloudflare Turnstile check first; the other makes the internal /docs/ path always return 404. Neither is PHP or goes through PHP.

This is not luck. LocalPapa's founding rule is that your files and data stay on your device: image compression, PDF processing, Bazi charts all run in your browser. The server has nothing to do, so there is no server program — and code that does not exist cannot have vulnerabilities.

But "not affected this time" is not "no risk". Our risks sit elsewhere, and we have to watch them just the same:

  • Accounts: if the GitHub (source) or Cloudflare (deployment) account were taken over, an attacker could replace the site outright.
  • Third-party scripts: Google Analytics, AdSense and a few CDN libraries are other people's code running in your browser.
  • Local build tools: Python and Node packages are part of the supply chain.

PHP2Shell has nothing to do with us. The next one might.

Which software is at risk

PHP's own wording: every PHP installation that serves web requests is in scope — Apache mod_php (highest risk), PHP-FPM, php-cgi, LiteSpeed or FrankenPHP. Every release before 8.5.12, 8.4.27, 8.3.36 and 8.2.35 counts as affected, including the long-unsupported PHP 5.

The table below summarises common software. It reflects 28–30 October 2026; vendor status changes daily, so always check the vendor's own advisory.

Category Examples Status and what to watch
Websites and CMSsWordPress, Drupal, Joomla, Nextcloud, HumHub, your own PHP siteThe flaw is in PHP, so updating WordPress itself does nothing — the server's PHP has to be updated
Shared hosting and panelscPanel, Plesk, DirectAdmin, CyberPanel, CloudLinuxMostly patched; cPanel and Plesk even shipped fixes for the unsupported PHP 7.4–8.1
Cloud hostingAWS Elastic Beanstalk, Azure App Service, Heroku, WordPress.com, Kinsta, WP EnginePlatforms mostly fixed; containers you build yourself (e.g. Cloud Run) are yours to rebuild
Home / office NASQNAP, Synology, TerraMaster, UnraidQNAP's OS is fixed but some apps (Note Station 3, QuMagie…) are still affected; Synology's end-of-life PHP 7.3 package is affected; TerraMaster TOS 6 with the web server feature must move to TOS 7
Firewall and network admin pagesPalo Alto PAN-OS, Juniper J-Web, Check Point, Cisco Expressway, pfSense, OPNsensePAN-OS confirmed exploited in the wild; admin interfaces should never be open to the internet
Phone systemsFreePBX, PBXact, VitalPBXFreePBX 17 is fixed; VitalPBX 4.0 still ships an unpatched PHP 8.1
Development setupsXAMPP, WampServer, Laragon, MAMP, Laravel Herd, Docker official PHP imagesAll have patched builds; with Docker you must pull the new image and rebuild — old containers do not fix themselves

The Dutch National Cyber Security Centre (NCSC-NL) keeps a tracker on GitHub. On 30 October it listed 929 products: 217 confirmed vulnerable, 165 fixed, 345 still under investigation, 201 not affected. More are "under investigation" than "fixed" — many devices are still waiting for a patch.

By contrast, purely static sites (GitHub Pages, the static part of Cloudflare Pages, Netlify and the like) do not run PHP and are out of scope.

What you should do

If you just browse the web: visiting someone else's site does not infect your computer; the risk is to that site's server and whatever data of yours it holds. What you can do:

  • Check your NAS, router and firewall for firmware or app updates.
  • Do not expose their admin pages to the internet. Use a VPN for remote management.

If you run WordPress or use shared hosting:

  • WordPress shows the PHP version under Tools → Site Health → Info → Server.
  • Ask your host directly whether the 21 October PHP security release has been applied. The version number can mislead: vendors like CloudLinux backport the fix, so a patched server may still report an old-looking version.

If you manage your own server or VPS:

  • Install the patched PHP packages from your distribution (Ubuntu, Debian, RHEL and others have shipped them), then restart every PHP worker (PHP-FPM, Apache). Updating files without restarting leaves the old code running.
  • PHP 8.1 and older no longer get fixes upstream; upgrade or use an LTS vendor. PHP 8.2 itself reaches end of life on 31 December 2026.
  • If you cannot update yet, PHP lists settings that reduce exposure but do not replace the update: disable upload progress with session.upload_progress.enabled=0; on PHP 8.5 also set fatal_error_backtraces=0; limit post_max_size. Put them in php.ini or the FPM config and restart — ini_set() and .user.ini do not work for this.
  • WAFs such as Cloudflare's have added blocking rules (even on Cloudflare's free plan), but that is an extra layer, not a fix: an attacker who knows your server's real address can go around the WAF.
  • To check for compromise, review logs back to 17 October: several Allowed memory size ... exhausted errors at Unknown on line 0 (failure before any script ran), Apache segfault entries, and web server processes spawning a shell.

The other one: CVE-2026-115560

On 23 October PHP announced CVE-2026-115560. It also involves upload progress, but the conditions are much narrower: the site stores sessions in the php_binary or php_serialize format, switches to the php format at runtime with ini_set(), and leaves upload progress enabled. The 21 October release does not fix it; PHP will address it in the next regular release. Until then the advice is again session.upload_progress.enabled=0 — if you already turned it off for PHP2Shell, leave it off. As of 26 October no exploitation had been reported.

Finally

This episode confirmed something for us: the safest code is the code you never needed to write.

LocalPapa is not affected because of a design choice, not a fast patch: keeping data on your device means the server never has to handle your things. If you build websites too, it is worth asking: does this feature really need a server? Everything that can be finished in the browser is one less thing to patch.

References

探索 69 個隱私優先的瀏覽器工具
全程本地運算、檔案不上傳。
前往 LocalPapa →
Explore 69 privacy-first browser tools
Everything runs locally — your files never leave your device.
Visit LocalPapa →

想看英文版?點右上角 EN 切換語言。

Prefer Chinese? Tap 中 at the top-right to switch.