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
    • 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-2021-38171

CVE-2021-38171: FFmpeg Buffer Overflow Vulnerability

CVE-2021-38171 is a buffer overflow vulnerability in FFmpeg 4.4 affecting adts_decode_extradata function. Attackers can exploit crafted input to trigger undefined behavior. This article covers technical details, impact, and mitigations.

Published: February 25, 2026

CVE-2021-38171 Overview

CVE-2021-38171 is a critical input validation vulnerability in FFmpeg 4.4 that affects the adts_decode_extradata function within libavformat/adtsenc.c. The vulnerability stems from a missing return value check for the init_get_bits function, which allows attackers to craft malicious input that can lead to undefined behavior, memory corruption, or arbitrary code execution.

The flaw exists because the second argument to init_get_bits can be crafted by an attacker. Without proper validation of the return value, the function continues execution with potentially corrupted or uninitialized bit context data, creating opportunities for exploitation.

Critical Impact

This vulnerability allows remote attackers to potentially execute arbitrary code or cause denial of service through specially crafted media files processed by FFmpeg, affecting a wide range of applications that rely on FFmpeg for multimedia processing.

Affected Products

  • FFmpeg 4.4
  • Debian Linux 9.0
  • Debian Linux 10.0
  • Debian Linux 11.0

Discovery Timeline

  • 2021-08-21 - CVE-2021-38171 published to NVD
  • 2024-11-21 - Last updated in NVD database

Technical Details for CVE-2021-38171

Vulnerability Analysis

The vulnerability resides in the Audio Data Transport Stream (ADTS) encoder component of FFmpeg's libavformat library. The adts_decode_extradata function is responsible for parsing audio configuration data from the extradata buffer. This function calls init_get_bits to initialize a bitstream reader (GetBitContext) for parsing the MPEG4 audio configuration.

The core issue is that init_get_bits can fail under various conditions—such as when the buffer size is invalid or when memory allocation fails—but the original code did not check this return value. This oversight means the subsequent parsing operations using the uninitialized or improperly configured GetBitContext structure could read from unexpected memory locations, leading to out-of-bounds memory access, information disclosure, or memory corruption.

Given the network attack vector and the lack of required privileges or user interaction, this vulnerability is particularly concerning for server-side applications that process untrusted media files.

Root Cause

The root cause is classified under CWE-252 (Unchecked Return Value). The init_get_bits function returns an error code when initialization fails, but the original implementation in adts_decode_extradata ignored this return value entirely. This pattern of unchecked return values is a common source of security vulnerabilities, especially in C/C++ codebases where error handling is manual and must be explicitly implemented.

The function assumed that bit context initialization would always succeed, proceeding immediately to use the GetBitContext structure for parsing MPEG4 audio configuration data without verification.

Attack Vector

An attacker can exploit this vulnerability by crafting a malicious media file with a specially constructed ADTS stream. When FFmpeg processes this file, the crafted extradata triggers a failure in init_get_bits that goes unchecked, allowing the attacker to influence subsequent parsing operations.

The attack can be delivered through:

  • Media files uploaded to web applications using FFmpeg for transcoding
  • Streaming content processed by FFmpeg-based media servers
  • Any application that accepts untrusted media input and uses FFmpeg for processing
c
     GetBitContext gb;
     PutBitContext pb;
     MPEG4AudioConfig m4ac;
-    int off;
+    int off, ret;
 
-    init_get_bits(&gb, buf, size * 8);
+    ret = init_get_bits8(&gb, buf, size);
+    if (ret < 0)
+        return ret;
     off = avpriv_mpeg4audio_get_config2(&m4ac, buf, size, 1, s);
     if (off < 0)
         return off;

Source: GitHub Commit

The patch demonstrates the fix: introducing a return value variable ret, using the safer init_get_bits8 function, and properly checking the return value before continuing execution.

Detection Methods for CVE-2021-38171

Indicators of Compromise

  • Unusual crashes or core dumps from FFmpeg or applications using FFmpeg libraries
  • Unexpected memory access patterns or segmentation faults during media file processing
  • Error logs indicating ADTS parsing failures followed by abnormal application behavior
  • Suspicious media files with malformed ADTS headers or unusual extradata structures

Detection Strategies

  • Monitor FFmpeg process behavior for unexpected crashes when processing ADTS audio streams
  • Implement file integrity monitoring on systems running FFmpeg-based applications
  • Deploy runtime application self-protection (RASP) solutions to detect memory corruption attempts
  • Analyze input media files for malformed ADTS headers before processing

Monitoring Recommendations

  • Enable detailed logging for FFmpeg operations, particularly during audio codec initialization
  • Set up crash monitoring and alerting for applications that process untrusted media content
  • Implement sandboxing for FFmpeg processes to contain potential exploitation attempts
  • Monitor for unusual patterns in media file uploads that may indicate exploitation attempts

How to Mitigate CVE-2021-38171

Immediate Actions Required

  • Update FFmpeg to a version that includes the security patch (commit 9ffa49496d1aae4cbbb387aac28a9e061a6ab0a6)
  • Apply vendor-specific patches for Debian systems as outlined in DSA-4990 and DSA-4998
  • Restrict processing of untrusted media files until patches are applied
  • Implement input validation and sandboxing for media processing workflows

Patch Information

The official fix is available through the FFmpeg GitHub commit which adds proper return value checking for the init_get_bits8 function call in adts_decode_extradata.

Distribution-specific patches are available:

  • Debian Security Advisory DSA-4990
  • Debian Security Advisory DSA-4998
  • Debian LTS Announcement
  • Gentoo GLSA 202312-14

Workarounds

  • Run FFmpeg processes in isolated containers or sandboxed environments to limit exploitation impact
  • Implement pre-processing validation to reject suspicious or malformed media files before FFmpeg processing
  • Use application-level firewalls to filter potentially malicious media uploads
  • Disable ADTS encoding/decoding functionality if not required by your application
bash
# Example: Running FFmpeg in a sandboxed environment using firejail
firejail --private --net=none --no3d ffmpeg -i input.mp4 output.mp3

# Alternative: Use systemd sandboxing for FFmpeg services
# Add to systemd service unit file:
# [Service]
# ProtectSystem=strict
# PrivateTmp=true
# NoNewPrivileges=true
# MemoryDenyWriteExecute=true

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

  • Vulnerability Details
  • TypeBuffer Overflow

  • Vendor/TechFfmpeg

  • SeverityCRITICAL

  • CVSS Score9.8

  • EPSS Probability0.21%

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

  • FFmpeg Patch Submission

  • Gentoo GLSA Advisory 202312-14

  • Debian Security Advisory DSA-4990

  • Debian Security Advisory DSA-4998
  • Vendor Resources
  • GitHub Commit Update
  • Related CVEs
  • CVE-2024-7055: FFmpeg Buffer Overflow Vulnerability

  • CVE-2025-0518: FFmpeg Buffer Overflow Vulnerability

  • CVE-2023-46407: FFmpeg Buffer Overflow Vulnerability

  • CVE-2025-1594: FFmpeg Buffer Overflow Vulnerability
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