Compare commits

..
5 Commits
Author SHA1 Message Date
chrisandClaude Opus 5.5 50c5104130 mod_php_install.sh: validate httpd user/group and tmpfiles config.
Only accept apache user/group names that exist on the system. Validate
the new /etc/tmpfiles.d/php-fpm.conf with systemd-tmpfiles before
replacing the existing one, so an invalid entry (e.g. group '#') can no
longer prevent /run/php from being created at boot.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 13:00:06 +01:00
chrisandClaude Opus 5.5 5494ccc9df mod_php_install.sh: apply security patches for PHP 5.6.40.
Apply for PHP 5.6.40, in boa order: openssl3-pkey-export,
round-places-overflow, sury-105, xlts-1, xlts-2. All apply without fuzz
on top of the OpenSSL 1.1.0 compatibility patch and the php-5.6-*.patch
files.

Skip php-5.6-enhanced-universal.patch (php2shell) for 5.6.40: sury-105
brings its own backport of the CVE-2026-109618/109619 fix, the same fix
boa uses for 7.4/8.x. Both change the same code and exclude each other.

Tested on web-04 (Debian 13): build, install and php-fpm start OK.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 20:13:05 +01:00
chrisandClaude Opus 5.5 7b6bb066dc Add security patches for PHP 5.6.40.
From omega8cc/boa (5.x-dev, aegir/patches/php-sec):
php-5.6.40-openssl3-pkey-export.patch, php-5.6.40-round-places-overflow.patch,
php-5.6.40-sury-105.patch, php-5.6.40-xlts-1.patch, php-5.6.40-xlts-2.patch.

sury-105 contains the 5.6 backport of the CVE-2026-109618/109619 fix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 20:13:05 +01:00
chrisandClaude Opus 5.5 e73064d2b0 mod_php_install.sh: apply php-8.1.34-xlts-2.patch for PHP 8.1.34.
Applied after php-8.1.34-cve-2026-129291.patch and before
php-8.1.34-sury-9-re2c-generated.patch. The whole sequence applies
without fuzz or offset to php-8.1.34. xlts-2 changes no generated
files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 18:50:34 +01:00
chrisandClaude Opus 5.5 1e4b13746e Add security patch php-8.1.34-xlts-2.patch.
Raw patch from omega8cc/boa (5.x-dev, aegir/patches/php-sec).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 18:50:34 +01:00
7 changed files with 234655 additions and 13 deletions

No files matched your search

+99 -13
View File
@@ -671,14 +671,23 @@ echo "Insert User/Group for apache daemon (httpd)."
echo "" echo ""
echo "" echo ""
## - User and group are written into the pool configs and into
## - /etc/tmpfiles.d/php-fpm.conf, so only accept names that really exist
## - on this system (a stray character like '#' breaks /run/php at boot).
## -
HTTPD_USER= HTTPD_USER=
while [ "X$HTTPD_USER" = "X" ] while [ "X$HTTPD_USER" = "X" ]
do do
echononl "apache user [${_HTTPD_USER}]: " echononl "apache user [${_HTTPD_USER}]: "
read HTTPD_USER read -r HTTPD_USER
HTTPD_USER="$(echo "$HTTPD_USER" | tr -d '[:space:]')"
if [ "X$HTTPD_USER" = "X" ]; then if [ "X$HTTPD_USER" = "X" ]; then
HTTPD_USER=$_HTTPD_USER HTTPD_USER=$_HTTPD_USER
fi fi
if ! getent passwd "$HTTPD_USER" > /dev/null 2>&1 ; then
echo -e "\n\t\033[31mUser '$HTTPD_USER' does not exist on this system !! Try again..\033[m\n"
HTTPD_USER=
fi
done done
if [ -z "$_HTTPD_GROUP" ]; then if [ -z "$_HTTPD_GROUP" ]; then
if [ "$HTTPD_USER" = "nobody" ]; then if [ "$HTTPD_USER" = "nobody" ]; then
@@ -687,13 +696,19 @@ if [ -z "$_HTTPD_GROUP" ]; then
_HTTPD_GROUP=$HTTPD_USER _HTTPD_GROUP=$HTTPD_USER
fi fi
fi fi
HTTPD_GROUP=
while [ "X$HTTPD_GROUP" = "X" ] while [ "X$HTTPD_GROUP" = "X" ]
do do
echononl "apache group [$_HTTPD_GROUP]: " echononl "apache group [$_HTTPD_GROUP]: "
read HTTPD_GROUP read -r HTTPD_GROUP
HTTPD_GROUP="$(echo "$HTTPD_GROUP" | tr -d '[:space:]')"
if [ "X$HTTPD_GROUP" = "X" ]; then if [ "X$HTTPD_GROUP" = "X" ]; then
HTTPD_GROUP=$_HTTPD_GROUP HTTPD_GROUP=$_HTTPD_GROUP
fi fi
if ! getent group "$HTTPD_GROUP" > /dev/null 2>&1 ; then
echo -e "\n\t\033[31mGroup '$HTTPD_GROUP' does not exist on this system !! Try again..\033[m\n"
HTTPD_GROUP=
fi
done done
_PHP_FPM_USER=$HTTPD_USER _PHP_FPM_USER=$HTTPD_USER
@@ -6380,9 +6395,16 @@ fi
# - # -
# - Security fix: if it fails, abort - never build PHP 5.6 without it. # - Security fix: if it fails, abort - never build PHP 5.6 without it.
# - # -
# - NOT for 5.6.40: there 'php-5.6.40-sury-105.patch' (omega8cc/boa, see
# - below) brings its own backport of the CVE-2026-109618/109619 fix - the
# - same fix boa uses for 7.4/8.x (session upload progress disabled,
# - array_init_singleton, zend_mm_safe_error_ex, MIME header filter,
# - max_multipart_body_parts, ...). Both patches change the same code and
# - exclude each other: with this patch applied, sury-105 and xlts-2 fail.
# -
_patch_file="php-5.6-enhanced-universal.patch" _patch_file="php-5.6-enhanced-universal.patch"
echononl "\tApply ${_patch_file} (php2shell)" echononl "\tApply ${_patch_file} (php2shell)"
if [[ "$PHP_MAIN_VERSION" = "5.6" ]]; then if [[ "$PHP_MAIN_VERSION" = "5.6" ]] && [[ "$VERSION" != "5.6.40" ]]; then
if [[ -f "${_srcdir}/${_patch_file}" ]] ; then if [[ -f "${_srcdir}/${_patch_file}" ]] ; then
patch -d $_builddir -p1 < ${_srcdir}/${_patch_file} > $tmp_err_msg 2>&1 patch -d $_builddir -p1 < ${_srcdir}/${_patch_file} > $tmp_err_msg 2>&1
if [[ $? -eq 0 ]]; then if [[ $? -eq 0 ]]; then
@@ -6399,9 +6421,20 @@ else
echo_skipped echo_skipped
fi fi
# - Security patches for PHP 7.4.33, 8.0.30 and 8.1.34 # - Security patches for PHP 5.6.40, 7.4.33, 8.0.30 and 8.1.34
# - (source: omega8cc/boa, aegir/patches/php-sec) # - (source: omega8cc/boa, aegir/patches/php-sec)
# - # -
# - PHP 5.6.40 (boa order = glob order, applied with --fuzz=0 by boa):
# - php-5.6.40-openssl3-pkey-export.patch
# - php-5.6.40-round-places-overflow.patch
# - php-5.6.40-sury-105.patch (backports, Debian/sury; contains
# - the CVE-2026-109618/109619 fix)
# - php-5.6.40-xlts-1.patch
# - php-5.6.40-xlts-2.patch (needs sury-105 and xlts-1)
# - On top of 'PHP-5.6.31-OpenSSL-1.1.0-compatibility-20170801.patch' and
# - the php-5.6-*.patch files above all apply without fuzz (offsets only).
# - They change no generated files (Zend VM, re2c).
# -
# - PHP 7.4.33: # - PHP 7.4.33:
# - php-7.4.33-cve-2026-109618-109619.patch # - php-7.4.33-cve-2026-109618-109619.patch
# - php-7.4.33-sury-31.patch (backports from 8.x, Debian/sury) # - php-7.4.33-sury-31.patch (backports from 8.x, Debian/sury)
@@ -6426,6 +6459,7 @@ fi
# - php-8.1.34-cve-2026-109618-109619.patch # - php-8.1.34-cve-2026-109618-109619.patch
# - php-8.1.34-sury-9.patch (backports from 8.2.x, Debian/sury) # - php-8.1.34-sury-9.patch (backports from 8.2.x, Debian/sury)
# - php-8.1.34-cve-2026-129291.patch (php-fpm) # - php-8.1.34-cve-2026-129291.patch (php-fpm)
# - php-8.1.34-xlts-2.patch
# - php-8.1.34-sury-9-re2c-generated.patch # - php-8.1.34-sury-9-re2c-generated.patch
# - (own patch: the *.re hunks of sury-9 for pdo_sql_parser and # - (own patch: the *.re hunks of sury-9 for pdo_sql_parser and
# - url_scanner_ex applied to the generated *.c files, so the fixes # - url_scanner_ex applied to the generated *.c files, so the fixes
@@ -6444,6 +6478,14 @@ fi
# - Security fixes: if one fails, abort - never build PHP without them. # - Security fixes: if one fails, abort - never build PHP without them.
# - # -
case "$VERSION" in case "$VERSION" in
5.6.40)
_sec_patches="
php-5.6.40-openssl3-pkey-export.patch
php-5.6.40-round-places-overflow.patch
php-5.6.40-sury-105.patch
php-5.6.40-xlts-1.patch
php-5.6.40-xlts-2.patch"
;;
7.4.33) 7.4.33)
_sec_patches=" _sec_patches="
php-7.4.33-cve-2026-109618-109619.patch php-7.4.33-cve-2026-109618-109619.patch
@@ -6465,6 +6507,7 @@ case "$VERSION" in
php-8.1.34-cve-2026-109618-109619.patch php-8.1.34-cve-2026-109618-109619.patch
php-8.1.34-sury-9.patch php-8.1.34-sury-9.patch
php-8.1.34-cve-2026-129291.patch php-8.1.34-cve-2026-129291.patch
php-8.1.34-xlts-2.patch
php-8.1.34-sury-9-re2c-generated.patch" php-8.1.34-sury-9-re2c-generated.patch"
;; ;;
*) *)
@@ -6965,25 +7008,68 @@ if [[ "${FPM_RUN_DIR}" =~ ^/run/ ]] ; then
echo "" >> ${_logdir}/main.log echo "" >> ${_logdir}/main.log
echo "## - Force systemd to create run directory on each startup." >> ${_logdir}/main.log echo "## - Force systemd to create run directory on each startup." >> ${_logdir}/main.log
echo "## -" >> ${_logdir}/main.log echo "## -" >> ${_logdir}/main.log
echo "## - Create '/etc/tmpfiles.d/mysql.conf' with content:" >> ${_logdir}/main.log echo "## - Create '/etc/tmpfiles.d/php-fpm.conf' with content:" >> ${_logdir}/main.log
echo "## -" >> ${_logdir}/main.log echo "## -" >> ${_logdir}/main.log
echo "## - # systemd tmpfile settings for mysql or mariadb" >> ${_logdir}/main.log echo "## - # systemd tmpfile settings for php fpm" >> ${_logdir}/main.log
echo "## - d $FPM_RUN_DIR 0755 $FPM_DEFAULT_POOL_USER $FPM_DEFAULT_POOL_GROUP -" >> ${_logdir}/main.log echo "## - d $FPM_RUN_DIR 0755 $FPM_DEFAULT_POOL_USER $FPM_DEFAULT_POOL_GROUP -" >> ${_logdir}/main.log
echo "## -" >> ${_logdir}/main.log echo "## -" >> ${_logdir}/main.log
echo "" >> ${_logdir}/main.log echo "" >> ${_logdir}/main.log
echo "cat << EOF > /etc/tmpfiles.d/php-fpm.conf
# systemd tmpfile settings for php fpm ## - /etc/tmpfiles.d/php-fpm.conf is shared by all installed PHP versions.
d $FPM_RUN_DIR 0755 $FPM_DEFAULT_POOL_USER $FPM_DEFAULT_POOL_GROUP - ## - A broken entry (e.g. unknown user/group) makes systemd-tmpfiles skip
EOF" >> ${_logdir}/main.log ## - the line at boot, so /run/php is missing and no php-fpm starts.
cat <<EOF > /etc/tmpfiles.d/php-fpm.conf ## - Therefore: verify user/group, validate the new file with
## - systemd-tmpfiles and only then replace the existing one.
## -
_tmpfiles_conf="/etc/tmpfiles.d/php-fpm.conf"
_tmpfiles_ok=true
_tmpfiles_msg=""
if ! getent passwd "$FPM_DEFAULT_POOL_USER" > /dev/null 2>&1 ; then
_tmpfiles_ok=false
_tmpfiles_msg="User '$FPM_DEFAULT_POOL_USER' does not exist."
elif ! getent group "$FPM_DEFAULT_POOL_GROUP" > /dev/null 2>&1 ; then
_tmpfiles_ok=false
_tmpfiles_msg="Group '$FPM_DEFAULT_POOL_GROUP' does not exist."
fi
if $_tmpfiles_ok ; then
_tmpfiles_new="$(mktemp /tmp/php-fpm-tmpfiles.XXXXXX.conf)"
cat <<EOF > "$_tmpfiles_new"
# systemd tmpfile settings for php fpm # systemd tmpfile settings for php fpm
d $FPM_RUN_DIR 0755 $FPM_DEFAULT_POOL_USER $FPM_DEFAULT_POOL_GROUP - d $FPM_RUN_DIR 0755 $FPM_DEFAULT_POOL_USER $FPM_DEFAULT_POOL_GROUP -
EOF EOF
if [[ $? -eq 0 ]] ; then echo "cat << EOF > $_tmpfiles_conf" >> ${_logdir}/main.log
cat "$_tmpfiles_new" >> ${_logdir}/main.log
echo "EOF" >> ${_logdir}/main.log
if command -v systemd-tmpfiles > /dev/null 2>&1 ; then
echo "" >> ${_logdir}/main.log
echo "systemd-tmpfiles --create $_tmpfiles_new" >> ${_logdir}/main.log
_tmpfiles_out="$(systemd-tmpfiles --create "$_tmpfiles_new" 2>&1)"
_tmpfiles_rc=$?
[[ -n "$_tmpfiles_out" ]] && echo "$_tmpfiles_out" >> ${_logdir}/main.log
if [[ $_tmpfiles_rc -ne 0 ]] || [[ -n "$_tmpfiles_out" ]] ; then
_tmpfiles_ok=false
_tmpfiles_msg="systemd-tmpfiles rejected the new configuration: $_tmpfiles_out"
fi
fi
if $_tmpfiles_ok ; then
install -m 0644 -o root -g root "$_tmpfiles_new" "$_tmpfiles_conf" >> ${_logdir}/main.log 2>&1 || {
_tmpfiles_ok=false
_tmpfiles_msg="Installing '$_tmpfiles_conf' failed."
}
fi
rm -f "$_tmpfiles_new"
fi
if $_tmpfiles_ok ; then
echo_ok echo_ok
else else
echo_failed echo_failed
error "Creating file '/etc/tmpfiles.d/php-fpm.conf' failed!" echo "## - ERROR: $_tmpfiles_msg ('$_tmpfiles_conf' left unchanged)" >> ${_logdir}/main.log
error "Creating file '$_tmpfiles_conf' failed!\n\t $_tmpfiles_msg\n\t '$_tmpfiles_conf' was left unchanged - check it before rebooting!"
fi fi
fi fi
+22
View File
@@ -0,0 +1,22 @@
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index af376aa..5116a4a 100644
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -4001,6 +4001,9 @@ PHP_FUNCTION(openssl_pkey_export_to_file)
if (PHP_SSL_REQ_PARSE(&req, args) == SUCCESS) {
bio_out = BIO_new_file(filename, "w");
+ if (bio_out == NULL) {
+ goto clean_exit;
+ }
if (passphrase && req.priv_key_encrypt) {
if (req.priv_key_encrypt_cipher) {
@@ -4029,6 +4032,7 @@ PHP_FUNCTION(openssl_pkey_export_to_file)
RETVAL_TRUE;
}
}
+clean_exit:
PHP_SSL_REQ_DISPOSE(&req);
if (key_resource == -1 && key) {
+20
View File
@@ -0,0 +1,20 @@
--- a/ext/standard/math.c
+++ b/ext/standard/math.c
@@ -141,7 +141,7 @@
double tmp_value;
int precision_places;
- if (!php_math_is_finite(value)) {
+ if (!php_math_is_finite(value) || value == 0.0) {
return value;
}
@@ -153,7 +153,7 @@
/* If the decimal precision guaranteed by FP arithmetic is higher than
the requested places BUT is small enough to make sure a non-zero value
is returned, pre-round the result to the precision */
- if (precision_places > places && precision_places - places < 15) {
+ if (precision_places > places && precision_places - 15 < places) {
int64_t use_precision = precision_places < INT_MIN+1 ? INT_MIN+1 : precision_places;
f2 = php_intpow10(abs((int)use_precision));
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff