Commit Graph

28 Commits

Author SHA1 Message Date
Todd C. Miller
eefb7b0d54 Use a consistent version of fuzz_conversation() with all fuzzers.
Also undo a change to fuzz_sudoers.c that snuck in to the last commit.
2021-09-28 20:20:28 -06:00
Todd C. Miller
7d964875df Fuzzers should not produce output.
Excessive output makes the fuzzer runs much less efficient.
2021-09-28 18:53:49 -06:00
Todd C. Miller
132936f8f0 Make it possible to call the sudoers policy check function multiple times.
We need to reset the Defaults values to their original state.
2021-08-09 15:50:25 -06:00
Todd C. Miller
532e00aa2b Only replace getaddrinfo for FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION.
This works around an issue on SCO which uses inline functions in
the header files which call the actual, versioned, library function.
2021-07-26 11:39:41 -06:00
Todd C. Miller
17a415ae77 Add log_exit_status sudoers option to log when a command exits.
This option defaults to off.
2021-07-09 11:08:44 -06:00
Todd C. Miller
95bfd65fec Flush stdout before successful return from LLVMFuzzerTestOneInput().
Fixes a problem with diag lines from libFuzzer being interspersed
with test output.
2021-03-18 13:08:30 -06:00
Todd C. Miller
4a28b5d587 In find_path() stub only make a copy in outfile if returning FOUND.
Fixed a recently-introduced memory leak in the fuzzer.
2021-03-01 07:22:57 -07:00
Todd C. Miller
0c944576e9 Expand stub getaddrinfo() to resolve "localhost". 2021-02-28 19:52:02 -07:00
Todd C. Miller
cfcbc42ec7 Improve fuzz_policy coverage and set defaults in setdefs not parse.
Now exercises session open/close and set additional defaults to
exercise more code paths.
2021-02-28 19:52:01 -07:00
Todd C. Miller
3fc5932be0 Add a stub getaddrinfo(3) to avoid a DNS timeout in CIfuzz. 2021-02-25 21:12:03 -07:00
Todd C. Miller
8b545e561c Fix runchroot, runcwd, tty_tickets. Add timestampowner. 2021-02-25 20:06:35 -07:00
Todd C. Miller
d75db837bd Add some defaults settings in sudo_file_parse().
We don't have a real policy file but we still want to exercise callbacks
in sudoers.c.
2021-02-25 19:40:46 -07:00
Todd C. Miller
65df01dd71 Add more passes to policy fuzzer
Now execises list, list other user and show_version.
2021-02-25 15:27:46 -07:00
Todd C. Miller
b3b80fe6df Implement sudoers_policy_deregister_hooks()
Register/deregister hooks in fuzz_policy and also call show_version().
2021-02-25 15:02:09 -07:00
Todd C. Miller
e6dc13229f Add sudoers debug register/deregister. 2021-02-25 13:35:29 -07:00
Todd C. Miller
05767145b3 Add fuzzer-specific stubs source file. 2021-02-24 16:43:59 -07:00
Todd C. Miller
a3f38fac0c Set program name in fuzzers so we get consisten warnings. 2021-02-24 15:14:58 -07:00
Todd C. Miller
9d27880af8 Use real eventlog config fuctions instead of stubs. 2021-02-24 15:08:53 -07:00
Todd C. Miller
f35d9c8be1 fuzz_printf and fuzz_conversation can be stubs. 2021-02-24 11:31:43 -07:00
Todd C. Miller
d02cc9c3ac Call list, validate and invalidate entry points too.
We need a separate open/close for each one.
2021-02-18 15:09:26 -07:00
Todd C. Miller
f76c59fc8f Restore the check for sudoers_policy.close == NULL.
The fuzzers run as part of "make check" too in which case NO_LEAKS
won't be defined and the close function will be set to NULL.
2021-02-18 07:58:34 -07:00
Todd C. Miller
ae3a098d2f Always dynamically allocate user_cmnd, it is freed in sudo_user_free().
Instead of setting user_cmnd in the policy functions, always set argv.
Calling sudoers_policy_main() with argc of 0 is no longer allowed.
2021-02-16 09:32:34 -07:00
Todd C. Miller
52e3fcc795 Free struct sudo_user in sudoers_policy_close() and sudoers_cleanup().
Also, do not NULL out the close function if NO_LEAKS is defined.
2021-02-15 08:29:47 -07:00
Todd C. Miller
7f3c670a13 Fix sudoers garbage collection and run it in policy fuzzer. 2021-02-14 14:01:31 -07:00
Todd C. Miller
561740cd54 Always dynamically allocate user_role, user_type, user_privs, user_limitprivs 2021-02-14 07:47:48 -07:00
Todd C. Miller
776c57a81e Move create_admin_success_flag() to timestamp.c. 2021-02-13 15:48:21 -07:00
Todd C. Miller
651a225a4a The push() function was not updating the size after reallocating. 2021-02-13 12:54:22 -07:00
Todd C. Miller
df2931588a Fuzz sudoers policy module API.
Includes a test case to reproduce CVE-2021-3156.
2021-02-12 15:36:18 -07:00