Use-after-free vulnerability in libsubcmd

Kernel Updated 02 Oct 2025

Summary

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

GSD-2022-1000354: libsubcmd: Fix use-after-free for realloc(..., 0). Affects Kernel versions >= 2f4ce5ec1d447beb42143a9653716a2ab025161e, < aca7e5b6a5008dcf551516490b0ba4510e073d08. 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 Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

The libsubcmd library is a component of the Linux Kernel, which is responsible for providing subcommand handling functionality. It allows programs to define and execute subcommands within a larger command-line interface. The library is widely used in various Linux distributions and applications.

Vulnerability Detail

The use-after-free vulnerability in libsubcmd arises from a flaw in the realloc() function. When realloc() is called with a size of 0, it can lead to a use-after-free condition, where the memory previously allocated is freed but still accessed. This vulnerability can be exploited by an attacker to execute arbitrary code or cause a denial-of-service condition.

How To Fix

No fixed version is published for this vulnerability.

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

Workaround

If updating the Linux Kernel is not immediately feasible, a temporary workaround is to avoid calling realloc() with a size of 0. Developers should review their code and ensure that realloc() is used correctly, with a non-zero size parameter.

Conclusion

The use-after-free vulnerability in libsubcmd can be mitigated by updating the Linux Kernel to version v5.4.181 or later. Developers should also review their code to ensure proper usage of realloc(). 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 in the Linux Kernel that provides subcommand handling functionality.

A use-after-free vulnerability occurs when a program continues to use memory after it has been freed, leading to potential security issues.

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

Yes, this vulnerability has been fixed in the Linux Kernel version v5.4.181 by commit aca7e5b6a5008dcf551516490b0ba4510e073d08.

It is recommended to update the Linux Kernel to the latest version available, which includes the fix for this vulnerability. Alternatively, developers can review their code and ensure that realloc() is used correctly with a non-zero size parameter.

Related vulnerabilities

Recent vulnerabilities recorded for Kernel.

How To Fix

No fixed version is published for this vulnerability.

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