Skip to content

CVE-2021-25394

A use after free vulnerability via race condition in MFC charger driver prior to SMR MAY-2021 Release 1 allows arbitrary write given a radio privilege is…

Medium Known exploited
Severity
6.4 / 10
Medium · CVSS 3.1
Exploit chance (EPSS)
0.40%
Chance of exploitation in the next 30 days. Higher than 34.41% of scored vulnerabilities.
Known exploited
Yes
In CISA's catalog since Jun 29, 2023
Weakness
CWE-416 Use After Free
CWE-362 Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')
CWE-416 Use After Free
Fix
None yet
No fixed version published
Exploited in the wild. Samsung Mobile Devices Race Condition Vulnerability (Samsung Mobile Devices). Required action: Apply updates per vendor instructions or discontinue use of the product if updates are unavailable Due for U.S. federal agencies by Jul 20, 2023.

Description

A use after free vulnerability via race condition in MFC charger driver prior to SMR MAY-2021 Release 1 allows arbitrary write given a radio privilege is compromised.

How to fix

No fixed version has been published yet. Until one is, remove or replace the package, or turn off or isolate the affected feature. This page updates when a fix ships.

Severity breakdown

CVSS 3.1 6.4

CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:H

Attack vector
Local
Attack complexity
High
Privileges required
High
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High

Weakness

CWE-416: Use After Free

The product reuses or references memory after it has been freed. At some point afterward, the memory may be allocated again and saved in another pointer, while the original pointer references a location somewhere within the new allocation. Any operations using the original pointer are no longer valid because the memory "belongs" to the code that operates on the new pointer.

How to prevent it
  • Architecture and Design: Choose a language that provides automatic memory management.
  • Implementation: When freeing pointers, be sure to set them to NULL once they are freed. However, the utilization of multiple or complex data structures may lower the usefulness of this strategy.

CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')

The product contains a concurrent code sequence that requires temporary, exclusive access to a shared resource, but a timing window exists in which the shared resource can be modified by another code sequence operating concurrently.

How to prevent it
  • Architecture and Design: In languages that support it, use synchronization primitives. Only wrap these around critical code to minimize the impact on performance.
  • Architecture and Design: Use thread-safe capabilities such as the data access abstraction in Spring.
  • Architecture and Design: Minimize the usage of shared resources in order to remove as much complexity as possible from the control flow and to reduce the likelihood of unexpected conditions occurring. Additionally, this will minimize the amount of synchronization necessary and may even help to reduce the likelihood of a denial of service where an attacker may be able to repeatedly trigger a critical section (CWE-400).
  • Implementation: When using multithreading and operating on shared variables, only use thread-safe functions.
  • Implementation: Use atomic operations on shared variables. Be wary of innocent-looking constructs such as "x++". This may appear atomic at the code layer, but it is actually non-atomic at the instruction layer, since it involves a read, followed by a computation, followed by a write.
  • Implementation: Use a mutex if available, but be sure to avoid related weaknesses such as CWE-412.
  • Implementation: Avoid double-checked locking (CWE-609) and other implementation errors that arise when trying to avoid the overhead of synchronization.
  • Implementation: Disable interrupts or signals over critical parts of the code, but also make sure that the code does not go into a large or infinite loop.
  • Implementation: Use the volatile type modifier for critical variables to avoid unexpected compiler optimization or reordering. This does not necessarily solve the synchronization problem, but it can help.
  • Architecture and Design, Operation: Run your code using the lowest privileges that are required to accomplish the necessary tasks [REF-76]. If possible, create isolated accounts with limited privileges that are only used for a single task. That way, a successful attack will not immediately give the attacker access to the rest of the software or its environment. For example, database applications rarely need to run as the database administrator, especially in day-to-day operations.

CWE-416: Use After Free

The product reuses or references memory after it has been freed. At some point afterward, the memory may be allocated again and saved in another pointer, while the original pointer references a location somewhere within the new allocation. Any operations using the original pointer are no longer valid because the memory "belongs" to the code that operates on the new pointer.

How to prevent it
  • Architecture and Design: Choose a language that provides automatic memory management.
  • Implementation: When freeing pointers, be sure to set them to NULL once they are freed. However, the utilization of multiple or complex data structures may lower the usefulness of this strategy.

References

Timeline

  1. Published
  2. Added to CISA's Known Exploited Vulnerabilities catalog
  3. Remediation due for U.S. federal agencies
  4. Last updated by the source
  5. Latest EPSS score
AdvisorySeverityWhy it's related
CVE-2026-109619
PHP has various global state that temporarily points into request memory.
Critical Known exploited Same weakness, CWE-416
CVE-2026-109618
PHP uses longjmp() for out-of-memory (OOM) errors to exit the current context and abort handling of the request.
Critical Known exploited Same weakness, CWE-416
GHSA-7mwm-ghpf-9vrm
Pillow: Double free in ImagingScaleAffine on calloc failure via Image.transform
High Same weakness, CWE-416
GHSA-4rr5-89j8-mwwm
Pillow: Heap use-after-free when encoding TIFF to an in-memory buffer
High Same weakness, CWE-416
GHSA-wq5f-xc86-pv6w
sharp : Vulnerability in librsvg dependency CVE-2026-96889
High Same weakness, CWE-416
RUSTSEC-2026-0326
Rooting for GC values live across `try_call` may be missing, causing GC heap corruption
Medium Same weakness, CWE-416
CVE-2026-68820
Use after free in Windows Ancillary Function Driver for WinSock allows an authorized attacker to elevate privileges locally.
High Known exploited Same weakness, CWE-416
GHSA-c494-m2fq-59mx
Microsoft Security Advisory CVE-2026-62898 – .NET Information Disclosure Vulnerability
High Same weakness, CWE-416
Is this in your code?

MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.

Check your repos with MergeHarbor