Flawfinder version 2.0.10, (C) 2001-2019 David A. Wheeler. Number of rules (primarily dangerous function names) in C/C++ ruleset: 223 Examining data/calife-3.0.1/acconfig.h Examining data/calife-3.0.1/auth.c Examining data/calife-3.0.1/auth_pam.c Examining data/calife-3.0.1/calife.c Examining data/calife-3.0.1/conf.h Examining data/calife-3.0.1/db.c Examining data/calife-3.0.1/util.c FINAL RESULTS: data/calife-3.0.1/auth.c:156:9: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy (calife->pw_passwd, scalife->sp_pwdp); data/calife-3.0.1/auth.c:182:13: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy (pp, calife->pw_passwd + 3); data/calife-3.0.1/auth.c:191:13: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy (salt, md5_salt); data/calife-3.0.1/auth.c:207:31: [4] (crypto) crypt: The crypt functions use a poor one-way hashing algorithm; since they only accept passwords of 8 characters or fewer and only a two-byte salt, they are excessively vulnerable to dictionary attacks given today's faster computing equipment (CWE-327). Use a different algorithm, such as SHA-256, with a larger, non-repeating salt. pt_enc = (char *) crypt (user_pass, calife->pw_passwd); data/calife-3.0.1/auth.c:217:13: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy (enc_pass, pt_enc); data/calife-3.0.1/auth.c:317:28: [4] (misc) getpass: This function is obsolete and not portable. It was in SUSv2 but removed by POSIX.2. What it does exactly varies considerably between systems, particularly in where its prompt is displayed and where it gets its data (e.g., /dev/tty, stdin, stderr, etc.). In addition, some implementations overflow buffers. (CWE-676, CWE-120, CWE-20). Make the specific calls to do exactly what you want. If you continue to use it, or write your own, be sure to zero the password as soon as possible to avoid leaving the cleartext password visible in the process' address space. pt_pass = (char *) getpass ("Password:"); data/calife-3.0.1/calife.c:308:12: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). (void) strcpy (user_to_be, ROOT_LOGIN); data/calife-3.0.1/calife.c:372:9: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy (tty, p + 5); /* strip /dev/ */ data/calife-3.0.1/calife.c:383:13: [4] (misc) getlogin: It's often easy to fool getlogin. Sometimes it does not work at all, because some program messed up the utmp file. Often, it gives only the first 8 characters of the login name. The user currently logged in on the controlling tty of our program need not be the user who started it. Avoid getlogin() for security-related purposes (CWE-807). Use getpwuid(geteuid()) and extract the desired information instead. login = getlogin(); data/calife-3.0.1/calife.c:514:5: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy (this_time, ctime (&t)); data/calife-3.0.1/calife.c:586:17: [4] (shell) execl: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. execl ("/bin/sh", "sh", NULL); data/calife-3.0.1/calife.c:630:17: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy (out_rc, CALIFE_OUT_FILE); data/calife-3.0.1/calife.c:711:29: [4] (shell) execl: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. execl ("/bin/sh", "sh", "-c", out_rc, NULL); data/calife-3.0.1/calife.c:784:9: [4] (shell) execl: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. execl (SU_CMD, "su", user_to_be, NULL); data/calife-3.0.1/calife.c:830:9: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. snprintf (cmdline, "exec %100s", shell_name); data/calife-3.0.1/calife.c:834:13: [4] (shell) execl: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. execl ("/bin/sh", "sh", "-c", cmdline, 0); data/calife-3.0.1/calife.c:858:9: [4] (shell) execl: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. execl (shell_name, shell_arg0, NULL); data/calife-3.0.1/conf.h:202:20: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. #define MESSAGE(x) fprintf (stderr, (x)); \ data/calife-3.0.1/conf.h:204:24: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. #define MESSAGE_1(x,y) fprintf (stderr, (x), (y)); \ data/calife-3.0.1/conf.h:206:26: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. #define MESSAGE_2(x,y,z) fprintf (stderr, (x), (y), (z)); \ data/calife-3.0.1/conf.h:208:28: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. #define MESSAGE_3(x,y,z,t) fprintf (stderr, (x), (y), (z), (t)); \ data/calife-3.0.1/conf.h:210:30: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. #define MESSAGE_4(x,y,z,t,u) fprintf (stderr, (x), (y), (z), (t), (u)); \ data/calife-3.0.1/conf.h:212:32: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. #define MESSAGE_5(x,y,z,t,u,v) fprintf (stderr, (x), (y), (z), (t), \ data/calife-3.0.1/db.c:156:22: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy (_group, group_name); data/calife-3.0.1/db.c:230:17: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if (access (line_shell, R_OK | X_OK)) data/calife-3.0.1/util.c:85:5: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf (stderr, fmt, ap); data/calife-3.0.1/util.c:102:5: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf (stderr, fmt, ap); data/calife-3.0.1/auth.c:167:9: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char * pt_pass, * pt_enc, data/calife-3.0.1/calife.c:212:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char * name, * user_to_be, * tty, this_time [30]; data/calife-3.0.1/calife.c:419:19: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). utmp_fd = open (_PATH_UTMP, O_RDONLY); data/calife-3.0.1/calife.c:543:17: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy (wanted_user, test_user, sizeof (struct passwd)); data/calife-3.0.1/calife.c:555:17: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy (calife, p_calife, sizeof (struct passwd)); data/calife-3.0.1/calife.c:634:22: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fd = open (out_rc, O_RDONLY); data/calife-3.0.1/calife.c:810:10: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fd = open (shell_name, O_RDONLY); data/calife-3.0.1/db.c:49:10: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fp = fopen (AUTH_CONFIG_FILE, "r"); data/calife-3.0.1/auth.c:155:30: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). (char *) xalloc (strlen (scalife->sp_pwdp) + 1); data/calife-3.0.1/auth.c:178:42: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). char * pp = (char *) xalloc (strlen (calife->pw_passwd) + 1); data/calife-3.0.1/auth.c:188:18: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). (strlen (md5_salt) > 8)) /* garbled password */ data/calife-3.0.1/auth.c:196:13: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (salt, calife->pw_passwd, 2); data/calife-3.0.1/auth.c:332:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (user_pass, pt_pass, l_size); data/calife-3.0.1/calife.c:339:26: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if ((n_len = strlen (uargv)) > MAXLOGNAME) data/calife-3.0.1/calife.c:357:13: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (user_to_be, uargv, n_len); data/calife-3.0.1/calife.c:371:32: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). tty = (char *) xalloc (strlen (p) - 4); data/calife-3.0.1/calife.c:429:23: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). err = read (utmp_fd, &utmp, sizeof utmp); data/calife-3.0.1/calife.c:452:13: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (name, utmp.ut_name, sizeof utmp.ut_name); data/calife-3.0.1/calife.c:470:21: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). int l_len = strlen (login); data/calife-3.0.1/calife.c:473:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (name, login, l_len); data/calife-3.0.1/calife.c:629:43: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). out_rc = (char *) xalloc (strlen (CALIFE_OUT_FILE) + 1); data/calife-3.0.1/calife.c:848:43: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). shell_arg0 = (char *) xalloc (strlen (pt) + sizeof (char)); data/calife-3.0.1/calife.c:849:13: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (shell_arg0, pt, strlen (pt) + sizeof (char)); data/calife-3.0.1/calife.c:849:38: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). strncpy (shell_arg0, pt, strlen (pt) + sizeof (char)); data/calife-3.0.1/db.c:121:17: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). lastc = strlen (line) - 1; data/calife-3.0.1/db.c:239:42: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). shell = (char *) xalloc (strlen (line_shell) + 1); data/calife-3.0.1/db.c:240:17: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (shell, line_shell, strlen (line_shell)); data/calife-3.0.1/db.c:240:45: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). strncpy (shell, line_shell, strlen (line_shell)); data/calife-3.0.1/db.c:241:24: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). shell [strlen (line_shell)] = '\0'; data/calife-3.0.1/util.c:29:21: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). p = filename + (strlen (filename) * sizeof (char)); ANALYSIS SUMMARY: Hits = 57 Lines analyzed = 2134 in approximately 0.11 seconds (19609 lines/second) Physical Source Lines of Code (SLOC) = 1220 Hits@level = [0] 46 [1] 22 [2] 8 [3] 0 [4] 27 [5] 0 Hits@level+ = [0+] 103 [1+] 57 [2+] 35 [3+] 27 [4+] 27 [5+] 0 Hits/KSLOC@level+ = [0+] 84.4262 [1+] 46.7213 [2+] 28.6885 [3+] 22.1311 [4+] 22.1311 [5+] 0 Dot directories skipped = 1 (--followdotdir overrides) Minimum risk level = 1 Not every hit is necessarily a security vulnerability. There may be other security vulnerabilities; review your code! See 'Secure Programming HOWTO' (https://dwheeler.com/secure-programs) for more information.