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/faifa-0.2~svn82/faifa.c Examining data/faifa-0.2~svn82/endian.h Examining data/faifa-0.2~svn82/frame.h Examining data/faifa-0.2~svn82/homeplug.h Examining data/faifa-0.2~svn82/homeplug_av.h Examining data/faifa-0.2~svn82/device.h Examining data/faifa-0.2~svn82/crc32.h Examining data/faifa-0.2~svn82/crypto.h Examining data/faifa-0.2~svn82/frame.c Examining data/faifa-0.2~svn82/main.c Examining data/faifa-0.2~svn82/faifa.h Examining data/faifa-0.2~svn82/faifa_priv.h Examining data/faifa-0.2~svn82/crypto.c Examining data/faifa-0.2~svn82/faifa_compat.h FINAL RESULTS: data/faifa-0.2~svn82/faifa.c:63:2: [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. vsnprintf(faifa->error, sizeof(faifa->error), format, ap); data/faifa-0.2~svn82/faifa.c:156: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(name, d->name); data/faifa-0.2~svn82/faifa.c:272:11: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. pstr += sprintf((char *)pstr, "%02hX%s", (unsigned short int)*pbuf, (avail > 1) ? sep : ""); data/faifa-0.2~svn82/faifa.h:47:2: [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. fprintf (stream, fmt ,##args) \ data/faifa-0.2~svn82/frame.c:516:2: [4] (buffer) fscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. fscanf(in_stream, "%s", (char *)filename); data/faifa-0.2~svn82/frame.c:1174:47: [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. faifa_printf(out_stream, "Access: %s\n", fc->access ? "Yes" : "No"); data/faifa-0.2~svn82/frame.c:1210:48: [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. faifa_printf(out_stream, "Access: %s\n", bcn->access ? "Yes" : "No"); data/faifa-0.2~svn82/frame.c:1401:2: [4] (buffer) fscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. fscanf(in_stream, "%s", nek); data/faifa-0.2~svn82/frame.c:1410:3: [4] (buffer) fscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. fscanf(in_stream, "%s", dek); data/faifa-0.2~svn82/frame.c:1739:42: [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. static char *get_net_access_str(u_int8_t access) data/faifa-0.2~svn82/frame.c:1741:10: [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. switch (access) { data/faifa-0.2~svn82/frame.c:1762:63: [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. faifa_printf(out_stream, "Access: 0x%02hX (%s)\n", net_info->access, get_net_access_str(net_info->access)); data/faifa-0.2~svn82/frame.c:1762:100: [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. faifa_printf(out_stream, "Access: 0x%02hX (%s)\n", net_info->access, get_net_access_str(net_info->access)); data/faifa-0.2~svn82/homeplug_av.h:452:11: [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. u_int8_t access:1; data/faifa-0.2~svn82/homeplug_av.h:485:11: [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. u_int8_t access:1; data/faifa-0.2~svn82/homeplug_av.h:982:11: [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. u_int8_t access; data/faifa-0.2~svn82/frame.c:715:2: [3] (random) srand: 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. srand(getpid()); data/faifa-0.2~svn82/frame.c:716:35: [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. mm->cookie = (long unsigned int)(random()); data/faifa-0.2~svn82/frame.c:923:2: [3] (random) srand: 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. srand(getpid()); data/faifa-0.2~svn82/frame.c:924:34: [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. mm->session_id = (unsigned int)(random()); data/faifa-0.2~svn82/frame.c:1250:2: [3] (random) srand: 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. srand(getpid()); data/faifa-0.2~svn82/frame.c:1251:34: [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. mm->session_id = (unsigned int)(random()); data/faifa-0.2~svn82/main.c:110:14: [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 ((c = getopt(argc, argv, "i:ma:k:ve:o:s:h")) != -1) { data/faifa-0.2~svn82/crypto.c:46:10: [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. unsigned char hash_value[HASH_SIZ]; data/faifa-0.2~svn82/crypto.c:70:3: [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(secret->value, (unsigned char *)isecret, l); data/faifa-0.2~svn82/crypto.c:79:3: [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(&secret->value[secret->len], (unsigned char*)isalt, SALT_SIZ); data/faifa-0.2~svn82/crypto.c:121:11: [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. unsigned char password_cpy[MAX_SECRET_SIZ + 1]; data/faifa-0.2~svn82/crypto.c:125:2: [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((unsigned char *)password_cpy, password, MAX_SECRET_SIZ); data/faifa-0.2~svn82/crypto.c:134:2: [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(key, password_hash, 16); data/faifa-0.2~svn82/faifa.c:101: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 pcap_errbuf[PCAP_ERRBUF_SIZE]; data/faifa-0.2~svn82/faifa.c:212:2: [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(buf, pcap_data, len); data/faifa-0.2~svn82/faifa.c:301:2: [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(hwaddr, &(ifr.ifr_hwaddr), ETHER_ADDR_LEN); data/faifa-0.2~svn82/faifa.c:341:2: [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(faifa->dst_addr, addr, ETHER_ADDR_LEN); data/faifa-0.2~svn82/faifa_priv.h:66: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 ifname[IFNAMSIZ]; data/faifa-0.2~svn82/faifa_priv.h:68: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 error[256]; data/faifa-0.2~svn82/frame.c:505: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 filename[256]; data/faifa-0.2~svn82/frame.c:517:7: [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(filename, "rb"); data/faifa-0.2~svn82/frame.c:541:2: [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(&(mm->data), buffer, size); data/faifa-0.2~svn82/frame.c:1351:2: [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(mm->data, eth_test_frame, sizeof(eth_test_frame)); data/faifa-0.2~svn82/frame.c:1390: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 nek[16], dek[16]; data/faifa-0.2~svn82/frame.c:1405:2: [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(mm->nmk, key, AES_KEY_SIZE); data/faifa-0.2~svn82/frame.c:1414:3: [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(mm->nmk_payload, dak, AES_KEY_SIZE); data/faifa-0.2~svn82/frame.c:2181:2: [2] (buffer) bcopy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. bcopy(oui, raw, 3); data/faifa-0.2~svn82/frame.c:2273:2: [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(header->ether_dhost, da, ETHER_ADDR_LEN); data/faifa-0.2~svn82/frame.c:2277:3: [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(header->ether_shost, sa, ETHER_ADDR_LEN); data/faifa-0.2~svn82/main.c:154:16: [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). err_stream = fopen(opt_err_stream, "w+"); data/faifa-0.2~svn82/main.c:164:16: [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). out_stream = fopen(opt_out_stream, "w+"); data/faifa-0.2~svn82/main.c:174:15: [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). in_stream = fopen(opt_in_stream, "rb"); data/faifa-0.2~svn82/crypto.c:66:22: [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). l = (unsigned char)strlen((char *)isecret); data/faifa-0.2~svn82/faifa.c:180:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(faifa->ifname, name, sizeof(faifa->ifname)); data/faifa-0.2~svn82/faifa.c:294:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(ifr.ifr_name, faifa->ifname, sizeof(ifr.ifr_name) - 1); data/faifa-0.2~svn82/faifa.c:320:6: [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(mac) != 17) { ANALYSIS SUMMARY: Hits = 52 Lines analyzed = 5111 in approximately 0.18 seconds (28072 lines/second) Physical Source Lines of Code (SLOC) = 3523 Hits@level = [0] 36 [1] 4 [2] 25 [3] 7 [4] 16 [5] 0 Hits@level+ = [0+] 88 [1+] 52 [2+] 48 [3+] 23 [4+] 16 [5+] 0 Hits/KSLOC@level+ = [0+] 24.9787 [1+] 14.7601 [2+] 13.6248 [3+] 6.52853 [4+] 4.54158 [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.