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-2021-21261

CVE-2021-21261: Flatpak Sandbox Escape RCE Vulnerability

CVE-2021-21261 is a sandbox escape RCE vulnerability in Flatpak that allows malicious apps to execute arbitrary code on the host system. This article covers the technical details, affected versions, and mitigation steps.

Published: February 25, 2026

CVE-2021-21261 Overview

CVE-2021-21261 is a sandbox escape vulnerability in Flatpak, a popular system for building, distributing, and running sandboxed desktop applications on Linux. A critical bug was discovered in the flatpak-portal service that allows sandboxed applications to execute arbitrary code on the host system, effectively breaking out of the security sandbox designed to isolate applications.

Critical Impact

Malicious or compromised Flatpak applications can escape the sandbox and execute arbitrary code on the host system with the privileges of the user running Flatpak.

Affected Products

  • Flatpak versions from 0.11.4 to before 1.8.5
  • Flatpak versions from 1.9.x to before 1.10.0
  • Debian Linux 10.0

Discovery Timeline

  • January 14, 2021 - CVE-2021-21261 published to NVD
  • November 21, 2024 - Last updated in NVD database

Technical Details for CVE-2021-21261

Vulnerability Analysis

This vulnerability is classified as CWE-74 (Improper Neutralization of Special Elements in Output Used by a Downstream Component), commonly known as an injection vulnerability. The flaw exists in the Flatpak portal D-Bus service (flatpak-portal, also known by its D-Bus service name org.freedesktop.portal.Flatpak), which is responsible for allowing sandboxed apps to launch subprocesses in new sandbox instances.

The portal service allows apps to spawn subprocesses with either the same security settings as the caller or with more restrictive settings. This functionality is crucial for applications like Flatpak-packaged web browsers (e.g., Chromium) that need to launch subprocesses to handle untrusted web content with additional restrictions.

Root Cause

The root cause of this vulnerability lies in the improper handling of environment variables. In vulnerable versions, the Flatpak portal service passes caller-specified environment variables directly to non-sandboxed processes on the host system, specifically to the flatpak run command used to launch new sandbox instances. This allows a malicious Flatpak application to set environment variables that are trusted by the flatpak run command, enabling arbitrary code execution outside the sandbox.

Attack Vector

The attack exploits the local attack vector where a malicious or compromised Flatpak application can:

  1. Craft malicious environment variables that are interpreted by the flatpak run command
  2. Pass these environment variables through the flatpak-portal D-Bus service
  3. Have those variables influence the execution of flatpak run on the host system
  4. Execute arbitrary code outside the sandbox with the user's privileges

The security patches introduce a new --env-fd option to safely pass environment variables through a file descriptor instead of through the command line or inherited environment, preventing the injection attack:

c
// Security patch - Adding flatpak_bwrap_take_arg function
// Source: https://github.com/flatpak/flatpak/commit/6d1773d2a54dde9b099043f07a2094a4f1c2f486

/*
 * flatpak_bwrap_take_arg:
 * @arg: (transfer full): Take ownership of this argument
 *
 * Add @arg to @bwrap's argv, taking ownership of the pointer.
 */
void
flatpak_bwrap_take_arg (FlatpakBwrap *bwrap, char *arg)
{
  g_ptr_array_add (bwrap->argv, arg);
}
c
// Security patch - Adding --env-fd option for secure environment variable handling
// Source: https://github.com/flatpak/flatpak/commit/6e5ae7a109cdfa9735ea7ccbd8cb79f9e8d3ae8b

static gboolean
option_env_fd_cb (const gchar *option_name,
                  const gchar *value,
                  gpointer     data,
                  GError     **error)
{
  FlatpakContext *context = data;
  g_autoptr(GBytes) env_block = NULL;
  gsize remaining;
  const char *p;
  guint64 fd;
  gchar *endptr;

  fd = g_ascii_strtoull (value, &endptr, 10);

  if (endptr == NULL || *endptr != '\0' || fd > G_MAXINT)
    return glnx_throw (error, "Not a valid file descriptor: %s", value);

  env_block = glnx_fd_readall_bytes ((int) fd, NULL, error);

  if (env_block == NULL)
    return FALSE;

  p = g_bytes_get_data (env_block, &remaining);

  /* env_block might not be \0-terminated */
  while (remaining > 0)

Detection Methods for CVE-2021-21261

Indicators of Compromise

  • Unusual D-Bus activity involving the org.freedesktop.portal.Flatpak service
  • Unexpected processes spawned outside of Flatpak sandboxes with suspicious environment variables
  • Anomalous flatpak run command executions with non-standard environment variable configurations
  • Signs of code execution in contexts where Flatpak applications should be restricted

Detection Strategies

  • Monitor D-Bus traffic for calls to the flatpak-portal service, especially those passing unusual environment variables
  • Implement system call auditing to detect sandbox escape attempts via flatpak run
  • Use application whitelisting to detect unexpected processes spawned by Flatpak applications
  • Deploy endpoint detection solutions capable of monitoring inter-process communication (IPC) patterns

Monitoring Recommendations

  • Enable detailed logging for the flatpak-portal D-Bus service
  • Monitor process creation events for child processes spawned by Flatpak sandboxed applications
  • Implement alerts for environment variable manipulation patterns associated with known exploitation techniques
  • Review Flatpak application permissions and installed packages regularly

How to Mitigate CVE-2021-21261

Immediate Actions Required

  • Upgrade Flatpak to version 1.8.5 or 1.10.0 or later immediately
  • Review installed Flatpak applications for any suspicious or untrusted packages
  • Audit system logs for any signs of attempted exploitation
  • Consider temporarily disabling untrusted Flatpak applications until patching is complete

Patch Information

Security patches have been released by the Flatpak project and are available through multiple commits:

  • GitHub Commit 6d1773d2 - Converts environment variables into bwrap arguments
  • GitHub Commit 6e5ae7a1 - Adds --env-fd option for secure environment handling
  • GitHub Commit aeb6a7ab - Portal service conversion of --env to --env-fd

Distribution-specific advisories:

  • Debian DSA-4830
  • Gentoo GLSA 202101-21

For complete details, see the GitHub Security Advisory GHSA-4ppf-fxf6-vxg2.

Workarounds

  • As a temporary mitigation, prevent the flatpak-portal service from starting (note: this will prevent many Flatpak apps from working correctly)
  • Restrict usage of Flatpak applications to only trusted, verified packages
  • Implement additional application sandboxing using SELinux or AppArmor policies
  • Limit user access to systems where Flatpak is installed until patches can be applied
bash
# Temporary workaround: Disable flatpak-portal service
# WARNING: This will break functionality for many Flatpak applications
systemctl --user mask flatpak-portal.service
systemctl --user stop flatpak-portal.service

# Verify Flatpak version after upgrade
flatpak --version

# List installed Flatpak applications for review
flatpak list --app

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

  • Vulnerability Details
  • TypeRCE

  • Vendor/TechFlatpak

  • SeverityHIGH

  • CVSS Score8.8

  • EPSS Probability0.22%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityNone
  • AvailabilityHigh
  • CWE References
  • CWE-74
  • Technical References
  • GitHub Commit cc140104

  • GitHub Release 1.8.5

  • GitHub Security Advisory GHSA-4ppf-fxf6-vxg2

  • Gentoo GLSA 202101-21

  • Debian DSA-4830
  • Vendor Resources
  • GitHub Commit 6d1773d2

  • GitHub Commit 6e5ae7a1

  • GitHub Commit aeb6a7ab
  • Related CVEs
  • CVE-2026-34078: Flatpak Symlink RCE Vulnerability

  • CVE-2024-32462: Flatpak Sandbox Escape RCE Vulnerability

  • CVE-2026-40354: Flatpak Path Traversal Vulnerability

  • CVE-2026-39977: flatpak-builder Path Traversal 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