⚠️

Disclaimer & Liability

The content provided on this website is for educational, research, and security awareness purposes only. Any unauthorized, illegal, or abusive use of the information, tools, and techniques discussed is solely the responsibility of the user. The author and publisher assume no liability for any damages, injuries, or consequences resulting from the misuse of this content.

CVE-2026-140038: Insecure Temporary Directory Handling in Binutils gprofng Enables Local Symlink-Based File Clobbering | Alireza Bolbolabadi - Red Team Security
LOADING

CVE-2026-140038: Insecure Temporary Directory Handling in Binutils gprofng Enables Local Symlink-Based File Clobbering

Executive summary

CVE-2026-140038 is a local insecure-temporary-file vulnerability in the gprofng component of binutils. The utility constructs scratch directories under predictable names derived from caller and process identifiers and does not safely validate or atomically re-create those directories before use. A local attacker who can write to the shared temporary location can pre-stage the expected directory and populate it with attacker-controlled symbolic links, then wait for a victim to invoke gprofng so that the victim's writes follow the planted links and overwrite or truncate arbitrary files that the victim is allowed to write.

The flaw is catalogued under CWE-377 (Insecure Temporary File) and carries a CVSS 3.1 base score of 5.1 (Medium). It is not remotely exploitable and, according to publicly available intelligence at the time of writing, has no reported in-the-wild exploitation or public proof-of-concept exploit code referenced in the available feeds.

Affected systems

The published metadata associates CVE-2026-140038 with the following vendor-product entries at Red Hat:

  • Red Hat Enterprise Linux

  • Red Hat OpenShift Container Platform

  • Red Hat OpenShift

  • Red Hat Hardened Images

  • Red Hat RHEL ELS

  • Red Hat Hummingbird

The upstream product is binutils, specifically the gprofng component. The publicly available sources do not enumerate individual package versions, build numbers, or specific fixed releases; package- and version-level exposure must be confirmed against the Red Hat advisory and Bugzilla record for this CVE rather than inferred from the product list.

Technical details

The bug is rooted in two cooperating weaknesses:

  1. Predictable naming. The temp directory path is derived from values the attacker can observe or guess, primarily the invoking user identifier and the process identifier. With normal local observation (ps, /proc, log files), an attacker who shares the host with a target user can typically narrow the search space to a small candidate set.

  1. No atomic, validated mkdir() step. gprofng creates the chosen path without treating a pre-existing entry as untrusted. An attacker who arrives first can place arbitrary symlinks inside the directory; when gprofng opens the expected names inside that directory for output, the writes resolve through the attacker-supplied links.

The combination maps to CWE-377 and aligns with the related attack patterns CAPEC-149 (Explore for Predictable Temporary File Names) and CAPEC-155 (Screen Temporary Files for Sensitive Information).

Attack constraints

  • Local access required. The attacker must be able to create files in the shared temp directory used by gprofng (commonly /tmp or a configured equivalent).

  • Race window. The attacker must prepare the directory before the victim's gprofng invocation writes to it.

  • Permission ceiling. The primitive only allows gprofng to touch files the victim account is otherwise allowed to write. It does not, by itself, let a low-privilege user destroy data owned by another unprivileged user outside that user's permission set.

  • Privileged execution amplifies impact. Running gprofng as root, or invoking it inside a build, CI, or container-build context with elevated write access, raises the practical blast radius because victim-side privileges then reach a much broader set of files.

Exploit activity

The available feeds report the issue, list relevant CAPEC patterns, and indicate that public GitHub repositories are scanned for proof-of-concept code, but the provided material does not list a usable exploit repository or a documented campaign. Treat the absence of a published PoC as insufficient to claim either that exploitation is impossible or that exploitation has been observed; treat the presence of the underlying primitive as sufficient to plan defensive coverage.

Mitigation

The durable fix is to update binutils (and any Red Hat packages derived from it) once corrected builds are released. Until then, defenders can reduce exposure with a layered approach.

  • Apply vendor patches as soon as they are available through Red Hat's normal channels.

  • Restrict who can invoke gprofng. Avoid running gprofng from privileged service accounts, root shells, automated CI runners, and shared build hosts wherever profiler output is not strictly needed.

  • Isolate profiling runs. Where gprofng is needed, run it inside per-user sandboxes, ephemeral containers, or build containers with private temp directories so the shared /tmp race is removed from the model.

  • Harden the temp location. Where operationally feasible, mount /tmp with noexec, nosuid, and nodev and consider per-user temp directories (e.g., $TMPDIR per account, systemd PrivateTmp=yes) so attackers cannot stage symlinks in locations victims will use.

  • Treat pre-existing temp entries as untrusted. Any defensive wrapper should reject or rename existing directories with expected gprofng naming patterns rather than reuse them.

Recommended long-term hardening

Beyond patching gprofng specifically, organisations should:

  • Audit binutils-derived tooling across build pipelines and developer workstations, not only on production servers, because profiling is typically exercised in development environments that share hosts.

  • Strictly scope which user accounts can use profiling utilities; gprofng does not need to be world-callable on a hardened system.

  • Use file-integrity monitoring on files that privileged build and CI accounts can modify, so symlink-following clobbers surface quickly in alerts.

What is and is not known

Known:

  • The bug exists in gprofng's temp-directory handling and is reproducible conceptually as a predictable-name, symlink-following clobber.

  • The vulnerability is catalogued under CWE-377 with a CVSS 3.1 base score of 5.1 (Medium).

  • Red Hat's enterprise portfolio (RHEL, OpenShift, Hardened Images, RHEL ELS, Hummingbird) is the published affected-product list.

Not known from the available context:

  • Specific fixed upstream or downstream binutils versions.

  • Specific package versions where the flaw is present or absent.

  • The full expanded CVSS vector string.

  • Any confirmed in-the-wild exploitation or named threat campaign.

  • Public proof-of-concept exploit code.

References

·
← News