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/autossh-1.4g/fakepoll.h Examining data/autossh-1.4g/daemon.h Examining data/autossh-1.4g/autossh.c FINAL RESULTS: data/autossh-1.4g/autossh.c:749:4: [4] (shell) execvp: 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. execvp(av[0], av); data/autossh-1.4g/autossh.c:1797:10: [4] (format) vsnprintf: 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. (void)vsnprintf(logbuf, sizeof(logbuf), fmt, ap); data/autossh-1.4g/autossh.c:1798:4: [4] (format) syslog: If syslog's format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant format string for syslog. syslog(level, logbuf); data/autossh-1.4g/autossh.c:1814:4: [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(fl, fmt, ap); data/autossh-1.4g/autossh.c:304:15: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while ((ch = getopt(argc, argv, OPTION_STRING)) != -1) { data/autossh-1.4g/autossh.c:587: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. if ((s = getenv("AUTOSSH_PATH")) != NULL) data/autossh-1.4g/autossh.c:590: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. if ((s = getenv("AUTOSSH_DEBUG")) != NULL) { data/autossh-1.4g/autossh.c:599:18: [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. } else if ((s = getenv("AUTOSSH_LOGLEVEL")) != NULL) { data/autossh-1.4g/autossh.c:606: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. if ((s = getenv("AUTOSSH_POLL")) != NULL) { data/autossh-1.4g/autossh.c:615: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. if ((s = getenv("AUTOSSH_FIRST_POLL")) != NULL) { data/autossh-1.4g/autossh.c:630: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. if ((s = getenv("AUTOSSH_GATETIME")) != NULL) { data/autossh-1.4g/autossh.c:636: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. if ((s = getenv("AUTOSSH_MAXSTART")) != NULL) { data/autossh-1.4g/autossh.c:642: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. if ((s = getenv("AUTOSSH_MESSAGE")) != NULL) { data/autossh-1.4g/autossh.c:650: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. if ((s = getenv("AUTOSSH_PORT")) != NULL) data/autossh-1.4g/autossh.c:654: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. if ((s = getenv("AUTOSSH_MAXLIFETIME")) != NULL) { data/autossh-1.4g/autossh.c:681: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. if ((s = getenv("AUTOSSH_PIDFILE")) != NULL) data/autossh-1.4g/autossh.c:686: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. if ((s = getenv("AUTOSSH_NTSERVICE")) != NULL) { data/autossh-1.4g/autossh.c:699: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. if ((s = getenv("AUTOSSH_LOGFILE")) != NULL) { data/autossh-1.4g/autossh.c:723:2: [3] (random) srandom: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. srandom(getpid() ^ tv.tv_usec ^ tv.tv_sec); data/autossh-1.4g/autossh.c:1274:7: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. id = random(); data/autossh-1.4g/autossh.c:120:1: [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 readp[16]; /* read port as string */ data/autossh-1.4g/autossh.c:275:2: [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 wmbuf[256], rmbuf[256]; data/autossh-1.4g/autossh.c:476:14: [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). pid_file = fopen(pid_file_name, "w"); data/autossh-1.4g/autossh.c:700: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). flog = fopen(s, "a"); data/autossh-1.4g/autossh.c:1264:2: [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 wbuf[64+sizeof(uts.nodename)+MAX_MESSAGE]; data/autossh-1.4g/autossh.c:1265:2: [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 rbuf[sizeof(wbuf)]; data/autossh-1.4g/autossh.c:1550:25: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). resp->sin_port = htons(atoi(port)); data/autossh-1.4g/autossh.c:1736: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. static char timestr[32]; data/autossh-1.4g/autossh.c:1789:2: [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 logbuf[1024]; data/autossh-1.4g/daemon.h:67:31: [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 (!noclose && (fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) { data/autossh-1.4g/autossh.c:515:8: [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). len = strlen(s); data/autossh-1.4g/autossh.c:553:14: [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). for (len = strlen(arg), f = arg; *f != '\0'; f++, len--) { data/autossh-1.4g/autossh.c:645:7: [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 (strlen(echo_message) > MAX_MESSAGE) data/autossh-1.4g/autossh.c:687: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). if (*s != '\0' && strncasecmp("yes", s, strlen(s)) == 0) { data/autossh-1.4g/autossh.c:1339:7: [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(wbuf), pfd, ntopoll); data/autossh-1.4g/autossh.c:1503:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). nread = read(pfd[ird].fd, rp, rleft); ANALYSIS SUMMARY: Hits = 36 Lines analyzed = 2069 in approximately 0.07 seconds (29598 lines/second) Physical Source Lines of Code (SLOC) = 1399 Hits@level = [0] 29 [1] 6 [2] 10 [3] 16 [4] 4 [5] 0 Hits@level+ = [0+] 65 [1+] 36 [2+] 30 [3+] 20 [4+] 4 [5+] 0 Hits/KSLOC@level+ = [0+] 46.4618 [1+] 25.7327 [2+] 21.4439 [3+] 14.2959 [4+] 2.85919 [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.