Join the Cyber Forum: Threat Intel on May 12, 2026 to learn how AI is reshaping threat defense.Join the Virtual Cyber Forum: Threat IntelRegister Now
Experiencing a Breach?Blog
Get StartedContact Us
SentinelOne
  • Platform
    Platform Overview
    • Singularity Platform
      Welcome to Integrated Enterprise Security
    • AI for Security
      Leading the Way in AI-Powered Security Solutions
    • Securing AI
      Accelerate AI Adoption with Secure AI Tools, Apps, and Agents.
    • How It Works
      The Singularity XDR Difference
    • Singularity Marketplace
      One-Click Integrations to Unlock the Power of XDR
    • Pricing & Packaging
      Comparisons and Guidance at a Glance
    Data & AI
    • Purple AI
      Accelerate SecOps with Generative AI
    • Singularity Hyperautomation
      Easily Automate Security Processes
    • AI-SIEM
      The AI SIEM for the Autonomous SOC
    • AI Data Pipelines
      Security Data Pipeline for AI SIEM and Data Optimization
    • Singularity Data Lake
      AI-Powered, Unified Data Lake
    • Singularity Data Lake for Log Analytics
      Seamlessly Ingest Data from On-Prem, Cloud or Hybrid Environments
    Endpoint Security
    • Singularity Endpoint
      Autonomous Prevention, Detection, and Response
    • Singularity XDR
      Native & Open Protection, Detection, and Response
    • Singularity RemoteOps Forensics
      Orchestrate Forensics at Scale
    • Singularity Threat Intelligence
      Comprehensive Adversary Intelligence
    • Singularity Vulnerability Management
      Application & OS Vulnerability Management
    • Singularity Identity
      Identity Threat Detection and Response
    Cloud Security
    • Singularity Cloud Security
      Block Attacks with an AI-Powered CNAPP
    • Singularity Cloud Native Security
      Secure Cloud and Development Resources
    • Singularity Cloud Workload Security
      Real-Time Cloud Workload Protection Platform
    • Singularity Cloud Data Security
      AI-Powered Threat Detection for Cloud Storage
    • Singularity Cloud Security Posture Management
      Detect and Remediate Cloud Misconfigurations
    Securing AI
    • Prompt Security
      Secure AI Tools Across Your Enterprise
  • Why SentinelOne?
    Why SentinelOne?
    • Why SentinelOne?
      Cybersecurity Built for What’s Next
    • Our Customers
      Trusted by the World’s Leading Enterprises
    • Industry Recognition
      Tested and Proven by the Experts
    • About Us
      The Industry Leader in Autonomous Cybersecurity
    Compare SentinelOne
    • Arctic Wolf
    • Broadcom
    • CrowdStrike
    • Cybereason
    • Microsoft
    • Palo Alto Networks
    • Sophos
    • Splunk
    • Trellix
    • Trend Micro
    • Wiz
    Verticals
    • Energy
    • Federal Government
    • Finance
    • Healthcare
    • Higher Education
    • K-12 Education
    • Manufacturing
    • Retail
    • State and Local Government
  • Services
    Managed Services
    • Managed Services Overview
      Wayfinder Threat Detection & Response
    • Threat Hunting
      World-Class Expertise and Threat Intelligence
    • Managed Detection & Response
      24/7/365 Expert MDR Across Your Entire Environment
    • Incident Readiness & Response
      DFIR, Breach Readiness, & Compromise Assessments
    Support, Deployment, & Health
    • Technical Account Management
      Customer Success with Personalized Service
    • SentinelOne GO
      Guided Onboarding & Deployment Advisory
    • SentinelOne University
      Live and On-Demand Training
    • Services Overview
      Comprehensive Solutions for Seamless Security Operations
    • SentinelOne Community
      Community Login
  • Partners
    Our Network
    • MSSP Partners
      Succeed Faster with SentinelOne
    • Singularity Marketplace
      Extend the Power of S1 Technology
    • Cyber Risk Partners
      Enlist Pro Response and Advisory Teams
    • Technology Alliances
      Integrated, Enterprise-Scale Solutions
    • SentinelOne for AWS
      Hosted in AWS Regions Around the World
    • Channel Partners
      Deliver the Right Solutions, Together
    • SentinelOne for Google Cloud
      Unified, Autonomous Security Giving Defenders the Advantage at Global Scale
    • Partner Locator
      Your Go-to Source for Our Top Partners in Your Region
    Partner Portal→
  • Resources
    Resource Center
    • Case Studies
    • Data Sheets
    • eBooks
    • Reports
    • Videos
    • Webinars
    • Whitepapers
    • Events
    View All Resources→
    Blog
    • Feature Spotlight
    • For CISO/CIO
    • From the Front Lines
    • Identity
    • Cloud
    • macOS
    • SentinelOne Blog
    Blog→
    Tech Resources
    • SentinelLABS
    • Ransomware Anthology
    • Cybersecurity 101
  • About
    About SentinelOne
    • About SentinelOne
      The Industry Leader in Cybersecurity
    • Investor Relations
      Financial Information & Events
    • SentinelLABS
      Threat Research for the Modern Threat Hunter
    • Careers
      The Latest Job Opportunities
    • Press & News
      Company Announcements
    • Cybersecurity Blog
      The Latest Cybersecurity Threats, News, & More
    • FAQ
      Get Answers to Our Most Frequently Asked Questions
    • DataSet
      The Live Data Platform
    • S Foundation
      Securing a Safer Future for All
    • S Ventures
      Investing in the Next Generation of Security, Data and AI
  • Pricing
Get StartedContact Us
CVE Vulnerability Database
Vulnerability Database/CVE-2022-31629

CVE-2022-31629: PHP Cookie Prefix XSS Vulnerability

CVE-2022-31629 is a cookie security flaw in PHP versions before 7.4.31, 8.0.24, and 8.1.11 that allows attackers to bypass cookie prefix protections. This article covers the technical details, affected versions, and mitigation.

Published: February 18, 2026

CVE-2022-31629 Overview

CVE-2022-31629 is an input validation vulnerability affecting PHP versions before 7.4.31, 8.0.24, and 8.1.11. This security flaw enables network and same-site attackers to set a standard insecure cookie in the victim's browser which is then incorrectly treated as a __Host- or __Secure- cookie by PHP applications. This cookie prefix bypass undermines critical security mechanisms designed to protect cookie integrity and prevent session hijacking attacks.

Critical Impact

Attackers can bypass cookie security prefixes (__Host- and __Secure-), potentially enabling session hijacking, authentication bypass, and cross-site attacks against PHP web applications that rely on these cookie security mechanisms.

Affected Products

  • PHP versions before 7.4.31
  • PHP versions 8.0.x before 8.0.24
  • PHP versions 8.1.x before 8.1.11
  • Fedora 35, 36, and 37
  • Debian Linux 10.0 and 11.0

Discovery Timeline

  • 2022-09-28 - CVE-2022-31629 published to NVD
  • 2025-11-04 - Last updated in NVD database

Technical Details for CVE-2022-31629

Vulnerability Analysis

This vulnerability stems from improper input validation in PHP's cookie handling mechanism. The __Host- and __Secure- cookie prefixes were introduced as security measures defined in RFC 6265bis to provide additional protection for cookies. The __Host- prefix requires cookies to be set with the Secure attribute, have no Domain attribute, and have a Path of /. The __Secure- prefix requires cookies to be set with the Secure attribute.

The vulnerability allows attackers to craft cookies that bypass these security prefix validations. When a network attacker (such as one performing a man-in-the-middle attack) or a same-site attacker sets a standard insecure cookie, PHP applications incorrectly interpret it as a protected __Host- or __Secure- cookie. This breaks the trust model that applications rely upon when using these prefixed cookies for security-sensitive operations like session management and CSRF protection.

Root Cause

The root cause is classified under CWE-20 (Improper Input Validation) and CWE-1284 (Improper Validation of Specified Quantity in Input). PHP's cookie parsing logic fails to properly validate that cookies with security prefixes were actually set with the required security attributes. The parser accepts cookies that match the prefix naming convention without verifying the security context under which they were originally set, allowing attackers to inject malicious cookies that masquerade as secure ones.

Attack Vector

The attack vector is network-based and requires user interaction. An attacker positioned on the network path (e.g., via a compromised router, public WiFi, or DNS spoofing) can inject HTTP responses containing malicious cookies. Same-site attackers who control a subdomain or related domain can also exploit this vulnerability. The attack flow involves:

  1. The attacker intercepts or initiates an HTTP connection to the target user
  2. A malicious Set-Cookie header is injected with a cookie name beginning with __Host- or __Secure-
  3. The victim's browser stores the cookie without enforcing the prefix security requirements
  4. When the victim visits the legitimate PHP application, the application incorrectly trusts the attacker-controlled cookie

Since no public exploit code is currently available, the specific implementation details vary based on the attack scenario. For technical details on the vulnerability mechanism, refer to PHP Bug Report #81727.

Detection Methods for CVE-2022-31629

Indicators of Compromise

  • Unexpected or duplicate cookies with __Host- or __Secure- prefixes in application logs
  • Session inconsistencies or authentication anomalies that may indicate cookie manipulation
  • HTTP traffic containing Set-Cookie headers with security-prefixed cookies over non-HTTPS connections
  • User reports of session hijacking or unauthorized account access

Detection Strategies

  • Monitor web application logs for suspicious cookie patterns, particularly multiple cookies with identical security prefixes
  • Implement web application firewall (WAF) rules to detect and block attempts to set security-prefixed cookies from unauthorized sources
  • Deploy network intrusion detection systems (IDS) to identify HTTP response injection attempts
  • Audit PHP version inventory across all systems to identify vulnerable installations

Monitoring Recommendations

  • Enable verbose cookie logging in web servers and PHP applications to track cookie creation and modification
  • Implement session validation mechanisms that verify cookie integrity beyond prefix checking
  • Configure SIEM rules to alert on anomalous cookie-related activity patterns
  • Monitor for network-level attacks such as ARP spoofing or DNS hijacking that could enable this vulnerability

How to Mitigate CVE-2022-31629

Immediate Actions Required

  • Upgrade PHP immediately to version 7.4.31, 8.0.24, 8.1.11, or later depending on your PHP branch
  • Review application code that relies on __Host- or __Secure- cookie prefixes for security decisions
  • Implement additional session validation measures that do not solely rely on cookie prefixes
  • Ensure all cookie-sensitive communications occur exclusively over HTTPS with proper certificate validation

Patch Information

Security patches addressing this vulnerability are available from PHP and major Linux distributions. The official fix is documented in PHP Bug Report #81727. Distribution-specific advisories include:

  • Debian Security Advisory DSA-5277
  • Debian LTS Security Announcement
  • Gentoo GLSA-202211-03
  • NetApp Security Advisory

Workarounds

  • If immediate patching is not possible, implement server-side session validation that does not rely solely on cookie prefix security
  • Deploy a reverse proxy or WAF that can filter and validate cookies before they reach PHP applications
  • Enforce HTTPS-only communication with HTTP Strict Transport Security (HSTS) to reduce the attack surface for network-based attackers
  • Consider implementing additional cookie validation logic within the application layer as a defense-in-depth measure
bash
# Verify PHP version and upgrade on Debian/Ubuntu
php -v
sudo apt update && sudo apt install php8.1

# Verify PHP version and upgrade on RHEL/Fedora
php -v
sudo dnf update php

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

  • Vulnerability Details
  • TypeXSS

  • Vendor/TechPhp

  • SeverityMEDIUM

  • CVSS Score6.5

  • EPSS Probability16.95%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityHigh
  • AvailabilityNone
  • CWE References
  • CWE-20

  • NVD-CWE-noinfo

  • CWE-1284
  • Technical References
  • Openwall Security Discussion

  • Debian LTS Security Announcement

  • Fedora Package Announcement

  • Fedora Package Announcement

  • Fedora Package Announcement

  • Fedora Package Announcement

  • Fedora Package Announcement

  • Fedora Package Announcement

  • Gentoo GLSA Notification

  • NetApp Security Advisory

  • Debian Security Advisory DSA-5277

  • Fedora Package Announcement

  • Fedora Package Announcement
  • Vendor Resources
  • PHP Bug Report #81727
  • Related CVEs
  • CVE-2024-2756: PHP Cookie Prefix Bypass Vulnerability

  • CVE-2025-54017: Paid Member Subscriptions LFI Vulnerability

  • CVE-2025-46454: Meta Keywords & Description LFI Vulnerability

  • CVE-2026-29861: PHP-MYSQL User Login System SQLi Flaw
Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the World’s Most Advanced Cybersecurity Platform

See how our intelligent, autonomous cybersecurity platform can protect your organization now and into the future.

Try SentinelOne
  • Get Started
  • Get a Demo
  • Product Tour
  • Why SentinelOne
  • Pricing & Packaging
  • FAQ
  • Contact
  • Contact Us
  • Customer Support
  • SentinelOne Status
  • Language
  • Platform
  • Singularity Platform
  • Singularity Endpoint
  • Singularity Cloud
  • Singularity AI-SIEM
  • Singularity Identity
  • Singularity Marketplace
  • Purple AI
  • Services
  • Wayfinder TDR
  • SentinelOne GO
  • Technical Account Management
  • Support Services
  • Verticals
  • Energy
  • Federal Government
  • Finance
  • Healthcare
  • Higher Education
  • K-12 Education
  • Manufacturing
  • Retail
  • State and Local Government
  • Cybersecurity for SMB
  • Resources
  • Blog
  • Labs
  • Case Studies
  • Videos
  • Product Tours
  • Events
  • Cybersecurity 101
  • eBooks
  • Webinars
  • Whitepapers
  • Press
  • News
  • Ransomware Anthology
  • Company
  • About Us
  • Our Customers
  • Careers
  • Partners
  • Legal & Compliance
  • Security & Compliance
  • Investor Relations
  • S Foundation
  • S Ventures

©2026 SentinelOne, All Rights Reserved.

Privacy Notice Terms of Use

English