CWE-558

Use of getlogin() in Multithreaded Application

Medium

Description

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

Potential Impact

How to Fix

Architecture and Design

Using names for security purposes is not advised. Names are easy to forge and can have overlapping user IDs, potentially causing confusion or impersonation.

Implementation

Use getlogin_r() instead, which is reentrant, meaning that other processes are locked out from changing the username.

Detection Methods

Related Weaknesses

References

View on MITRE CWE Database →

Need Help Fixing This Vulnerability?

Our security experts can help you identify and remediate CWE-558 vulnerabilities in your codebase.

Get Security Assessment