Skip to content

Document PHP upload limits, one request per FPM worker - #163

Merged
gsanchietti merged 3 commits into
masterfrom
php_mitigation
Oct 22, 2026
Merged

gsanchietti merged 3 commits into
masterfrom
php_mitigation

Conversation

@gsanchietti

@gsanchietti gsanchietti commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

PHP published an advisory about two remote code execution vulnerabilities, CVE-2026-109618 and CVE-2026-109619 (https://www.php.net/archive/2026.php#2026-10-21-5). One of the official mitigations is to keep post_max_size at 32MB or lower when an application needs uploads. NethServer/dev#8256

Nextcloud already meets it: the packaged .user.ini sets no upload limits, so the pool runs with the PHP defaults post_max_size = 8M and upload_max_filesize = 2M (checked on a test server). Normal file uploads use WebDAV PUT and are not limited by these values. No setting changes, so this PR only documents in the README that post_max_size must not be raised over 32MB.

Session upload progress for Nextcloud is turned off by the php80 runtime package (NethServer/nethserver-remi-php80-php-fpm#2).

One request per PHP-FPM worker

GHSA-6wmf-4rv5-p3rp (GHSA-6wmf-4rv5-p3rp) describes an RCE chain through stale global state: state left by one request is consumed by the next request handled by the same worker. The advisory suggests limiting each worker to one request when performance is not the main concern, so the Nextcloud pool now sets pm.max_requests = 1.

Performance trade-off: every request is served by a fresh worker. pm = dynamic keeps spare workers ready, and opcache and APCu (memcache.local) shared memory live in the FPM master, so they survive worker recycling.

000-nextcloud.conf is %config(noreplace): on servers where it was edited, the update writes 000-nextcloud.conf.rpmnew and the setting must be added by hand. The README says so.

The nethserver-nextcloud-update event already restarts php80-php-fpm.

  • README.rst: new "PHP upload limits" and "PHP-FPM workers" sections
  • 000-nextcloud.conf: pm.max_requests = 1

How to test

  • After the update, grep max_requests /etc/opt/remi/php80/php-fpm.d/000-nextcloud.conf shows pm.max_requests = 1
  • Web login, file upload/download and desktop/mobile client sync still work
  • Two consecutive requests are served by different worker PIDs (e.g. watch ps -o pid,cmd -C php-fpm or a temporary getmypid() page)

Assisted-by: Claude Code:claude-opus-5-5, Claude Code:claude-sonnet-5-5

Set post_max_size to 32M and upload_max_filesize to 30M in the
Nextcloud php-fpm pool, as mitigation for CVE-2026-109618 and
CVE-2026-109619. The values are php_admin_value, so .user.ini cannot
raise them. Normal file uploads use WebDAV PUT and are not affected.

Document the limits and how to change them in README.

NethServer/dev#8256

Assisted-by: Claude Code:claude-sonnet-5-5
@gsanchietti gsanchietti self-assigned this Oct 21, 2026
@nethbot

nethbot commented Oct 21, 2026

Copy link
Copy Markdown
Member

in 7.9.2009/autobuild:

Nextcloud already runs with the PHP defaults post_max_size = 8M and
upload_max_filesize = 2M, which satisfy the PHP mitigation for
CVE-2026-109618 and CVE-2026-109619: the packaged .user.ini sets no
upload limits. Restore the original pool file and only document in
the README that post_max_size must not be raised over 32M.

Refs NethServer/dev#8256

Assisted-by: Claude Code:claude-opus-5-5
@gsanchietti gsanchietti changed the title Limit PHP POST size for Nextcloud pool Document 32MB cap for PHP upload limits Oct 22, 2026
@nethbot

nethbot commented Oct 22, 2026

Copy link
Copy Markdown
Member

in 7.9.2009/autobuild:

GHSA-6wmf-4rv5-p3rp (CVE-2026-109619) describes an RCE chain where
state left by one request is consumed by the next request handled by
the same PHP-FPM worker. Set pm.max_requests = 1 so every worker
serves one request and is then replaced. The cost of spawning a
worker per request is accepted: opcache shared memory lives in the
FPM master and survives worker recycling.

Refs NethServer/dev#8256

Assisted-by: Claude Code:claude-sonnet-5-5
@gsanchietti gsanchietti changed the title Document 32MB cap for PHP upload limits Document PHP upload limits, one request per FPM worker Oct 22, 2026
@nethbot

nethbot commented Oct 22, 2026

Copy link
Copy Markdown
Member

in 7.9.2009/autobuild:

@gsanchietti

Copy link
Copy Markdown
Member Author

Tested

@gsanchietti
gsanchietti merged commit 3958b00 into master Oct 22, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants