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/lua-ljsyscall-0.12/examples/cstub.c Examining data/lua-ljsyscall-0.12/examples/dl.c FINAL RESULTS: data/lua-ljsyscall-0.12/examples/dl.c:278:44: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. if (strcmp(symbol, "chmod") == 0) return chmod; data/lua-ljsyscall-0.12/examples/dl.c:279:44: [5] (race) chown: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchown( ) instead. if (strcmp(symbol, "chown") == 0) return chown; data/lua-ljsyscall-0.12/examples/dl.c:386:47: [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. if (strcmp(symbol, "readlink") == 0) return readlink; data/lua-ljsyscall-0.12/examples/dl.c:274:45: [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 (strcmp(symbol, "access") == 0) return access; data/lua-ljsyscall-0.12/examples/dl.c:280:45: [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 (strcmp(symbol, "chroot") == 0) return chroot; data/lua-ljsyscall-0.12/examples/dl.c:374:43: [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 (strcmp(symbol, "open") == 0) return open; data/lua-ljsyscall-0.12/examples/dl.c:387:43: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (strcmp(symbol, "read") == 0) return read; data/lua-ljsyscall-0.12/examples/dl.c:420:44: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). if (strcmp(symbol, "umask") == 0) return umask; ANALYSIS SUMMARY: Hits = 8 Lines analyzed = 484 in approximately 0.06 seconds (7880 lines/second) Physical Source Lines of Code (SLOC) = 434 Hits@level = [0] 5 [1] 2 [2] 1 [3] 1 [4] 1 [5] 3 Hits@level+ = [0+] 13 [1+] 8 [2+] 6 [3+] 5 [4+] 4 [5+] 3 Hits/KSLOC@level+ = [0+] 29.9539 [1+] 18.4332 [2+] 13.8249 [3+] 11.5207 [4+] 9.21659 [5+] 6.91244 Symlinks skipped = 1 (--allowlink overrides but see doc for security issue) 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.