The SentinelOne Annual Threat Report - A Defenders Guide from the FrontlinesThe SentinelOne Annual Threat ReportGet the Report
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
    • 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-40674

CVE-2022-40674: Libexpat Use-After-Free Vulnerability

CVE-2022-40674 is a use-after-free vulnerability in Libexpat affecting versions before 2.4.9. This memory corruption flaw in the doContent function poses security risks. This article covers technical details, impact, and mitigation.

Published: February 11, 2026

CVE-2022-40674 Overview

CVE-2022-40674 is a use-after-free vulnerability affecting libexpat, a widely-used XML parsing library, in versions prior to 2.4.9. The flaw exists in the doContent function within xmlparse.c, where memory that has been freed can subsequently be accessed, leading to potential memory corruption. This type of vulnerability can be exploited remotely over a network to compromise the confidentiality, integrity, and availability of affected systems.

Critical Impact

A use-after-free condition in libexpat's XML parsing functionality could allow remote attackers to execute arbitrary code or cause denial of service by crafting malicious XML content processed by applications using vulnerable versions of the library.

Affected Products

  • libexpat_project libexpat (versions before 2.4.9)
  • Debian Linux 10.0 and 11.0
  • Fedora 35, 36, and 37

Discovery Timeline

  • 2022-09-14 - CVE-2022-40674 published to NVD
  • 2025-05-30 - Last updated in NVD database

Technical Details for CVE-2022-40674

Vulnerability Analysis

This vulnerability is classified as CWE-416 (Use After Free), a memory corruption flaw that occurs when a program continues to use a pointer after the memory it references has been deallocated. In the context of libexpat, the vulnerability resides in the doContent function responsible for processing XML content during parsing operations.

The use-after-free condition creates a dangerous scenario where freed memory may be reallocated for a different purpose while the original pointer remains in use. When the vulnerable code path accesses this dangling pointer, it may read corrupted data, write to memory now owned by another part of the program, or trigger exploitable conditions that could lead to arbitrary code execution.

The network-based attack vector means that any application using libexpat to parse XML data received from untrusted sources—such as web services, API endpoints, or file uploads—could be vulnerable to exploitation.

Root Cause

The root cause lies in improper memory management within the doContent function in xmlparse.c. The function fails to properly track the lifecycle of memory allocations during XML content parsing. Specifically, a memory region is freed while references to it still exist and may be subsequently used, creating a classic use-after-free scenario. This typically occurs when parsing specially crafted XML documents that trigger specific code paths where the memory deallocation and subsequent access occur.

Attack Vector

An attacker can exploit this vulnerability by supplying a maliciously crafted XML document to an application that uses a vulnerable version of libexpat for parsing. The attack is network-based, meaning it can be triggered remotely without requiring authentication or user interaction.

The exploitation typically involves:

  1. Crafting an XML document that triggers the specific parsing path in doContent
  2. Causing memory to be freed prematurely while maintaining a reference
  3. Triggering reallocation of the freed memory with attacker-controlled content
  4. Accessing the dangling pointer to achieve code execution or cause a crash

The vulnerability mechanism resides in the doContent function within xmlparse.c. For detailed technical analysis of the memory management issue, refer to GitHub Pull Request #629 and GitHub Pull Request #640 which contain the patches addressing this vulnerability.

Detection Methods for CVE-2022-40674

Indicators of Compromise

  • Unexpected crashes or segmentation faults in applications using libexpat for XML parsing
  • Abnormal memory consumption patterns in XML processing services
  • Core dumps indicating memory corruption in xmlparse.c or related libexpat functions
  • Suspicious XML documents with unusual or malformed content structures in application logs

Detection Strategies

  • Implement version checking to identify systems running libexpat versions prior to 2.4.9
  • Deploy memory sanitizer tools (AddressSanitizer, Valgrind) in development and testing environments to detect use-after-free conditions
  • Monitor application logs for crashes or errors originating from XML parsing operations
  • Use SentinelOne's Singularity Platform to detect and prevent exploitation attempts targeting memory corruption vulnerabilities

Monitoring Recommendations

  • Enable crash reporting and analysis for applications that depend on libexpat
  • Implement network traffic monitoring for suspicious XML payloads targeting known parsing vulnerabilities
  • Conduct regular vulnerability scans to identify unpatched libexpat installations across your infrastructure
  • Monitor system resource utilization for anomalies that may indicate exploitation attempts

How to Mitigate CVE-2022-40674

Immediate Actions Required

  • Upgrade libexpat to version 2.4.9 or later across all affected systems immediately
  • Identify all applications and services that depend on libexpat and prioritize patching based on exposure
  • Review network exposure of XML parsing services and implement additional access controls where possible
  • Apply operating system vendor patches from Debian, Fedora, and other distributions that have released security updates

Patch Information

The libexpat project has addressed this vulnerability in version 2.4.9. The fixes are documented in GitHub Pull Request #629 and GitHub Pull Request #640. Multiple Linux distributions have released security updates:

  • Debian: Security Advisory DSA-5236
  • Gentoo: GLSA 202209-24 and GLSA 202211-06
  • Fedora: Multiple package announcements available via Fedora mailing lists
  • NetApp: Security Advisory ntap-20221028-0008

Workarounds

  • Restrict XML parsing to trusted sources only until patches can be applied
  • Implement input validation and sanitization for XML content before processing
  • Consider using application-level firewalls or web application firewalls to filter potentially malicious XML payloads
  • Isolate XML processing services using containerization or network segmentation to limit blast radius
bash
# Check installed libexpat version on Debian/Ubuntu
dpkg -l | grep libexpat

# Update libexpat on Debian/Ubuntu
sudo apt update && sudo apt install --only-upgrade libexpat1

# Check installed version on RHEL/CentOS/Fedora
rpm -qa | grep expat

# Update expat on Fedora
sudo dnf update expat

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

  • Vulnerability Details
  • TypeUse After Free

  • Vendor/TechLibexpat

  • SeverityHIGH

  • CVSS Score8.1

  • EPSS Probability0.91%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
  • Impact Assessment
  • ConfidentialityHigh
  • IntegrityNone
  • AvailabilityHigh
  • CWE References
  • CWE-416
  • Technical References
  • Debian LTS Announcement

  • Fedora Package Announcement

  • Fedora Package Announcement

  • Fedora Package Announcement

  • Fedora Package Announcement

  • Fedora Package Announcement

  • Gentoo GLSA 2022-09-24

  • Gentoo GLSA 2022-11-06

  • NetApp Security Advisory ntap-20221028-0008

  • Debian Security Advisory DSA-5236
  • Vendor Resources
  • GitHub Pull Request #629

  • GitHub Pull Request #640
  • Related CVEs
  • CVE-2022-43680: Libexpat Use-After-Free Vulnerability

  • CVE-2026-32778: Libexpat NULL Pointer Dereference Flaw

  • CVE-2026-32777: Libexpat DOS Vulnerability

  • CVE-2026-32776: Libexpat NULL Pointer Dereference 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