aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2023-07-12Update for krb5-1.20.2-postreleasekrb5-1.20Greg Hudson1-2/+2
2023-07-07Update for krb5-1.20.2krb5-1.20.2-finalGreg Hudson29-31/+55
2023-07-06make regenGreg Hudson27-75/+75
2023-07-06Update copyright years to 2023Greg Hudson8-8/+8
2023-07-06Ensure array count consistency in kadm5 RPCGreg Hudson1-3/+8
In _xdr_kadm5_principal_ent_rec(), ensure that n_key_data matches the key_data array count when decoding. Otherwise when the structure is later freed, xdr_array() could iterate over the wrong number of elements, either leaking some memory or freeing uninitialized pointers. Reported by Robert Morris. CVE-2023-36054: An authenticated attacker can cause a kadmind process to crash by freeing uninitialized pointers. Remote code execution is unlikely. An attacker with control of a kadmin server can cause a kadmin client to crash by freeing uninitialized pointers. (cherry picked from commit ef08b09c9459551aabbe7924fb176f1583053cdd) ticket: 9099 version_fixed: 1.20.2
2023-07-06Fix 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] (cherry picked from commit 0108d7d7fbb1111c062ac580e69e97103662fc2b) ticket: 9087 version_fixed: 1.20.2
2023-07-06Fix possible double-free during KDB creationJulien Rische1-0/+2
In krb5_dbe_def_encrypt_key_data(), when we free key_data->key_data_contents[0], reset it to null so the caller doesn't free it as well. Since commit a06945b4ec267e8b80e5e8c95edd89930ff12103 this bug manifests as a double-free during KDB creation if master key encryption fails. [ghudson@mit.edu: edited commit message] (cherry picked from commit fddd419fc4112a118d8091e296cc2bfa8d8f777b) ticket: 9086 version_fixed: 1.20.2
2023-07-06Fix 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(). (cherry picked from commit 47c2a12830dbd7fb8e13c239ddc0ac74129a91f6) ticket: 9085 version_fixed: 1.20.2
2023-07-06Fix kpropd crash with unrecognized optionabushwang1-0/+1
(cherry picked from commit d0ea8de883a2487dfde8bfa377b64df1194ed5cb) ticket: 9083 version_fixed: 1.20.2
2023-07-06Fix 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] (cherry picked from commit d864d740d019fdf2c640460f2aa2760c7fa4d5e9) ticket: 9077 version_fixed: 1.20.2
2023-07-06Fix 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. (cherry picked from commit e48e2e56a05a47fd932a941ac82c1131ceed47d0) ticket: 9069 version_fixed: 1.20.2
2023-07-06Update 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] (cherry picked from commit 70f61d417261ca17efe3d60d180033bea2da60b0) ticket: 9069 version_fixed: 1.20.2
2022-11-13Update for krb5-1.20.1-postreleaseGreg Hudson1-2/+2
2022-11-11Update for krb5-1.20.1krb5-1.20.1-finalGreg Hudson29-31/+56
2022-11-11make regenGreg Hudson1-32/+32
2022-11-05Fix 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. (cherry picked from commit fa62bd33a0c0889c083999c0289ffa81a5d51e7b) ticket: 9073 version_fixed: 1.20.1
2022-11-05Fix 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. (cherry picked from commit ea92d2f0fcceb54a70910fa32e9a0d7a5afc3583) ticket: 9074 version_fixed: 1.20.1
2022-11-04Fix 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] (cherry picked from commit e134d9a6b6332bd085093e9075c949ece784fcd0) ticket: 9067 version_fixed: 1.20.1
2022-11-04Fix 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] (cherry picked from commit 883415036a4b4e0372b84a5a6e46c10b3a67aba0) ticket: 9065 version_fixed: 1.20.1
2022-11-04Free 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. (cherry picked from commit 8dcace04945723cd6a3c8ea2c1ba467c22eb6584) ticket: 9064 version_fixed: 1.20.1
2022-11-04Fix memory leak in OTP kdcpreauth moduleGreg Hudson1-2/+4
In otp_edata(), free the generated nonce. (cherry picked from commit 5ad465bc8e0d957a4945218bea487b77622bf433) ticket: 9063 version_fixed: 1.20.1
2022-11-04Fix 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] (cherry picked from commit f8ecc0ae74c7ebd84f042e28079aa6b4b2ae405c) ticket: 9062 version_fixed: 1.20.1
2022-11-04Fix 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] (cherry picked from commit 445e1b32767af3041ffd1823996d05ffec6fc9d5) ticket: 9061 version_fixed: 1.20.1
2022-05-26Update for krb5-1.20-postreleaseGreg Hudson1-2/+2
2022-05-25Update for krb5-1.20krb5-1.20-finalGreg Hudson3-6/+8
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] (cherry picked from commit 2b34a007461065e0cab4490dfe1ae5ddd10da67b) ticket: 9060 version_fixed: 1.20
2022-05-24Fix iprop with fallbackGreg Hudson1-2/+6
kpropd produces a client principal name with krb5_sname_to_principal(), then converts it to a string to pass as the client principal to kadm5_init_with_skey(). This conversion loses the name type, so no canonicalization is performed by libkadm5. Commit dcb79089276624d7ddf44e08d35bd6d7d7e557d2 addresses this problem for kadmin -k by looking for the referral realm, but kpropd sets the realm in the krb5_sname_to_principal() result. Add an additional check for a two-component principal with kiprop as the first component. (cherry picked from commit cd61bdcd6339b10e6cf3feb9f6cb369213e8d7fc) ticket: 9056 version_fixed: 1.20
2022-03-25Update for krb5-1.20-beta1-postreleaseGreg Hudson1-2/+2
2022-03-24Update for krb5-1.20-beta1krb5-1.20-beta1Greg Hudson2-4/+4
2022-03-23Update README for krb5-1.20Greg Hudson1-4/+130
2022-03-23Update config.guess, config.subGreg Hudson2-630/+723
2022-03-23Update features list for 1.20Greg Hudson1-2/+51
2022-03-18make regenGreg Hudson28-475/+507
2022-03-17Try harder to avoid password change replay errorsGreg Hudson3-5/+17
Commit d7b3018d338fc9c989c3fa17505870f23c3759a8 (ticket 7905) changed change_set_password() to prefer TCP. However, because UDP_LAST falls back to UDP after one second, we can still get a replay error due to a dropped packet, before the TCP layer has a chance to retry. Instead, try k5_sendto() with NO_UDP, and only fall back to UDP after TCP fails completely without reaching a server. In sendto_kdc.c, implement an ONLY_UDP transport strategy to allow the UDP fallback. ticket: 9037
2022-03-17Use SHA-256 instead of SHA-1 for PKINIT CMS digestJulien Rische1-17/+21
[ghudson@mit.edu: edited comments] ticket: 9055 (new)
2022-03-07Make kprop work for dump files larger than 4GBJulien Rische5-28/+130
If the dump file size does not fit in 32 bits, encode four zero bytes (forcing an error for unmodified kpropd) followed by the size in the next 64 bits. Add a functional test case, but only run it when an environment variable is set, as processing a 4GB dump file is too resource-intensive for make check. [ghudson@mit.edu: edited comments and commit message; eliminated use of defined constant in some cases; added test case] ticket: 9053 (new)
2022-03-02Replace macros with typedefs in gssrpc types.hTianjiao Yin1-2/+2
Defining bool_t and enum_t with the preprocessor conflicts with namespaced declarations in fbthrift's headers. Use typedefs to avoid this conflict and for consistency with other Sun RPC implementations. [ghudson@mit.edu: clarified commit message] ticket: 9054 (new)
2022-03-02Clarify certauth interface documentationGreg Hudson2-15/+24
Try to make it clearer that princ is the requested client principal, not a principal extracted from the certificate, and that the module must decode the certificate and inspect its attributes. Document KRB5_CERTAUTH_HWAUTH_PASS in certauth_plugin.h. ticket: 9051 (new)
2022-02-23In k5test, look for lldb if gdb is not foundGreg Hudson1-3/+11
XCode for macOS provides lldb but not gdb. For convenience, make k5test default to lldb if gdb is not found in the path.
2022-02-23Update copyright years to 2022Greg Hudson8-8/+8
2022-02-23Run Windows CI on windows-2019 image for nowGreg Hudson1-1/+1
The Github Actions windows-latest runner label now uses Windows Server 2022, which requires different setup steps for the Visual Studio environment and does not contain CRT merge modules for VS 2022 (though it does for VS 2017). For now, run the Windows build on windows-2019.
2022-01-28Remove unneeded SPAKE free_modreq methodGreg Hudson1-9/+0
Commit ff57dc682a27bd205d715f3c0bed84890f2453c4 removed the use of per-request module data in SPAKE, but neglected to remove the corresponding free_modreq method. ticket: 9049
2022-01-27Avoid passing null for asprintf stringsGreg Hudson4-28/+26
It is undefined behavior to pass null to a printf function for a %.*s substitution, even if the accompanying length is zero. OpenBSD generates syslog warnings from libc when it sees a null pointer in a string substitution (reported by Nathanael Rensen). krb5_sname_to_principal() passes a null pointer in the usual case where there is no port trailer. Address this case and others where we use asprintf() with %.*s substitutions and might pass null, either by avoiding the use of asprintf() or by ensuring that the pointer isn't null. ticket: 9047 (new)
2022-01-27Pass client flag to KDB for client preauth matchGreg Hudson1-1/+1
In the kdcpreauth match_client() callback, if it is necessary to look up the given principal in the KDB, pass KRB5_KDB_FLAG_CLIENT to krb5_db_get_principal(). Samba requires this flag to properly handle enterprise client principals. ticket: 9048 (new)
2022-01-27Implement replaced_reply_key input to issue_pac()Greg Hudson8-64/+105
If a kdcpreauth module fully replaces the reply key during an AS request, pass the reply key as the replaced_reply_key input to issue_pac(). In Windows environments this is used to provide an NTLM hash to the LSA when the client cannot be presumed to have a password to derive it from. To test this, add a fake PAC_CREDENTIALS_INFO buffer to the PAC in the test KDB module, and alter adata.c to display the set of PAC buffer types when a PAC is present. ticket: 9050 (new)
2022-01-27Add replace_reply_key kdcpreauth callbackGreg Hudson7-81/+92
Provide an explicit way for kdcpreauth modules to replace the reply key, and internally track when the reply key is fully replaced (as opposed to strengthened by replacing it with a derivative of the client long-term key). Use this facility in the FAST OTP, PKINIT, and SPAKE kdcpreauth modules. ticket: 9049 (new)
2022-01-27Add k5test.py facilities for PKINITGreg Hudson4-90/+76
Add the global variables pkinit_enabled and pkinit_certs. Add the realm flag pkinit=True. Add the realm method pkinit(). Use these facilities in t_pkinit.py, t_certauth.py, and t_authdata.py.
2022-01-27Remove unimplemented GSSRPC symbolsGreg Hudson3-15/+0
2022-01-26Factor out PAC checksum verificationGreg Hudson1-127/+55
Reduce code repetition in PAC checksum handling by adding a helper function. Remove the unnecessary prefix on several function names.
2022-01-12Replace AD-SIGNEDPATH with minimal PACsGreg Hudson35-2325/+957
Remove all of the AD-SIGNEDPATH code. Instead, issue a signed minimal PAC in all tickets and require a valid PAC to be present in all tickets presented for S4U operations. Remove the get_authdata_info() and sign_authdata() DAL methods, and add an issue_pac() method to allow the KDB to add or copy buffers to the PAC. Add a disable_pac realm flag. Microsoft revised the S4U2Proxy rules for forwardable tickets. All S4U2Proxy operations require forwardable evidence tickets, but S4U2Self should issue a forwardable ticket if the requesting service has no ok-to-auth-as-delegate bit but also no constrained delegation privileges for traditional S4U2Proxy. Implement these rules, extending the check_allowed_to_delegate() DAL method so that the KDC can ask if a principal has any delegation privileges. Combine the KRB5_KDB_FLAG_ISSUE_PAC and KRB5_FLAG_CLIENT_REFERRALS_ONLY flags into KRB5_KDB_FLAG_CLIENT. Rename the KRB5_KDB_FLAG_CANONICALIZE flag to KRB5_KDB_FLAG_REFERRAL_OK, and only pass it to get_principal() for lookup operations that can use a realm referral. For consistency with Active Directory, honor the no-auth-data-required server principal flag for S4U2Proxy but not for S4U2Self. Previously we did the reverse. ticket: 9044 (new)