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/codecrypt-1.8/src/sencode.h Examining data/codecrypt-1.8/src/sha_hash.h Examining data/codecrypt-1.8/src/symkey.h Examining data/codecrypt-1.8/src/algo_suite.h Examining data/codecrypt-1.8/src/str_match.h Examining data/codecrypt-1.8/src/algorithm.h Examining data/codecrypt-1.8/src/algos_enc.h Examining data/codecrypt-1.8/src/privfile.h Examining data/codecrypt-1.8/src/algos_sig.h Examining data/codecrypt-1.8/src/tiger_hash.h Examining data/codecrypt-1.8/src/types.h Examining data/codecrypt-1.8/src/arcfour.h Examining data/codecrypt-1.8/src/vector_item.h Examining data/codecrypt-1.8/src/base64.h Examining data/codecrypt-1.8/src/xsynd.h Examining data/codecrypt-1.8/src/bvector.h Examining data/codecrypt-1.8/src/ios.h Examining data/codecrypt-1.8/src/keyring.h Examining data/codecrypt-1.8/src/pwrng.h Examining data/codecrypt-1.8/src/generator.h Examining data/codecrypt-1.8/src/matrix.h Examining data/codecrypt-1.8/src/actions.h Examining data/codecrypt-1.8/src/seclock.h Examining data/codecrypt-1.8/src/mce_qcmdpc.h Examining data/codecrypt-1.8/src/message.h Examining data/codecrypt-1.8/src/permutation.h Examining data/codecrypt-1.8/src/polynomial.h Examining data/codecrypt-1.8/src/prng.h Examining data/codecrypt-1.8/src/rmd_hash.h Examining data/codecrypt-1.8/src/chacha.h Examining data/codecrypt-1.8/src/cube_hash.h Examining data/codecrypt-1.8/src/cubehash_impl.h Examining data/codecrypt-1.8/src/decoding.h Examining data/codecrypt-1.8/src/envelope.h Examining data/codecrypt-1.8/src/factoryof.h Examining data/codecrypt-1.8/src/fft.h Examining data/codecrypt-1.8/src/fmtseq.h Examining data/codecrypt-1.8/src/gf2m.h Examining data/codecrypt-1.8/src/hash.h Examining data/codecrypt-1.8/src/hashfile.h Examining data/codecrypt-1.8/src/iohelpers.h Examining data/codecrypt-1.8/src/sc.h Examining data/codecrypt-1.8/src/serialization.cpp Examining data/codecrypt-1.8/src/algo_suite.cpp Examining data/codecrypt-1.8/src/str_match.cpp Examining data/codecrypt-1.8/src/generator.cpp Examining data/codecrypt-1.8/src/algos_enc.cpp Examining data/codecrypt-1.8/src/actions.cpp Examining data/codecrypt-1.8/src/ios.cpp Examining data/codecrypt-1.8/src/algos_sig.cpp Examining data/codecrypt-1.8/src/base64.cpp Examining data/codecrypt-1.8/src/xsynd.cpp Examining data/codecrypt-1.8/src/bvector.cpp Examining data/codecrypt-1.8/src/pwrng.cpp Examining data/codecrypt-1.8/src/sc.cpp Examining data/codecrypt-1.8/src/matrix.cpp Examining data/codecrypt-1.8/src/seclock.cpp Examining data/codecrypt-1.8/src/keyring.cpp Examining data/codecrypt-1.8/src/message.cpp Examining data/codecrypt-1.8/src/mce_qcmdpc.cpp Examining data/codecrypt-1.8/src/main.cpp Examining data/codecrypt-1.8/src/symkey.cpp Examining data/codecrypt-1.8/src/permutation.cpp Examining data/codecrypt-1.8/src/polynomial.cpp Examining data/codecrypt-1.8/src/chacha.cpp Examining data/codecrypt-1.8/src/privfile.cpp Examining data/codecrypt-1.8/src/envelope.cpp Examining data/codecrypt-1.8/src/fft.cpp Examining data/codecrypt-1.8/src/fmtseq.cpp Examining data/codecrypt-1.8/src/gf2m.cpp Examining data/codecrypt-1.8/src/hash.cpp Examining data/codecrypt-1.8/src/hashfile.cpp Examining data/codecrypt-1.8/src/sencode.cpp Examining data/codecrypt-1.8/src/iohelpers.cpp FINAL RESULTS: data/codecrypt-1.8/src/privfile.cpp:53:8: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. if (chmod (fn.c_str(), st.st_mode & ~07)) data/codecrypt-1.8/src/privfile.cpp:58: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 (fn.c_str(), R_OK | W_OK)) return false; data/codecrypt-1.8/src/pwrng.cpp:53:15: [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. char* pass = getpass (prompt.c_str()); data/codecrypt-1.8/src/algos_enc.cpp:129:27: [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. unsigned char rtmp = rng.random (256); data/codecrypt-1.8/src/algos_enc.cpp:146:16: [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. out[i] = rng.random (256); data/codecrypt-1.8/src/algos_enc.cpp:152:26: [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. out[out_end + i] = rng.random (256); data/codecrypt-1.8/src/algos_enc.cpp:248:44: [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. for (i = 0; i < K.size(); ++i) K[i] = rng.random (256); data/codecrypt-1.8/src/algos_enc.cpp:251:27: [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. K[plainsize >> 3] = rng.random (256) % (1 << (uint) (plainsize & 7)); data/codecrypt-1.8/src/envelope.cpp:175:24: [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. out[i] = letters[rng.random (36)]; data/codecrypt-1.8/src/fmtseq.cpp:277:20: [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. priv.SK[i] = rng.random (1 << 8); data/codecrypt-1.8/src/generator.cpp: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*user_source = getenv ("CCR_RANDOM_SEED"); data/codecrypt-1.8/src/generator.h:46: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. uint random (uint n) { data/codecrypt-1.8/src/keyring.cpp:279:19: [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. const char*tmp = getenv ("CCR_DIR"); data/codecrypt-1.8/src/keyring.cpp:281:20: [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. const char*home = getenv ("HOME"); data/codecrypt-1.8/src/main.cpp:204:7: [3] (buffer) getopt_long: 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. c = getopt_long data/codecrypt-1.8/src/main.cpp:338:16: [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. const char*u=getenv("CCR_USER"); data/codecrypt-1.8/src/mce_qcmdpc.cpp:53:24: [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. for (uint pos = rng.random (block_size); data/codecrypt-1.8/src/mce_qcmdpc.cpp:55:19: [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. pos = rng.random (block_size)); data/codecrypt-1.8/src/mce_qcmdpc.cpp:95:24: [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. for (uint pos = rng.random (block_size); data/codecrypt-1.8/src/mce_qcmdpc.cpp:97:19: [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. pos = rng.random (block_size)); data/codecrypt-1.8/src/mce_qcmdpc.cpp:137:23: [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. for (uint pos = rng.random (s); data/codecrypt-1.8/src/mce_qcmdpc.cpp:139:18: [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. pos = rng.random (s)); data/codecrypt-1.8/src/permutation.cpp:40:16: [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. uint j = rng.random (i + 1); data/codecrypt-1.8/src/prng.h:33:15: [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. virtual uint random (uint) = 0; data/codecrypt-1.8/src/pwrng.cpp:67:19: [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. const char*env = getenv (env_var.c_str()); data/codecrypt-1.8/src/pwrng.h:83: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. uint random (uint n) { data/codecrypt-1.8/src/seclock.cpp:65:28: [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. const char* algorithm = getenv (alg.c_str()); data/codecrypt-1.8/src/symkey.cpp:77:50: [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. for (uint i = 0; i < keysize; ++i) key[i] = rng.random (256); data/codecrypt-1.8/src/symkey.cpp:219:57: [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. for (uint i = 0; i < otkey.size(); ++i) otkey[i] = rng.random (256); data/codecrypt-1.8/src/actions.cpp:52: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). if (!KR.open()) { data/codecrypt-1.8/src/actions.cpp:478:9: [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). hf_out.open (symmetric == "-" ? "/dev/stdout" : symmetric.c_str(), data/codecrypt-1.8/src/actions.cpp:536:8: [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). detf.open (detach == "-" ? "/dev/stdout" : detach.c_str(), data/codecrypt-1.8/src/actions.cpp:658:8: [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). hf_in.open (symmetric == "-" ? "/dev/stdin" : symmetric.c_str(), data/codecrypt-1.8/src/actions.cpp:731:8: [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). detf.open (detach == "-" ? "/dev/stdin" : detach.c_str(), data/codecrypt-1.8/src/base64.cpp:23:23: [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 const unsigned char b64str[65] = data/codecrypt-1.8/src/generator.cpp:48:4: [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). f.open (seed_source, std::ios::in | std::ios::binary); data/codecrypt-1.8/src/iohelpers.cpp:26: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). alt_cin.open (fn.c_str(), std::ios::in | std::ios::binary); data/codecrypt-1.8/src/iohelpers.cpp:35:11: [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). alt_cout.open (fn.c_str(), std::ios::out | std::ios::binary); data/codecrypt-1.8/src/iohelpers.cpp:44:11: [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). alt_cerr.open (fn.c_str(), std::ios::out | std::ios::binary); data/codecrypt-1.8/src/iohelpers.h:55: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 buf[readall_bufsize]; data/codecrypt-1.8/src/keyring.cpp:464:15: [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). bool keyring::open() data/codecrypt-1.8/src/keyring.h:113:7: [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). bool open(); data/codecrypt-1.8/src/symkey.cpp:108:8: [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). sk_in.open (fn == "-" ? "/dev/stdin" : fn.c_str(), data/codecrypt-1.8/src/hashfile.cpp:106:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). in.read ( (char*) & (buf[0]), 8192); data/codecrypt-1.8/src/hashfile.cpp:147:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). in.read ( (char*) & (buf[0]), 8192); data/codecrypt-1.8/src/iohelpers.h:57:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). input.read (buf, readall_bufsize); data/codecrypt-1.8/src/keyring.cpp:360:5: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). in.read (&data[0], st.st_size); data/codecrypt-1.8/src/symkey.cpp:275:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). in.read ( (char*) & (buf[0]), blocksize); data/codecrypt-1.8/src/symkey.cpp:332:5: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). in.read ( (char*) & (otkey[0]), otkey.size()); data/codecrypt-1.8/src/symkey.cpp:386:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). in.read ( (char*) & (buf[0]), buf.size()); ANALYSIS SUMMARY: Hits = 50 Lines analyzed = 12309 in approximately 0.34 seconds (36244 lines/second) Physical Source Lines of Code (SLOC) = 7906 Hits@level = [0] 0 [1] 7 [2] 14 [3] 26 [4] 2 [5] 1 Hits@level+ = [0+] 50 [1+] 50 [2+] 43 [3+] 29 [4+] 3 [5+] 1 Hits/KSLOC@level+ = [0+] 6.32431 [1+] 6.32431 [2+] 5.43891 [3+] 3.6681 [4+] 0.379459 [5+] 0.126486 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.