#!/bin/bash # Copyright 2026 Tailwind Resource Group # SPDX-License-Identifier: Apache-2.0 # Provided as is, with no warranty. License: https://everythingsfine.io/license/ # # bigip-php2shell-check.sh # # Read-only. Run in the BIG-IP advanced shell (bash) as root. # Reports the facts that decide your BIG-IP exposure to CVE-2026-109618 # and CVE-2026-109619 ("php2shell"): version, PHP fix, interim file, # APM and SSLO provisioning, and access to the Configuration utility. # It changes nothing. Compare the result with F5 article K000163821. set -u # Return 0 if version $1 is equal to or later than version $2. ver_ge() { local -a a b local i x y IFS=. read -r -a a <<< "$1" IFS=. read -r -a b <<< "$2" for i in 0 1 2 3; do x=${a[i]:-0} y=${b[i]:-0} if (( 10#$x > 10#$y )); then return 0; fi if (( 10#$x < 10#$y )); then return 1; fi done return 0 } ver=$(tmsh show sys version | awk '$1 == "Version" { print $2; exit }') edition=$(tmsh show sys version | awk '$1 == "Edition" { $1 = ""; sub(/^ /, ""); print; exit }') echo "Version: $ver ($edition)" case "$ver" in 17.1.*) fixed=17.1.3.7 ;; 17.5.*) fixed=17.5.1.11 ;; 21.1.*) fixed=21.1.0.4 ;; *) fixed="" ;; esac if ! [[ "$ver" =~ ^[0-9]+(\.[0-9]+){1,3}$ ]]; then echo "CHECK Cannot read the version." elif [ -z "$fixed" ]; then echo "CHECK This branch is not in the K000163821 tables that we read. Read K000163821." elif ver_ge "$ver" "$fixed"; then echo "FIXED $ver is $fixed or later." else echo "UPGRADE $ver is earlier than $fixed." fi echo echo "PHP package changelog entries for the CVEs:" rpm -q php --changelog 2>/dev/null | grep -E 'CVE-2026-10961[89]' || echo " none found" echo echo "Interim PHP settings (/etc/php.ini.d):" ls -l /etc/php.ini.d/ 2>/dev/null || echo " no /etc/php.ini.d directory" php -i 2>/dev/null | grep -E '^(Additional \.ini files parsed|memory_limit|post_max_size|upload_max_filesize|session\.upload_progress\.enabled) ' echo echo "Provisioning (APM or SSLO puts the unauthenticated path in scope):" for module in apm sslo; do tmsh list sys provision "$module" one-line 2>/dev/null done echo echo "Configuration utility access on the management port (K13309):" tmsh list sys httpd allow echo echo "Self IPs that permit HTTPS to the Configuration utility:" tmsh list net self allow-service one-line 2>/dev/null \ | grep -E 'allow-service (all|default|\{[^}]*(tcp:443|tcp:https)[^}]*\})' \ || echo " none"