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/pwauth-2.3.11/auth_mdw.c Examining data/pwauth-2.3.11/lastlog.c Examining data/pwauth-2.3.11/fail_log.h Examining data/pwauth-2.3.11/auth_pam.c Examining data/pwauth-2.3.11/auth_sun.c Examining data/pwauth-2.3.11/pwauth.h Examining data/pwauth-2.3.11/auth_openbsd.c Examining data/pwauth-2.3.11/auth_bsd.c Examining data/pwauth-2.3.11/fail_log.c Examining data/pwauth-2.3.11/fail_check.c Examining data/pwauth-2.3.11/auth_aix.c Examining data/pwauth-2.3.11/nologin.c Examining data/pwauth-2.3.11/auth_hpux.c Examining data/pwauth-2.3.11/checkfaillog.c Examining data/pwauth-2.3.11/config.h Examining data/pwauth-2.3.11/main.c Examining data/pwauth-2.3.11/snooze.c FINAL RESULTS: data/pwauth-2.3.11/auth_aix.c:67:12: [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. cpass= crypt(passwd, upwd->upw_passwd); data/pwauth-2.3.11/auth_bsd.c:70:12: [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. cpass= crypt(passwd, pwd->pw_passwd); data/pwauth-2.3.11/auth_hpux.c:61:12: [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. cpass= crypt(passwd, pwd->ufld.fd_encrypt); data/pwauth-2.3.11/auth_openbsd.c:139:14: [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. int rc= access(nologin,F_OK); data/pwauth-2.3.11/auth_openbsd.c:146:6: [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(_PATH_NOLOGIN,F_OK) == 0) data/pwauth-2.3.11/auth_sun.c:42:7: [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. char *crypt(); data/pwauth-2.3.11/auth_sun.c:85:12: [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. cpass= crypt(passwd, spwd->sp_pwdp); data/pwauth-2.3.11/fail_check.c:93:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf,"%d %s since last login. Last was %s on %s.", data/pwauth-2.3.11/fail_check.c:98:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf,"%d:%ld::%s", data/pwauth-2.3.11/fail_check.c:162:6: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf,"%d %s since last login. Last was %s from %s on %s.", data/pwauth-2.3.11/fail_check.c:166:6: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf,"%d %s since last login. Last was %s on %s.", data/pwauth-2.3.11/fail_check.c:171:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf,"%d:%ld:%s:%s", data/pwauth-2.3.11/main.c:94:2: [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 (login,++c); data/pwauth-2.3.11/nologin.c:45:9: [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(NOLOGIN_FILE, F_OK)) data/pwauth-2.3.11/fail_log.c:176:13: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if ((host= getenv("HOST")) == NULL) host= getenv("IP"); data/pwauth-2.3.11/fail_log.c:176:44: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if ((host= getenv("HOST")) == NULL) host= getenv("IP"); data/pwauth-2.3.11/lastlog.c:43:21: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. char *hostname= getenv("HOST"); data/pwauth-2.3.11/lastlog.c:44:21: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. char *hostaddr= getenv("IP"); data/pwauth-2.3.11/main.c:80:17: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if ((login= getenv("USER")) == NULL || data/pwauth-2.3.11/main.c:81:11: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. (passwd= getenv("PASS")) == NULL) data/pwauth-2.3.11/auth_mdw.c:56: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 bf[40]; data/pwauth-2.3.11/fail_check.c:59:12: [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. static char buf[1024]; data/pwauth-2.3.11/fail_check.c:64:16: [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). if ((flfd= open(PATH_FAILLOG, reset ? O_RDWR : O_RDONLY)) < 0) data/pwauth-2.3.11/fail_check.c:127:12: [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. static char buf[1024]; data/pwauth-2.3.11/fail_check.c:132:16: [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). if ((flfd= open(PATH_FAILLOG, reset ? O_RDWR : O_RDONLY)) < 0) data/pwauth-2.3.11/fail_log.c:58:16: [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). if ((flfd= open(PATH_FAILLOG,MODE_FAILLOG)) >= 0) data/pwauth-2.3.11/fail_log.c:81:16: [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). if ((flfd= open(PATH_FAILLOG,O_RDWR)) > 0) data/pwauth-2.3.11/fail_log.c:97:2: [2] (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). Risk is low because the source is a constant string. strcpy(flog.fail_line,"http"); data/pwauth-2.3.11/fail_log.c:124:16: [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). if ((flfd= open(PATH_FAILLOG,MODE_FAILLOG)) >= 0) data/pwauth-2.3.11/fail_log.c:161:16: [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). if ((flfd= open(PATH_FAILLOG,O_RDWR)) > 0) data/pwauth-2.3.11/fail_log.h:30: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 bl_line[UT_LINESIZE]; /* tty used */ data/pwauth-2.3.11/fail_log.h:31: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 bl_name[UT_NAMESIZE]; /* remote username */ data/pwauth-2.3.11/fail_log.h:32: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 bl_host[UT_HOSTSIZE]; /* remote host */ data/pwauth-2.3.11/lastlog.c:56:14: [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). if ((fd= open(LASTLOG,O_WRONLY)) < 0) return; data/pwauth-2.3.11/main.c:55: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 login[BFSZ+1], passwd[BFSZ+1]; data/pwauth-2.3.11/snooze.c:56:16: [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). if ((slfd= open(SLEEP_LOCK,O_CREAT|O_RDWR,0644)) >= 0) data/pwauth-2.3.11/auth_openbsd.c:86: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). auth_setdata(as, passwd, strlen(passwd)+1); data/pwauth-2.3.11/fail_check.c:70:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(flfd, &flog, sizeof(struct faillog)) != sizeof(struct faillog)) data/pwauth-2.3.11/fail_check.c:138:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(flfd, &flog, sizeof(struct badlogin)) != sizeof(struct badlogin)) data/pwauth-2.3.11/fail_log.c:61:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). result= (read(flfd, &flog, sizeof(struct faillog)) data/pwauth-2.3.11/fail_log.c:85:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(flfd,&flog,sizeof(struct faillog)) != sizeof(struct faillog)) data/pwauth-2.3.11/fail_log.c:128:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(flfd, &flog, sizeof(struct badlogin)) != data/pwauth-2.3.11/fail_log.c:165:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(flfd, &flog, sizeof(struct badlogin)) != data/pwauth-2.3.11/fail_log.c:175:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). Risk is low because the source is a constant string. strncpy(flog.bl_line, "http", sizeof(flog.bl_line)); data/pwauth-2.3.11/fail_log.c:178:6: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(flog.bl_host, host, sizeof(flog.bl_host)); data/pwauth-2.3.11/lastlog.c:47:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). Risk is low because the source is a constant string. strncpy(ll.ll_line,"http",UT_LINESIZE); data/pwauth-2.3.11/lastlog.c:49:29: [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 (hostname != NULL && strlen(hostname) <= UT_HOSTSIZE) data/pwauth-2.3.11/lastlog.c:50:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(ll.ll_host,hostname,UT_HOSTSIZE); data/pwauth-2.3.11/lastlog.c:52:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(ll.ll_host,hostaddr,UT_HOSTSIZE); data/pwauth-2.3.11/main.c:114: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). bzero(passwd,strlen(passwd)); /* Erase plain-text from our memory */ ANALYSIS SUMMARY: Hits = 50 Lines analyzed = 2141 in approximately 0.10 seconds (22209 lines/second) Physical Source Lines of Code (SLOC) = 940 Hits@level = [0] 3 [1] 14 [2] 16 [3] 6 [4] 14 [5] 0 Hits@level+ = [0+] 53 [1+] 50 [2+] 36 [3+] 20 [4+] 14 [5+] 0 Hits/KSLOC@level+ = [0+] 56.383 [1+] 53.1915 [2+] 38.2979 [3+] 21.2766 [4+] 14.8936 [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.