Repository navigation
fix: PHP2Shell workaround, upgrade PHP in DDEV web images on workspace start - #222
Merged
Merged
Conversation
…e start PHP2Shell (CVE-2026-109618/CVE-2026-109619) allows unauthenticated RCE against any PHP serving web requests. Workspaces can share their sites publicly (drupal_site_public, freeform public sharing), so they are exposed. The coder-ddev image itself has no PHP; the vulnerable PHP is in the ddev-webserver image pulled inside each workspace, and no fixed DDEV release exists until v1.25.5. Following https://ddev.com/blog/php2shell-what-ddev-users-need-to-know/, each template now writes .ddev/web-build/Dockerfile.php2shell on every start, which runs `apt-get install --only-upgrade 'php*'` when the web image is built: - drupal-core / drupal-contrib: written next to config.coder.yaml, so the startup `ddev start` rebuilds with fixed PHP. - freeform: written into every project in `ddev list`; takes effect on each project's next `ddev start`/`ddev restart`. Dockerfile.php2shell is added to ~/.gitignore_global (and the image's copy) so it does not appear as untracked in core/contrib clones. Remove these steps after upgrading the image to DDEV v1.25.5. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Issue
PHP2Shell (CVE-2026-109618 / CVE-2026-109619) lets a single unauthenticated request run code on any PHP that serves web requests. Fixed PHP is 8.5.12, 8.4.27, 8.3.36 and 8.2.35, released 2026-10-21.
DDEV's guidance (blog post) says local-only projects are not exposed. Coder workspaces can serve sites publicly, though:
drupal_site_publicin drupal-core/drupal-contrib, and public project sharing in freeform. That is the exposed "casual hosting" case.The coder-ddev image itself has no PHP (
/usr/local/bin/phpwrapsddev php). The vulnerable PHP is in theddev-webserverimage pulled inside each workspace. No DDEV release includes the fix yet; v1.25.5 is expected 2026-10-22.How This PR Solves The Issue
This applies the blog's interim workaround for amd64, which is what the coder hosts run. On every workspace start, each template writes
.ddev/web-build/Dockerfile.php2shell:config.coder.yaml, so theddev startin startup rebuilds the web image with fixed PHP.ddev list -j. It takes effect on each project's nextddev startorddev restart.Dockerfile.php2shellis appended to~/.gitignore_globalon every start, and added to the image's copy, so it doesn't show as untracked in core and contrib clones.Rollout
make push-all-templates. Existing workspaces then show "update available". They pick up the fix only after the owner updates the workspace, because a stop/start alone re-runs the old template version.VERSIONtov0.6, sopull_triggersactually repulls the image, rebuild the image, and remove these steps. Comments in the code mark what to delete.Manual Testing Instructions
ddev php -v. It should show 8.3.36 or 8.4.27 (depending on the project's PHP version).git statusin the core checkout..ddev/web-build/Dockerfile.php2shellshould not be listed.ddev restartandddev php -vin the project.Automated Testing Overview
make validateandmake test-templatespass (13, 13 and 18 tests). This change is shell insidestartup_script, so the terraform tests don't exercise it. I dry-ran the freeformddev list -j | jqloop locally against sample output: it skips projects without a.ddevdirectory and does nothing when the list is empty.Release/Deployment Notes
Temporary. A project's first start after updating takes a bit longer because of the
apt-get updateand PHP upgrade in the web build; later starts use Docker's cache.🤖 Generated with Claude Code