CWE-558: Use of getlogin() in Multithreaded Application

Description

The product uses the getlogin() function in a multithreaded context, potentially causing it to return incorrect values.

Submission Date :

July 19, 2006, midnight

Modification Date :

2023-10-26 00:00:00+00:00

Organization :

MITRE
Extended Description

The getlogin() function returns a pointer to a string that contains the name of the user associated with the calling process. The function is not reentrant, meaning that if it is called from another process, the contents are not locked out and the value of the string can be changed by another process. This makes it very risky to use because the username can be changed by other processes, so the results of the function cannot be trusted.

Example Vulnerable Codes

Example - 1

The following code relies on getlogin() to determine whether or not a user is trusted. It is easily subverted.


allow();deny();pwd = getpwnam(getlogin());if (isTrustedGroup(pwd->pw_gid)) {} else {}

Related Weaknesses

This table shows the weaknesses and high level categories that are related to this weakness. These relationships are defined to give an overview of the different insight to similar items that may exist at higher and lower levels of abstraction.

Visit http://cwe.mitre.org/ for more details.

© cvefeed.io
Latest DB Update: Nov. 25, 2024 4:01