VYPR
Unrated severityNVD Advisory· Published Dec 31, 2005· Updated Jun 16, 2026

CVE-2005-4733

CVE-2005-4733

Description

NetBSD 2.0 before 20050316 and NetBSD-current before 20050112 allow local users to cause a denial of service (infinite loop and system hang) by calling the F_CLOSEM fcntl with a parameter value of 0.

AI Insight

LLM-synthesized narrative grounded in this CVE's description and references.

Affected products

2
  • NetBSD/NetBSD2 versions
    cpe:2.3:o:netbsd:netbsd:2.0:*:*:*:*:*:*:*+ 1 more
    • cpe:2.3:o:netbsd:netbsd:2.0:*:*:*:*:*:*:*
    • (no CPE)range: <2.0 20050316 (NetBSD 2.0) or <NetBSD-current 20050112

Patches

Vulnerability mechanics

Root cause

"Ambiguous sentinel value: fd_lastfile was initialized to 0, which could not distinguish between "file descriptor 0 is open" and "no file descriptors are open", causing an infinite loop in F_CLOSEM fcntl."

Attack vector

A local user calls the `F_CLOSEM` fcntl with a parameter value of 0 [ref_id=1]. Because `fd_lastfile` is 0 when no file descriptors are open, the kernel interprets this as "file descriptor 0 is the last open fd" and enters an infinite loop attempting to close descriptors, causing a system hang [ref_id=1]. No special privileges or network access are required — only the ability to invoke the fcntl syscall locally.

Affected code

The vulnerability is in `src/sys/kern/kern_descrip.c` [ref_id=1]. The `find_last_set` function could return 0 both when file descriptor 0 was open and when no file descriptors were open at all, because `fd_lastfile` was initialized to 0 instead of -1 [ref_id=1].

What the fix does

The patch changes `fd_lastfile` to be initialized to -1 instead of 0, and makes `find_last_set` return -1 when no file descriptors are open [ref_id=1]. This eliminates the ambiguity where 0 meant both "fd 0 is open" and "no fds are open", which previously caused the `F_CLOSEM` fcntl to loop indefinitely [ref_id=1]. A secondary fix corrects the `memset()` size in `fdcopy()` that was clearing more entries than needed [ref_id=1].

Preconditions

  • authAttacker must be a local user on the system
  • inputNo file descriptors must be open at the time of the call (or fd_lastfile must be 0)

Reproduction

The reference write-up does not include reproduction steps beyond describing the trigger: calling `F_CLOSEM` fcntl with a parameter value of 0 when no file descriptors are open [ref_id=1].

Generated on Jun 17, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

3

News mentions

0

No linked articles in our index yet.