Skip to content

Unchecked Return Value of setuid/seteuid

Description

The software does not check the return value from a method or function, which can prevent it from detecting unexpected states and conditions. If the program calls a function to drop privileges but does not check the return code to ensure that privileges were successfully dropped, then the program will continue to operate with the higher privileges.

Examples

Insecure Code

c
setuid(0);

Secure Code

c
if (setuid(0) != 0) { handle_error(); }

Remediation

Check the return value of setuid/seteuid to ensure that privileges were successfully dropped.

Rule Details

FieldValue
IDCODE-0492
CategoryAccessControl
SeverityHIGH
CWECWE-252
ConfidenceMEDIUM
ImpactHIGH
LikelihoodMEDIUM
ExploitabilityMODERATE
Tagsprivilege escalation, return value
OWASPN/A

References