Use-after-free vulnerability in libsubcmd

Kernel Updated 02 Oct 2025

Summary

27/02/2022
N/A
No i
Unrated
Not published

GSD-2022-1000331: libsubcmd: Fix use-after-free for realloc(..., 0). Affects Kernel versions >= 2f4ce5ec1d447beb42143a9653716a2ab025161e, < 1029268dc50d3eb54ab0e8d7075d33b190cad9d2. No fix is published. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

libsubcmd is a library used in the Linux Kernel for handling subcommands. It provides functions for parsing and executing subcommands within the kernel. The library is an integral part of the Linux Kernel and is widely used in various Linux distributions. However, a use-after-free vulnerability has been discovered in libsubcmd, which could potentially lead to security breaches and system instability.

Vulnerability Detail

The use-after-free vulnerability in libsubcmd occurs when the realloc function is called with a size of 0. This can result in a use-after-free condition, where a pointer to a previously allocated memory block is accessed after it has been freed. An attacker could exploit this vulnerability to execute arbitrary code, escalate privileges, or cause a denial-of-service condition. The vulnerability was introduced in version v4.5 of the Linux Kernel and has been fixed in version v4.19.231.

How To Fix

No fixed version is published for this vulnerability.

To fix this vulnerability, it is recommended to update the Linux Kernel to version v4.19.231 or later. This can be done by downloading the latest kernel source code from the official Linux Kernel repository (https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/) and compiling it according to the provided instructions. Alternatively, users can update their Linux distribution to a version that includes the fixed kernel.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Workaround

As a temporary workaround, users can avoid triggering the use-after-free vulnerability by refraining from calling the realloc function with a size of 0. Instead, they should ensure that the size parameter is greater than 0 when reallocating memory.

Conclusion

The use-after-free vulnerability in libsubcmd can have serious security implications and system stability issues. It is crucial to update the Linux Kernel to the fixed version or apply the recommended workarounds to mitigate the risk. For further support and assistance in vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for Kernel →

Share this vulnerability

FAQ

libsubcmd is a library used in the Linux Kernel for handling subcommands. It provides functions for parsing and executing subcommands within the kernel.

A use-after-free vulnerability occurs when a program accesses a memory block after it has been freed. This can lead to unpredictable behavior, crashes, or security vulnerabilities.

An attacker can exploit this vulnerability by crafting a malicious input that triggers the use-after-free condition. This can allow them to execute arbitrary code, escalate privileges, or cause a denial-of-service condition.

Yes, this vulnerability has been fixed in version v4.19.231 of the Linux Kernel.

To protect your system, it is recommended to update the Linux Kernel to version v4.19.231 or later. Alternatively, you can update your Linux distribution to a version that includes the fixed kernel.

Related vulnerabilities

Recent vulnerabilities recorded for Kernel.

How To Fix

No fixed version is published for this vulnerability.

To fix this vulnerability, it is recommended to update the Linux Kernel to version v4.19.231 or later. This can be done by downloading the latest kernel source code from the official Linux Kernel repository (https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/) and compiling it according to the provided instructions. Alternatively, users can update their Linux distribution to a version that includes the fixed kernel.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback

Follow Vulert in Google

Get more Vulert vulnerability and dependency-security updates in Google Search and AI results.