CWE-558: Use of getlogin() in Multithreaded Application
The product uses the getlogin() function in a multithreaded context, potentially causing it to return incorrect values.
Last updated
Overview
CWE-558 (Use of getlogin() in Multithreaded Application) is a variant-level software weakness catalogued by MITRE in the Common Weakness Enumeration (CWE). It describes a recurring type of mistake that can lead to exploitable security vulnerabilities.
Common consequences
What can happen when CWE-558 is exploited.
Modify Application Data, Bypass Protection Mechanism
Affects: Integrity, Access Control, Other
Since getlogin() is not reentrant, 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 could be changed by other threads.
How it happens
When it is introduced
Typically introduced during these phases of the software lifecycle.
Applies to
Languages
How to prevent it
Practical mitigations for CWE-558, grouped by where in the lifecycle they apply.