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/mandos-1.8.12/plugins.d/splashy.c Examining data/mandos-1.8.12/plugins.d/askpass-fifo.c Examining data/mandos-1.8.12/plugins.d/plymouth.c Examining data/mandos-1.8.12/plugins.d/usplash.c Examining data/mandos-1.8.12/plugins.d/password-prompt.c Examining data/mandos-1.8.12/plugins.d/mandos-client.c Examining data/mandos-1.8.12/plugin-runner.c Examining data/mandos-1.8.12/dracut-module/password-agent.c Examining data/mandos-1.8.12/plugin-helpers/mandos-client-iprouteadddel.c FINAL RESULTS: data/mandos-1.8.12/plugins.d/plymouth.c:305:18: [5] (race) readlink: This accepts filename arguments; if an attacker can move those files or change the link content, a race condition results. Also, it does not terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach. ssize_t sret = readlink(exe_link, exe_target, sizeof(exe_target)); data/mandos-1.8.12/plugins.d/splashy.c:219:9: [5] (race) readlink: This accepts filename arguments; if an attacker can move those files or change the link content, a race condition results. Also, it does not terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach. sret = readlink(exe_link, exe_target, sizeof(exe_target)); data/mandos-1.8.12/plugins.d/usplash.c:236:14: [5] (race) readlink: This accepts filename arguments; if an attacker can move those files or change the link content, a race condition results. Also, it does not terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach. sret = readlink(exe_link, exe_target, sizeof(exe_target)); data/mandos-1.8.12/dracut-module/password-agent.c:862:5: [4] (shell) execv: 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. execv(argv[0], (char **)argv); data/mandos-1.8.12/dracut-module/password-agent.c:5135:19: [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. If the scanf format is influenceable by an attacker, it's exploitable. g_assert_cmpint(fscanf(sysctl_pid_max, "%" PRIuMAX, &pid_max), data/mandos-1.8.12/plugin-helpers/mandos-client-iprouteadddel.c:92:10: [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. return vfprintf(stream, format, ap); data/mandos-1.8.12/plugin-runner.c:247: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(*envdef, def); data/mandos-1.8.12/plugin-runner.c:1292:28: [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 *passwordbuffer = getpass("Password: "); data/mandos-1.8.12/plugins.d/askpass-fifo.c:64:5: [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(stderr, formatstring, ap); data/mandos-1.8.12/plugins.d/mandos-client.c:209:34: [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. return (int)TEMP_FAILURE_RETRY(vfprintf(stream, format, ap)); data/mandos-1.8.12/plugins.d/password-prompt.c:90:5: [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(stderr, formatstring, ap); data/mandos-1.8.12/plugins.d/password-prompt.c:114: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("/run/plymouth/pid", R_OK) == 0){ data/mandos-1.8.12/plugins.d/plymouth.c:89:10: [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. return vfprintf(stream, format, ap); data/mandos-1.8.12/plugins.d/plymouth.c:105:5: [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(stderr, formatstring, ap); data/mandos-1.8.12/plugins.d/plymouth.c:229:5: [4] (shell) execv: 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. execv(path, (char *const *)new_argv); data/mandos-1.8.12/plugins.d/plymouth.c:321:11: [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. If the scanf format is influenceable by an attacker, it's exploitable. ret = fscanf(pidfile, "%" SCNuMAX, &proc_id); data/mandos-1.8.12/plugins.d/plymouth.c:331:13: [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. If the scanf format is influenceable by an attacker, it's exploitable. ret = fscanf(pidfile, "%" SCNuMAX, &proc_id); data/mandos-1.8.12/plugins.d/plymouth.c:342:13: [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. If the scanf format is influenceable by an attacker, it's exploitable. ret = fscanf(pidfile, "%" SCNuMAX, &proc_id); data/mandos-1.8.12/plugins.d/plymouth.c:359:10: [4] (buffer) sscanf: 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. If the scanf format is influenceable by an attacker, it's exploitable. ret = sscanf(direntries[i]->d_name, "%" SCNuMAX, &proc_id); data/mandos-1.8.12/plugins.d/plymouth.c:507: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. ret = access(plymouth_path, X_OK); data/mandos-1.8.12/plugins.d/splashy.c:77:5: [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(stderr, formatstring, ap); data/mandos-1.8.12/plugins.d/splashy.c:323:7: [4] (shell) execl: 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. execl(splashy_command, splashy_command, prompt, (char *)NULL); data/mandos-1.8.12/plugins.d/splashy.c:430:7: [4] (shell) execl: 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. execl("/sbin/splashy", "/sbin/splashy", "boot", (char *)NULL); data/mandos-1.8.12/plugins.d/usplash.c:74:5: [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(stderr, formatstring, ap); data/mandos-1.8.12/plugins.d/usplash.c:640:5: [4] (shell) execv: 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. execv(usplash_name, cmdline_argv); data/mandos-1.8.12/plugins.d/mandos-client.c:1042:27: [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 *pluginhelperdir = getenv("MANDOSPLUGINHELPERDIR"); data/mandos-1.8.12/plugins.d/mandos-client.c:2841:3: [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((unsigned int) time(NULL)); data/mandos-1.8.12/plugins.d/password-prompt.c:445:33: [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 *cryptsource = getenv("CRYPTTAB_SOURCE"); data/mandos-1.8.12/plugins.d/password-prompt.c:446:33: [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 *crypttarget = getenv("CRYPTTAB_NAME"); data/mandos-1.8.12/plugins.d/password-prompt.c:449: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. cryptsource = getenv("cryptsource"); data/mandos-1.8.12/plugins.d/password-prompt.c:452: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. crypttarget = getenv("crypttarget"); data/mandos-1.8.12/plugins.d/plymouth.c:120:35: [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 *const cryptsource = getenv("cryptsource"); data/mandos-1.8.12/plugins.d/plymouth.c:121:35: [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 *const crypttarget = getenv("crypttarget"); data/mandos-1.8.12/plugins.d/splashy.c:108:37: [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 *const cryptsource = getenv("cryptsource"); data/mandos-1.8.12/plugins.d/splashy.c:109:37: [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 *const crypttarget = getenv("crypttarget"); data/mandos-1.8.12/plugins.d/usplash.c:153:35: [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 *const cryptsource = getenv("cryptsource"); data/mandos-1.8.12/plugins.d/usplash.c:154:35: [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 *const crypttarget = getenv("crypttarget"); data/mandos-1.8.12/dracut-module/password-agent.c:676: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(&(queue->tasks[queue->length++]), &task, data/mandos-1.8.12/dracut-module/password-agent.c:965:7: [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(new_buffer, password->data, password->length); data/mandos-1.8.12/dracut-module/password-agent.c:1094: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 name_buffer[NAME_MAX + 1]; data/mandos-1.8.12/dracut-module/password-agent.c:1500: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(send_buffer + 1, password->data, password->length); data/mandos-1.8.12/dracut-module/password-agent.c:1911:19: [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 *devnull = fopen("/dev/null", "we"); data/mandos-1.8.12/dracut-module/password-agent.c:2220: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). FILE *fdinfo = fopen(fdinfo_name, "r"); data/mandos-1.8.12/dracut-module/password-agent.c:2270:30: [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). const int devnull_fd = open("/dev/null", data/mandos-1.8.12/dracut-module/password-agent.c:2300:25: [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). const int devnull_fd = open("/dev/null", data/mandos-1.8.12/dracut-module/password-agent.c:2798:19: [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 *devnull = fopen("/dev/null", "we"); data/mandos-1.8.12/dracut-module/password-agent.c:2951:28: [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). const int devnull_fd = open("/dev/null", data/mandos-1.8.12/dracut-module/password-agent.c:3022:28: [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). const int devnull_fd = open("/dev/null", data/mandos-1.8.12/dracut-module/password-agent.c:3067:18: [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). const int fd = open("/proc/self/mem", data/mandos-1.8.12/dracut-module/password-agent.c:3349: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 password_expected[PIPE_BUF]; data/mandos-1.8.12/dracut-module/password-agent.c:3350: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(password_expected, password.data, PIPE_BUF); data/mandos-1.8.12/dracut-module/password-agent.c:3487:19: [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 *devnull = fopen("/dev/null", "we"); data/mandos-1.8.12/dracut-module/password-agent.c:3525:19: [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 *devnull = fopen("/dev/null", "we"); data/mandos-1.8.12/dracut-module/password-agent.c:3923:21: [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). int tempfile_fd = open(tempfile, O_WRONLY | O_CLOEXEC | O_NOCTTY data/mandos-1.8.12/dracut-module/password-agent.c:3982:18: [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). const int fd = open("/proc/self/mem", data/mandos-1.8.12/dracut-module/password-agent.c:4170: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 name_buffer[NAME_MAX + 1]; data/mandos-1.8.12/dracut-module/password-agent.c:4177: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(ievent->name, dummy_file_name, sizeof(dummy_file_name)); data/mandos-1.8.12/dracut-module/password-agent.c:4265: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 name_buffer[NAME_MAX + 1]; data/mandos-1.8.12/dracut-module/password-agent.c:4272: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(ievent->name, dummy_file_name, sizeof(dummy_file_name)); data/mandos-1.8.12/dracut-module/password-agent.c:4362: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 name_buffer[NAME_MAX + 1]; data/mandos-1.8.12/dracut-module/password-agent.c:4369: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(ievent->name, dummy_file_name, sizeof(dummy_file_name)); data/mandos-1.8.12/dracut-module/password-agent.c:4447: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 name_buffer[NAME_MAX + 1]; data/mandos-1.8.12/dracut-module/password-agent.c:4454: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(ievent->name, dummy_file_name, sizeof(dummy_file_name)); data/mandos-1.8.12/dracut-module/password-agent.c:4531: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 name_buffer[NAME_MAX + 1]; data/mandos-1.8.12/dracut-module/password-agent.c:4538: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(ievent->name, dummy_file_name, sizeof(dummy_file_name)); data/mandos-1.8.12/dracut-module/password-agent.c:4607: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 name_buffer[NAME_MAX + 1]; data/mandos-1.8.12/dracut-module/password-agent.c:4614: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(ievent->name, dummy_file_name, sizeof(dummy_file_name)); data/mandos-1.8.12/dracut-module/password-agent.c:4686: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 name_buffer[NAME_MAX + 1]; data/mandos-1.8.12/dracut-module/password-agent.c:4693: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(ievent->name, dummy_file_name, sizeof(dummy_file_name)); data/mandos-1.8.12/dracut-module/password-agent.c:4771: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 name_buffer[NAME_MAX + 1]; data/mandos-1.8.12/dracut-module/password-agent.c:4778: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(ievent->name, dummy_file_name, sizeof(dummy_file_name)); data/mandos-1.8.12/dracut-module/password-agent.c:5133:26: [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 *sysctl_pid_max = fopen("/proc/sys/kernel/pid_max", "r"); data/mandos-1.8.12/dracut-module/password-agent.c:5589: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 socket_name[sizeof(unix_socket.sun_path)]; data/mandos-1.8.12/dracut-module/password-agent.c:5674:26: [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). const int epoll_fd = open("/dev/null", data/mandos-1.8.12/dracut-module/password-agent.c:5807: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 write_data[PIPE_BUF]; data/mandos-1.8.12/dracut-module/password-agent.c:5823: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 read_data[sizeof(write_data)]; data/mandos-1.8.12/dracut-module/password-agent.c:6089:26: [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). const int epoll_fd = open("/dev/null", data/mandos-1.8.12/dracut-module/password-agent.c:6180:5: [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(expected_written_data + 1, password.data, password.length); data/mandos-1.8.12/dracut-module/password-agent.c:6185: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 buf[PIPE_BUF]; data/mandos-1.8.12/dracut-module/password-agent.c:6297: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(password.data, test_password, password.allocated); data/mandos-1.8.12/dracut-module/password-agent.c:6359:28: [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). const int devnull_fd = open("/dev/null", data/mandos-1.8.12/dracut-module/password-agent.c:7229:19: [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 *devnull = fopen("/dev/null", "we"); data/mandos-1.8.12/plugin-runner.c:677: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). conffp = fopen(AFILE, "r"); data/mandos-1.8.12/plugin-runner.c:679: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). conffp = fopen(argfile, "r"); data/mandos-1.8.12/plugin-runner.c:842:24: [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). int plugindir_fd = open(/* plugindir or */ PDIR, O_RDONLY); data/mandos-1.8.12/plugin-runner.c:875: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). dir_fd = open(plugindir != NULL ? plugindir : PDIR, O_RDONLY | data/mandos-1.8.12/plugins.d/askpass-fifo.c:116:17: [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). int fifo_fd = open(passfifo, O_RDONLY); data/mandos-1.8.12/plugins.d/mandos-client.c:354:34: [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). fd = (int)TEMP_FAILURE_RETRY(open(filename, O_RDONLY)); data/mandos-1.8.12/plugins.d/mandos-client.c:777:21: [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). int dhpfile = open(dhparamsfilename, O_RDONLY); data/mandos-1.8.12/plugins.d/mandos-client.c:840: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). int secfile = open(seckeyfilename, O_RDONLY); data/mandos-1.8.12/plugins.d/mandos-client.c:1051: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 interface[IF_NAMESIZE]; data/mandos-1.8.12/plugins.d/mandos-client.c:1057:41: [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). int devnull = (int)TEMP_FAILURE_RETRY(open("/dev/null", O_RDONLY)); data/mandos-1.8.12/plugins.d/mandos-client.c:1103:48: [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). int helperdir_fd = (int)TEMP_FAILURE_RETRY(open(pluginhelperdir, data/mandos-1.8.12/plugins.d/mandos-client.c:1262: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 interface[IF_NAMESIZE]; data/mandos-1.8.12/plugins.d/mandos-client.c:1344:7: [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 interface[IF_NAMESIZE]; data/mandos-1.8.12/plugins.d/mandos-client.c:1355: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 addrstr[(INET_ADDRSTRLEN > INET6_ADDRSTRLEN) ? data/mandos-1.8.12/plugins.d/mandos-client.c:1702:7: [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 ip[AVAHI_ADDRESS_STR_MAX]; data/mandos-1.8.12/plugins.d/mandos-client.c:2088:18: [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). hookdir_fd = open(hookdir, O_RDONLY | O_DIRECTORY | O_PATH data/mandos-1.8.12/plugins.d/mandos-client.c:2102:41: [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). int devnull = (int)TEMP_FAILURE_RETRY(open("/dev/null", O_RDONLY)); data/mandos-1.8.12/plugins.d/mandos-client.c:2730:18: [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). int seckey_fd = open(seckey, O_RDONLY); data/mandos-1.8.12/plugins.d/mandos-client.c:2751:18: [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). int pubkey_fd = open(pubkey, O_RDONLY); data/mandos-1.8.12/plugins.d/mandos-client.c:2773:20: [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). int dhparams_fd = open(dh_params_file, O_RDONLY); data/mandos-1.8.12/plugins.d/mandos-client.c:2827:7: [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(interfaces_hooks, mc.interfaces, mc.interfaces_size); data/mandos-1.8.12/plugins.d/password-prompt.c:143:13: [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). cl_fd = open(cmdline_filename, O_RDONLY); data/mandos-1.8.12/plugins.d/plymouth.c:280: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 exe_target[sizeof(plymouthd_path)]; data/mandos-1.8.12/plugins.d/plymouth.c:318:19: [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 *pidfile = fopen(plymouth_pid, "r"); data/mandos-1.8.12/plugins.d/plymouth.c:329: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). pidfile = fopen(plymouth_old_pid, "r"); data/mandos-1.8.12/plugins.d/plymouth.c:340: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). pidfile = fopen(plymouth_old_old_pid, "r"); data/mandos-1.8.12/plugins.d/plymouth.c:394: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). cl_fd = open(cmdline_filename, O_RDONLY); data/mandos-1.8.12/plugins.d/splashy.c:177:7: [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 exe_target[sizeof(splashy_name)]; data/mandos-1.8.12/plugins.d/usplash.c:103: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). ret = open("/dev/.initramfs/usplash_fifo", O_WRONLY); data/mandos-1.8.12/plugins.d/usplash.c:207: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 exe_target[sizeof(usplash_name)]; data/mandos-1.8.12/plugins.d/usplash.c:259: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). cl_fd = open(cmdline_filename, O_RDONLY); data/mandos-1.8.12/plugins.d/usplash.c:458: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). outfifo_fd = open("/dev/.initramfs/usplash_outfifo", O_RDONLY); data/mandos-1.8.12/dracut-module/password-agent.c:982:31: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). const ssize_t read_length = read(fd, password->data data/mandos-1.8.12/dracut-module/password-agent.c:1098:31: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). const ssize_t read_length = read(fd, ievent, ievent_size); data/mandos-1.8.12/dracut-module/password-agent.c:1234: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(socket_name) == 0){ data/mandos-1.8.12/dracut-module/password-agent.c:1360:36: [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(sizeof(sock_name.sun_path) <= strlen(filename)){ data/mandos-1.8.12/dracut-module/password-agent.c:1390:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(sock_name.sun_path, filename, sizeof(sock_name.sun_path)); data/mandos-1.8.12/dracut-module/password-agent.c:3587:19: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). g_assert_cmpint(read(added_read_task->fd, ievent, ievent_size), ==, data/mandos-1.8.12/dracut-module/password-agent.c:3652:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read_size = read(added_read_task->fd, ievent, ievent_size); data/mandos-1.8.12/dracut-module/password-agent.c:3747:23: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t read_size = read(added_read_task->fd, ievent, ievent_size); data/mandos-1.8.12/dracut-module/password-agent.c:3818:23: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t read_size = read(added_read_task->fd, ievent, ievent_size); data/mandos-1.8.12/dracut-module/password-agent.c:3884:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read_size = read(added_read_task->fd, ievent, ievent_size); data/mandos-1.8.12/dracut-module/password-agent.c:3952:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read_size = read(added_read_task->fd, ievent, ievent_size); data/mandos-1.8.12/dracut-module/password-agent.c:3962:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read_size = read(added_read_task->fd, ievent, ievent_size); data/mandos-1.8.12/dracut-module/password-agent.c:5699:24: [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). g_assert_cmpint((int)strlen(filename), <, data/mandos-1.8.12/dracut-module/password-agent.c:5701:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(sock_name.sun_path, filename, sizeof(sock_name.sun_path)); data/mandos-1.8.12/dracut-module/password-agent.c:5763:24: [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). g_assert_cmpint((int)strlen(filename), <, data/mandos-1.8.12/dracut-module/password-agent.c:5765:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(sock_name.sun_path, filename, sizeof(sock_name.sun_path)); data/mandos-1.8.12/dracut-module/password-agent.c:5824:24: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). g_assert_cmpint((int)read(sock_fd, read_data, sizeof(read_data)), data/mandos-1.8.12/dracut-module/password-agent.c:6186:24: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). g_assert_cmpint((int)read(read_socket, buf, PIPE_BUF), ==, data/mandos-1.8.12/dracut-module/password-agent.c:6249:15: [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). .length = strlen(dummy_test_password), data/mandos-1.8.12/plugin-runner.c:241:34: [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). new_envdef = realloc(*envdef, strlen(def) + 1); data/mandos-1.8.12/plugin-runner.c:1265:33: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). sret = TEMP_FAILURE_RETRY(read(proc->fd, data/mandos-1.8.12/plugin-runner.c:1293: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). size_t len = strlen(passwordbuffer); data/mandos-1.8.12/plugins.d/askpass-fifo.c:164:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). sret = read(fifo_fd, buf + buf_len, buf_allocated - buf_len); data/mandos-1.8.12/plugins.d/mandos-client.c:795:23: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t bytes_read = read(dhpfile, data/mandos-1.8.12/plugins.d/mandos-client.c:856:25: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t bytes_read = read(secfile, data/mandos-1.8.12/plugins.d/mandos-client.c:1442:23: [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). size_t out_size = strlen(out); data/mandos-1.8.12/plugins.d/mandos-client.c:1815:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(ifr->ifr_name, ifname, IF_NAMESIZE); data/mandos-1.8.12/plugins.d/password-prompt.c:174:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). sret = read(cl_fd, cmdline + cmdline_len, data/mandos-1.8.12/plugins.d/plymouth.c:421:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). sret = read(cl_fd, cmdline + cmdline_len, data/mandos-1.8.12/plugins.d/usplash.c:115:20: [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). cmd_line_len = strlen(cmd) + 1; data/mandos-1.8.12/plugins.d/usplash.c:282:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). sret = read(cl_fd, cmdline + cmdline_len, data/mandos-1.8.12/plugins.d/usplash.c:488:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). sret = read(outfifo_fd, buf + buf_len, ANALYSIS SUMMARY: Hits = 146 Lines analyzed = 15737 in approximately 0.39 seconds (40420 lines/second) Physical Source Lines of Code (SLOC) = 13161 Hits@level = [0] 73 [1] 32 [2] 77 [3] 12 [4] 22 [5] 3 Hits@level+ = [0+] 219 [1+] 146 [2+] 114 [3+] 37 [4+] 25 [5+] 3 Hits/KSLOC@level+ = [0+] 16.6401 [1+] 11.0934 [2+] 8.66196 [3+] 2.81134 [4+] 1.89955 [5+] 0.227946 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.