aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2023-02-27Fix meridian type in getdate.yJulien Rische1-1/+2
Commit d3356bc42191c1896ab06835a2fb245e00471420 (ticket 8927) incorrectly tagged tMERIDIAN as <Number>. So while the lexer assigns meridian values to the Meridian union field, the parser erroneously reads them from the Number field. On 64-bit IBM zSystems (s390x), this can result in using the most recently read number as a meridian value, leading to an abort in ToSeconds(). Fix the tMERIDIAN token type to be <Meridian>. [ghudson@mit.edu: edited commit message] ticket: 9087 (new) tags: pullup target_version: 1.20-next
2023-02-13Fix read overruns in SPNEGO parsingGreg Hudson1-6/+10
Fix three read overruns discovered by the GitHub Security Lab team (GHSL-2023-016, GHSL-2023-017, and GHSL-2023-018) using OSS-Fuzz. In get_mech_set(), error out if gss_add_oid_set_member() fails rather than continue the loop and increment i past the current bound of returned_mechSet. In g_verify_neg_token_init(), check for zero-byte sequences before reading tag bytes, and reduce cur_size by one to account for the tag byte when calling gssint_get_der_length(). ticket: 9085 (new) tags: pullup target_version: 1.20-next target_version: 1.19-next
2023-02-01Add margin to expired tickets in test suiteGreg Hudson2-2/+2
Very occasionally a test using expired tickets will fail because the ticket isn't seen as expired. Obtain tickets with a longer expiration margin to avoid these failures.
2023-01-27Fix t_ndr to return a define value from main()Greg Hudson1-0/+1
2023-01-24Add PAC full checksumsGreg Hudson6-175/+240
A paper by Tom Tervoort noted that computing the PAC privsvr checksum over only the server checksum is vulnerable to collision attacks (CVE-2022-37967). In response, Microsoft has added a second KDC checksum over the full contents of the PAC. Generate and verify full KDC checksums in PACs for service tickets. Update the t_pac.c ticket test case to use a ticket issued by a recent version of Active Directory (provided by Stefan Metzmacher). ticket: 9084 (new)
2023-01-23Don't issue session keys with deprecated enctypesGreg Hudson10-20/+107
A paper by Tom Tervoort noted that rc4-hmac pre-hashes the input for its checksum and GSS operations before applying HMAC, and is therefore potentially vulnerable to hash collision attacks if a protocol contains a restricted signing oracle. In light of these potential attacks, begin the functional deprecation of DES3 and RC4 by disallowing their use as session key enctypes by default. Add the variables allow_des3 and allow_rc4 in case negotiability of these enctypes for session keys needs to be turned back on, with the expectation that in future releases the enctypes will be more comprehensively deprecated. ticket: 9081
2023-01-23In KDC, assume all services support aes256-sha1Greg Hudson2-3/+7
To facilitate negotiating session keys with acceptable security, assume that services support aes256-cts-hmac-sha1 unless a session_enctypes string attribute says otherwise. ticket: 9075
2023-01-19Remove man page includes from RST documentationGreg Hudson7-493/+147
Rewrite parts of database.rst and appl_servers.rst to avoid including full option descriptions from the (already linked) man pages.
2023-01-13Fix PKINIT CMS error checking for older OpenSSLGreg Hudson1-11/+3
Commit 70f61d417261ca17efe3d60d180033bea2da60b0 updated the CMS_verify() error code checks, using two error codes new to OpenSSL 3.0 (RSA_R_DIGEST_NOT_ALLOWED and CMS_R_UNKNOWN_DIGEST_ALGORITHM). This change broke the build for OpenSSL 1.0 and 1.1. Instead of looking for codes indicating an algorithm issue and assuming that everything else is an invalid signature, check for the code indicating an invalid signature and assume that everything else is an algorithm issue. ticket: 9069
2023-01-04Fix policy DB fallback error handlingGreg Hudson1-10/+5
In osa_adb_open_and_lock(), if the btree dbopen() call returns EINVAL or EFTYPE and the fallback hash dbopen() call also returns an error, release the lock and return an error instead of returning success with a null database. ticket: 9082 (new)
2023-01-04Fix kpropd crash with unrecognized optionabushwang1-0/+1
ticket: 9083 (new) tags: pullup target_version: 1.20-next target_version: 1.19-next
2022-12-26Remove unused Unicode functionsGreg Hudson19-5249/+7
2022-12-26Simplify krb5_chpw_message() UTF-8 processingGreg Hudson3-6/+33
Only validate the message as a UTF-8 string, rather than normalizing it.
2022-12-06Remove line continuations in et_c.awkgakamath2-20/+11
Line continuations cause issues for the awk in MinGW, so just have long lines instead. [ghudson@mit.edu: rewrote commit message; factored out some string constructions for readability]
2022-12-05Fix gic_keytab crash on memory exhaustionChenChen Zhou1-8/+4
get_as_key_keytab() does not check the result of krb5_copy_keyblock(), and dereferences a null pointer if it fails. Remove the call and steal the memory from kt_ent instead. [ghudson@mit.edu: rewrote commit message; fixed comments] ticket: 9080 (new)
2022-12-05Fix preauth crash on memory exhaustionChenChen Zhou1-0/+4
In k5_preauth_request_context_init(), check the result of calloc(). [ghudson@mit.edu: rewrote commit message; added free() of reqctx on error] ticket: 9079 (new)
2022-12-05Fix profile crash on memory exhaustionChenChen Zhou1-1/+1
In profile_get_values(), if init_list() fails to allocate values.list, end_list() will dereference a null pointer. Fix end_list() to handle list->list being null. [ghudson@mit.edu: rewrote commit message] ticket: 9078 (new)
2022-11-18Fix aclocal.m4 syntax error for autoconf 2.72Julien Rische1-2/+2
An incorrect closure inside KRB5_AC_INET6 is innocuous with autoconf versions up to 2.71, but will cause an error at configure time with the forthcoming autoconf 2.72. [ghudson@mit.edu: added more context to commit message] ticket: 9077 (new) tags: pullup target_version: 1.20-next target_version: 1.19-next
2022-11-17Add Georgian translationNorwayFun2-2/+9189
[ghudson@mit.edu: added the translation to po/Makefile.in]
2022-11-03Use memmove() in Unicode functionsGreg Hudson3-16/+16
Where the upstream OpenLDAP code uses AC_MEMCPY(), use memmove() instead of memcpy() as the copies frequently involve overlapping memory regions. Credit to OSS-Fuzz for discovering one instance of the issue. ticket: 9076 (new)
2022-11-03Fix integer overflows in PAC parsingGreg Hudson2-2/+25
In krb5_parse_pac(), check for buffer counts large enough to threaten integer overflow in the header length and memory length calculations. Avoid potential integer overflows when checking the length of each buffer. Credit to OSS-Fuzz for discovering one of the issues. CVE-2022-42898: In MIT krb5 releases 1.8 and later, an authenticated attacker may be able to cause a KDC or kadmind process to crash by reading beyond the bounds of allocated memory, creating a denial of service. A privileged attacker may similarly be able to cause a Kerberos or GSS application service to crash. On 32-bit platforms, an attacker can also cause insufficient memory to be allocated for the result, potentially leading to remote code execution in a KDC, kadmind, or GSS or Kerberos application server process. An attacker with the privileges of a cross-realm KDC may be able to extract secrets from a KDC process's memory by having them copied into the PAC of a new ticket. ticket: 9074 (new) tags: pullup target_version: 1.20-next target_version: 1.19-next
2022-11-03Fix null deref in KDC when decoding invalid NDRGreg Hudson2-10/+36
In ndr_dec_delegation_info(), keep di->transited_services_length valid by incrementing it as we add entries. Otherwise ndr_free_delegation_info() could dereference a null di->transited_services field. Also bound nservices using data->length to prevent inordinately large memory allocations. Credit to OSS-Fuzz for discovering the issues. ticket: 9073 (new) tags: pullup target_version: 1.20-next
2022-11-03Avoid small read overrun in UTF8 normalizationGreg Hudson1-0/+6
In krb5int_utf8_normalize(), check the length of the current character against the buffer length before reading more than one byte. Credit to OSS-Fuzz for discovering the overrun. ticket: 9072 (new)
2022-11-02Fix typo in TRACE_FAST_ARMOR_CCACHE_KEY messageRichard E. Silverman1-1/+1
2022-10-03Refactor KDC TGS processing codeGreg Hudson8-824/+872
Split the TGS processing code into information gathering, constraint and policy checking, and ticket-issuing steps, using a structure to hold the gathered information. Split validate_tgs_request() into validate_tgs_constraints() and check_tgs_policy() for better auditing. Fold kdc_process_s4u2proxy_req() into check_tgs_policy(), except for the get_pac_princ_with_realm() step which is now performed in gather_tgs_req_info(). Modify some other utility functions to fit the new design.
2022-09-27Add and use ts_interval() helperGreg Hudson10-41/+39
ts_delta() returns a signed result, which cannot hold an interval larger than 2^31-1 seconds. Intervals like this have been seen when admins set password expiration dates more than 68 years in the future. Add a second helper ts_interval() which returns an unsigned result, and has the arguments reversed so that the start time is first. Use it in warn_pw_expiry() to handle the password expiration case, in the GSS krb5 mech where we return an unsigned context or credential lifetime to the caller, and in the KEYRING ccache type where we compute an unsigned keyring timeout. ticket: 9071 (new)
2022-08-18Update error checking for OpenSSL CMS_verifyJulien Rische1-3/+6
The code for CMS data verification was initially written for OpenSSL's PKCS7_verify() function. It now uses CMS_verify(), but error handling is still done using PKCS7_verify() error identifiers. Update the recognized error codes so that the KDC generates KDC_ERR_DIGEST_IN_SIGNED_DATA_NOT_ACCEPTED errors when appropriate. Use ERR_peek_last_error() to observe the error generated closest to the API surface. [ghudson@mit.edu: edited commit message] ticket: 9069 (new) tags: pullup target_version: 1.20-next
2022-08-12Avoid protocol error constants in KDC codeGreg Hudson5-126/+103
For simplicity, return com_err codes from validate_as_request() and validate_tgs_request() instead of protocol error constants.
2022-07-21Fix k5test.py exit handlerGreg Hudson1-1/+2
Commit 0b4580b09afe9791d81961c41f61e4f06edad58f mistakenly calls the nonexistent _stop_daemon() in the onexit handler. Replace the call with code to terminate the daemon and check its exit status.
2022-07-20Remove kdc_context, tgs_server macros in KDCGreg Hudson10-581/+495
Eliminate the last two kdc_active_realm macros from realm_data.h (left behind after commits 0a2f14f752c32a24200363cc6b6ae64a92f81379 and e987546b4ff1689bb711cc46118ad9fc0a5613f6). Where code is affected, use the names "context" and "realm". Pass contexts instead of realm data structures to several functions which only need a context.
2022-07-20Remove include_certchain parameter in PKINITGreg Hudson4-51/+40
Every caller of cms_signeddata_create() and cms_envelopeddata_create() passes 1 for include_certchain. Remove the parameter and unconditionally add the certificate chain.
2022-07-13Reduce SUBDIROBJLISTS repetition in makefilesGreg Hudson4-28/+7
Where applicable, define STOBJLISTS in terms of SUBDIROBJLISTS.
2022-07-13Remove pre-CMS PKINIT compatibility codeGreg Hudson3-43/+6
CMS support is present in OpenSSL 1.0, which is the earliest supported version.
2022-07-07Set reasonable supportedCMSTypes in PKINITJulien Rische3-26/+60
The PKINIT client uses AuthPack.supportedCMSTypes to let the KDC know the algorithms it supports for verification of the CMS data signature. (The MIT krb5 KDC currently ignores this list, but other implementations use it.) Replace 3DES with sha512WithRSAEncryption and sha256WithRSAEncryption. [ghudson@mit.edu: simplified code and used appropriate helpers; edited commit message] ticket: 9066 (new)
2022-06-29Simplify plugin loading codeGreg Hudson1-357/+150
Remove the USE_CFBUNDLE code, which was only used by KfM. Handle platform conditionals according to current practice. Use k5_dir_filenames() instead of opendir() and remove the Windows implementation of opendir().
2022-06-29Fix PKCS11 module path searchsashan1-4/+7
Commit c5c11839e02c7993eb78f2c94c75c10cf93f2195 switched the loading of the PKCS#11 module from dlopen() to krb5int_open_plugin(). Because krb5int_open_plugin() includes a stat() test, this change has the unintended consequence of requiring the module name to be an absolute or relative path to the library, not a filename within the dynamic linker search path. Within krb5int_open_plugin(), only stat() the filename on the platforms which will use the file type. [ghudson@mit.edu: adjusted conditionals to call stat() on Windows; rewrote commit message] ticket: 9067 (new) tags: pullup target_version: 1.20-next
2022-06-29Fix build with -DDEBUG optionsashan1-2/+0
DEBUG is not used in sserver.c, and defining it may conflict with build options. [ghudson@mit.edu: removed define instead of conditionalizing; edited commit message]
2022-06-08Improve k5test daemon checkingGreg Hudson1-46/+40
Instead of checking daemon exit statuses prior to termination, check them after we send SIGTERM. This way we will notice when asan causes an unsuccessful exit due to memory leaks, or when a daemon crashes in its exit handling.
2022-06-08Free verto context later in KDC cleanupGreg Hudson1-1/+1
The KDC supplies the verto context to kdcpreauth modules via the loop method (added in commit 83b4ecd20e50ad330cd761977d5dadefe30a785b). This context should remain valid until kdcpreauth modules are unloaded, as modules might refer to it during cleanup. In particular, the OTP module references the verto context when freeing the RADIUS client object (commit e89abc2d4ea1fea1ec28d470f297514b828e4842), which can cause a memory error during KDC shutdown without this change. ticket: 9064 (new) tags: pullup target_version: 1.20-next target_version: 1.19-next
2022-06-08Fix memory leak in OTP kdcpreauth moduleGreg Hudson1-2/+4
In otp_edata(), free the generated nonce. ticket: 9063 (new) tags: pullup target_version: 1.20-next target_version: 1.19-next
2022-06-08Fix uncommon PKINIT memory leaksashan1-1/+8
PKINIT per-request module data objects are normally created by pkinit_server_verify_padata() and freed by pkinit_server_return_padata(). In some unusual circumstances, the KDC may not call the return_padata method after verification succeeds. Add a free_modreq method and free the object there instead. [ghudson@mit.edu: rewrote commit message] ticket: 9065 (new) tags: pullup target_version: 1.20-next target_version: 1.19-next
2022-05-31Fix net-server.c when AI_NUMERICSERV is undefinedSergey Fedorov1-1/+4
Some macOS versions do not define AI_NUMERICSERV. Other source files check whether it is defined before using it; do so here as well. [ghudson@mit.edu: rewrote commit message; slightly changed approach] ticket: 9062 (new) tags: pullup target_version: 1.20-next
2022-05-31Fix leaks in KDB test modulesashan1-1/+4
2022-05-31Fix memory leak in SPAKE kdcpreauth modulesashan1-0/+1
Commit ff57dc682a27bd205d715f3c0bed84890f2453c4 introduced a memory leak into verify_response(). reply_key is no longer passed to the callback and therefore needs to be freed by this function. [ghudson@mit.edu: rewrote commit message] ticket: 9061 (new) tags: pullup target_version: 1.20-next
2022-05-24Read GSS configuration files with mtime 0Simo Sorce1-5/+6
There is at least one case (with flatpaks) where configuration files in the special read-only /etc all have an mtime of 0. Using an initial last modified time of 0 in g_initialize.c causes these files to never be read. Change the initial high value to the be the "invalid" value (time_t)-1. Since the C and POSIX standards do not require time_t to be signed, special-case the checks in load_if_changed() and updateMechList() to treat all mod times as newer than -1. [ghudson@mit.edu: edited commit message; slightly modified approach] ticket: 9060 (new) target_version: 1.20 tags: pullup
2022-05-18Support macOS 11 native credential cacheKen Hornstein11-25/+892
Add an API credential cache implementation using the CCAPI stubs in the macOS Kerberos framework, tailored to access the native collections used by macOS 10.6 and later (KCM before macOS 11, XCACHE afterwards). Make API: the default ccache name for macOS 10.6 and later. [ghudson@mit.edu: used shared CCAPI credential conversion functions; changed ptcursor behavior to match current Unix collection semantics; adjusted naming and code style] ticket: 9052 (new)
2022-05-18Refactor and move CCAPI utility functionsGreg Hudson9-575/+500
Move the CCAPI credential transiation functions up a layer and refactor them to current practices.
2022-05-18Remove unused CCAPI libkrb5 codeGreg Hudson9-1379/+7
Remove the pre-CCAPIv3 code in the ccache type, and remove the unused stdccCredsMatch() function from stdcc_util.c.
2022-05-18Remove krb5_aprof_init() and krb5_aprof_finish()Greg Hudson5-104/+32
These functions are not part of the API, as they are prototyped in the internal header adm_proto.h. Stop using them in kdc/main.c (instead using the context profile) and stop defining them.
2022-05-18Use context profile for libkadm5 configurationGreg Hudson3-23/+5
In kadm5_get_config_params(), uxe the context profile instead of creating a new one with krb5_aprof_init(). In kproplog, obtain the context with kadm5_init_krb5_context() so that KDC configuration is used. ticket: 9059 (new)