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/bruteforce-luks-1.3.1/src/bruteforce-luks.c Examining data/bruteforce-luks-1.3.1/src/version.h FINAL RESULTS: data/bruteforce-luks-1.3.1/src/bruteforce-luks.c:578: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, "b:e:f:hl:m:s:t:v:w:")) != -1) data/bruteforce-luks-1.3.1/src/bruteforce-luks.c:47: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 last_pass[LAST_PASS_MAX_SHOWN_LENGTH]; data/bruteforce-luks-1.3.1/src/bruteforce-luks.c:72:3: [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 datestr[256]; data/bruteforce-luks-1.3.1/src/bruteforce-luks.c:326:17: [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). FILE *state = fopen(state_file, "w+"); data/bruteforce-luks-1.3.1/src/bruteforce-luks.c:368:17: [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). FILE *state = fopen(state_file, "r"); data/bruteforce-luks-1.3.1/src/bruteforce-luks.c:491:18: [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). dictionary = fopen(dictionary_file, "r"); data/bruteforce-luks-1.3.1/src/bruteforce-luks.c:615:20: [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). dictionary = fopen(dictionary_file, "r"); data/bruteforce-luks-1.3.1/src/bruteforce-luks.c:629:32: [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). min_len = (unsigned int) atoi(optarg); data/bruteforce-luks-1.3.1/src/bruteforce-luks.c:633:32: [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). max_len = (unsigned int) atoi(optarg); data/bruteforce-luks-1.3.1/src/bruteforce-luks.c:658:35: [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). nb_threads = (unsigned int) atoi(optarg); data/bruteforce-luks-1.3.1/src/bruteforce-luks.c:664:40: [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). status_interval = (unsigned int) atoi(optarg); data/bruteforce-luks-1.3.1/src/bruteforce-luks.c:165:3: [1] (buffer) wcsncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). wcsncpy(password, prefix, prefix_len); data/bruteforce-luks-1.3.1/src/bruteforce-luks.c:168:3: [1] (buffer) wcsncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). wcsncpy(password + prefix_len + len, suffix, suffix_len); data/bruteforce-luks-1.3.1/src/bruteforce-luks.c:223:11: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = fgetc(dictionary); ANALYSIS SUMMARY: Hits = 14 Lines analyzed = 855 in approximately 0.05 seconds (16323 lines/second) Physical Source Lines of Code (SLOC) = 683 Hits@level = [0] 105 [1] 3 [2] 10 [3] 1 [4] 0 [5] 0 Hits@level+ = [0+] 119 [1+] 14 [2+] 11 [3+] 1 [4+] 0 [5+] 0 Hits/KSLOC@level+ = [0+] 174.231 [1+] 20.4978 [2+] 16.1054 [3+] 1.46413 [4+] 0 [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.