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/titantools-4.0.11+notdfsg1/runas-v1.c Examining data/titantools-4.0.11+notdfsg1/runas-v2.c Examining data/titantools-4.0.11+notdfsg1/runas.c Examining data/titantools-4.0.11+notdfsg1/noshell.c Examining data/titantools-4.0.11+notdfsg1/stubs.c FINAL RESULTS: data/titantools-4.0.11+notdfsg1/noshell.c:69:3: [4] (misc) getlogin: It's often easy to fool getlogin. Sometimes it does not work at all, because some program messed up the utmp file. Often, it gives only the first 8 characters of the login name. The user currently logged in on the controlling tty of our program need not be the user who started it. Avoid getlogin() for security-related purposes (CWE-807). Use getpwuid(geteuid()) and extract the desired information instead. getlogin() data/titantools-4.0.11+notdfsg1/runas-v1.c:108:5: [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(argv[3], argv + 3); data/titantools-4.0.11+notdfsg1/runas-v2.c:126:5: [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(argv[4], argv + 4); data/titantools-4.0.11+notdfsg1/runas.c:171:5: [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(argv[4], argv + 4); data/titantools-4.0.11+notdfsg1/runas.c:55:17: [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, "c:")) != EOF) { data/titantools-4.0.11+notdfsg1/runas.c:133:6: [3] (misc) chroot: chroot can be very helpful, but is hard to use correctly (CWE-250, CWE-22). Make sure the program immediately chdir("/"), closes file descriptors, and drops root privileges, and that all necessary files (and no more!) are in the new root. if (chroot(chrootDir) < 0) { data/titantools-4.0.11+notdfsg1/runas-v1.c:65:11: [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). newGID = atoi(argv[2]); data/titantools-4.0.11+notdfsg1/runas-v1.c:83:11: [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). newUID = atoi(argv[1]); data/titantools-4.0.11+notdfsg1/runas-v2.c:62:11: [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). newGID = atoi(argv[2]); data/titantools-4.0.11+notdfsg1/runas-v2.c:80:11: [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). newUID = atoi(argv[1]); data/titantools-4.0.11+notdfsg1/runas.c:98:11: [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). newGID = atoi(argv[2]); data/titantools-4.0.11+notdfsg1/runas.c:116:11: [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). newUID = atoi(argv[1]); data/titantools-4.0.11+notdfsg1/runas-v2.c:123:12: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). (void) umask(uMask); data/titantools-4.0.11+notdfsg1/runas.c:168:12: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). (void) umask(uMask); ANALYSIS SUMMARY: Hits = 14 Lines analyzed = 518 in approximately 0.03 seconds (16440 lines/second) Physical Source Lines of Code (SLOC) = 329 Hits@level = [0] 36 [1] 2 [2] 6 [3] 2 [4] 4 [5] 0 Hits@level+ = [0+] 50 [1+] 14 [2+] 12 [3+] 6 [4+] 4 [5+] 0 Hits/KSLOC@level+ = [0+] 151.976 [1+] 42.5532 [2+] 36.4742 [3+] 18.2371 [4+] 12.1581 [5+] 0 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.