Commit graph

1217 commits

Author SHA1 Message Date
Dimitry Andric 15dfc47b6a heimdal: asn1: Use unsigned bitfields for named bitsets
Import upstream 6747e1628:

  asn1: Use unsigned bitfields for named bitsets

  Signed 1-bit bitfields are undefined in C.

This should fix the following warnings, which for unknown reasons are
errors in CI:

  /usr/src/crypto/heimdal/lib/hx509/ca.c:1020:22: warning: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Wsingle-bit-bitfield-constant-conversion]
   1020 |         ku.digitalSignature = 1;
        |                             ^ ~
  /usr/src/crypto/heimdal/lib/hx509/ca.c:1021:21: warning: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Wsingle-bit-bitfield-constant-conversion]
   1021 |         ku.keyEncipherment = 1;
        |                            ^ ~
  /usr/src/crypto/heimdal/lib/hx509/ca.c:1028:17: warning: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Wsingle-bit-bitfield-constant-conversion]
   1028 |         ku.keyCertSign = 1;
        |                        ^ ~
  /usr/src/crypto/heimdal/lib/hx509/ca.c:1029:13: warning: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Wsingle-bit-bitfield-constant-conversion]
   1029 |         ku.cRLSign = 1;
        |                    ^ ~

PR:		276960
Fixes:		1b74875929
MFC after:	1 week

(cherry picked from commit 219b6e4423)
2024-04-24 23:27:27 +02:00
Dimitry Andric 2efe30782c heimdal: Add 64-bit integer support to ASN.1 compiler
Import upstream 19d378f44:

  ASN.1 INTEGERs will now compile to C int64_t or uint64_t, depending
  on whether the constraint ranges include numbers that cannot be
  represented in 32-bit ints and whether they include negative
  numbers.

  Template backend support included.  check-template is now built with
  --template, so we know we're testing it.

  Tests included.

Also adjusts the generated files:
* asn1parse.c, asn1parse.h (not strictly necessary, but nice to have)
* der-protos.h, which needs a bunch of new prototypes. I copied these
  from a der-protos.h generated by the upstream build system, which
  uses a perl script for this.
* adjust printf format strings for int64_t. Upstream uses %lld for this,
  but that is not portable, and leads to lots of -Werror warnings.

This should fix target-dependent differences between headers generated
by asn1_compile. For example, when cross compiling world from amd64 to
i386, the generated cms_asn1.h header has:

  CMSRC2CBCParameter ::= SEQUENCE {
    rc2ParameterVersion   INTEGER (0..-1),
    iv                    OCTET STRING,
  }

while a native build on i386 has:

  CMSRC2CBCParameter ::= SEQUENCE {
    rc2ParameterVersion   INTEGER (0..2147483647),
    iv                    OCTET STRING,
  }

These are _both_ wrong, since the source file, cms.asn1, has:

  CMSRC2CBCParameter ::= SEQUENCE {
          rc2ParameterVersion   INTEGER (0..4294967295),
          iv                    OCTET STRING -- exactly 8 octets
  }

PR:		276960
Reviewed by:	cy, emaste
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D44814
Differential Revision: https://reviews.freebsd.org/D44815

(cherry picked from commit 1b74875929)
2024-04-24 23:26:47 +02:00
Ed Maste b16cb28aca ssh: Update to OpenSSH 9.7p1
This release contains mostly bugfixes.

It also makes support for the DSA signature algorithm a compile-time
option, with plans to disable it upstream later this year and remove
support entirely in 2025.

Full release notes at https://www.openssh.com/txt/release-9.7

Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit a91a246563)
(cherry picked from commit 464fa66f63)
2024-03-25 18:39:14 -04:00
Cy Schubert 6b421e431a heimdal: Fix NULL deref
A flawed logical condition allows a malicious actor to remotely
trigger a NULL pointer dereference using a crafted negTokenInit
token.

Upstream notes:

    Reported to Heimdal by Michał Kępień <michal@isc.org>.

    From the report:

    Acknowledgement
    ---------------

    This flaw was found while working on addressing ZDI-CAN-12302: ISC BIND
    TKEY Query Heap-based Buffer Overflow Remote Code Execution
    Vulnerability, which was reported to ISC by Trend Micro's Zero Day

Security:	CVE-2022-3116
Obtained from:	upstream 7a19658c1

(cherry picked from commit fc773115fa)
2024-02-21 05:44:09 -08:00
Cy Schubert a311b9d708 heimdal: always confirm PA-PKINIT-KX for anon PKINIT
Import upstream 38c797e1a.

Upstream notes:

    RFC8062 Section 7 requires verification of the PA-PKINIT-KX key
    excahnge when anonymous PKINIT is used.  Failure to do so can
    permit an active attacker to become a man-in-the-middle.

Reported by:	emaste
Obtained from:	upstream 38c797e1a
Security:	CVE-2019-12098

(cherry picked from commit 60616b445e)
2024-02-21 05:44:09 -08:00
Cy Schubert 143a962d0e Heimdal: CVE-2018-16860 Heimdal KDC: Reject PA-S4U2Self with unkeyed checksum
Upstream's explanation of the problem:

    S4U2Self is an extension to Kerberos used in Active Directory to allow
    a service to request a kerberos ticket to itself from the Kerberos Key
    Distribution Center (KDC) for a non-Kerberos authenticated user
    (principal in Kerboros parlance). This is useful to allow internal
    code paths to be standardized around Kerberos.

    S4U2Proxy (constrained-delegation) is an extension of this mechanism
    allowing this impersonation to a second service over the network. It
    allows a privileged server that obtained a S4U2Self ticket to itself
    to then assert the identity of that principal to a second service and
    present itself as that principal to get services from the second
    service.

    There is a flaw in Samba's AD DC in the Heimdal KDC. When the Heimdal
    KDC checks the checksum that is placed on the S4U2Self packet by the
    server to protect the requested principal against modification, it
    does not confirm that the checksum algorithm that protects the user
    name (principal) in the request is keyed.  This allows a
    man-in-the-middle attacker who can intercept the request to the KDC to
    modify the packet by replacing the user name (principal) in the
    request with any desired user name (principal) that exists in the KDC
    and replace the checksum protecting that name with a CRC32 checksum
    (which requires no prior knowledge to compute).

    This would allow a S4U2Self ticket requested on behalf of user name
    (principal) user@EXAMPLE.COM to any service to be changed to a
    S4U2Self ticket with a user name (principal) of
    Administrator@EXAMPLE.COM. This ticket would then contain the PAC of
    the modified user name (principal).

Reported by:	emaste
Security:	CVE-2018-16860
Obtained from:	Upstream c6257cc2c

(cherry picked from commit 2433937749)
2024-02-21 05:44:08 -08:00
Cy Schubert 9a7121454d Heimdal: Fix transit path validation CVE-2017-6594
Apply upstream b1e699103. This fixes a bug introduced by upstream
f469fc6 which may in some cases enable bypass of capath policy.

Upstream writes in their commit log:

    Note, this may break sites that rely on the bug.  With the bug some
    incomplete [capaths] worked, that should not have.  These may now break
    authentication in some cross-realm configurations.

Reported by:	emaste
Security:	CVE-2017-6594
Obtained from:	upstream b1e699103

(cherry picked from commit f8041e3628)
2024-02-21 05:44:08 -08:00
Cy Schubert b9caa1b4c2 heimdal: Fix man page and documentation typos
Reported by:	Jens Schweikhardt <schweikh@schweikhardt.net>

(cherry picked from commit fc55c20355)
2024-01-15 02:02:29 -08:00
Ed Maste 2cd20d9bc8 ssh: Update to OpenSSH 9.6p1
From the release notes,

> This release contains a number of security fixes, some small features
> and bugfixes.

The most significant change in 9.6p1 is a set of fixes for a newly-
discovered weakness in the SSH transport protocol.  The fix was already
merged into FreeBSD and released as FreeBSD-SA-23:19.openssh.

Full release notes at https://www.openssh.com/txt/release-9.6

Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 069ac18495)
(cherry picked from commit a25789646d)
2024-01-08 08:57:12 -05:00
Ed Maste b8d5f0482d ssh: ban user/hostnames with most shell metacharacters
Cherry-picked from OpenSSH commit 7ef3787c84b6:

This makes ssh(1) refuse user or host names provided on the
commandline that contain most shell metacharacters.

Some programs that invoke ssh(1) using untrusted data do not filter
metacharacters in arguments they supply. This could create
interactions with user-specified ProxyCommand and other directives
that allow shell injection attacks to occur.

It's a mistake to invoke ssh(1) with arbitrary untrusted arguments,
but getting this stuff right can be tricky, so this should prevent
most obvious ways of creating risky situations. It however is not
and cannot be perfect: ssh(1) has no practical way of interpreting
what shell quoting rules are in use and how they interact with the
user's specified ProxyCommand.

To allow configurations that use strange user or hostnames to
continue to work, this strictness is applied only to names coming
from the commandline. Names specified using User or Hostname
directives in ssh_config(5) are not affected.

feedback/ok millert@ markus@ dtucker@ deraadt@

OpenBSD-Commit-ID: 3b487348b5964f3e77b6b4d3da4c3b439e94b2d9
(cherry picked from commit c39254c8f2)
2024-01-07 23:21:51 -05:00
Ed Maste 221a6bc397 ssh: Update to OpenSSH 9.5p1
Excerpts from the release notes:

Potentially incompatible changes
--------------------------------

 * ssh-keygen(1): generate Ed25519 keys by default.
   [NOTE: This change was already merged into FreeBSD.]

 * sshd(8): the Subsystem directive now accurately preserves quoting of
   subsystem commands and arguments.

New features
------------

 * ssh(1): add keystroke timing obfuscation to the client.

 * ssh(1), sshd(8): Introduce a transport-level ping facility.

 * sshd(8): allow override of Sybsystem directives in sshd Match blocks.

Full release notes at https://www.openssh.com/txt/release-9.5

Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit edf8578117)
(cherry picked from commit b24ca3caa7)
2024-01-07 23:21:51 -05:00
Ed Maste e4166d1934 ssh: regen config.h for stable/13
Sponsored by:	The FreeBSD Foundation
2024-01-07 23:16:57 -05:00
Ed Maste a4439dc6c8 ssh: fix OpenSSH 9.4 regression with multiplexed sessions
Upstream commit message:
upstream: fix regression in OpenSSH 9.4 (mux.c r1.99) that caused
multiplexed sessions to ignore SIGINT under some circumstances.
Reported by / feedback naddy@, ok dtucker@

OpenBSD-Commit-ID: 4d5c6c894664f50149153fd4764f21f43e7d7e5a

Fixes: 535af610a4 ("ssh: Update to OpenSSH 9.4p1")
Obtained from:	OpenSSH 803e22eabd3b
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 1b91d634a5)
2024-01-07 19:49:07 -05:00
Ed Maste f26eafdfaf ssh: Update to OpenSSH 9.4p1
Excerpts from the release notes:

 * ssh-agent(1): PKCS#11 modules must now be specified by their full
   paths. Previously dlopen(3) could search for them in system
   library directories.

 * ssh(1): allow forwarding Unix Domain sockets via ssh -W.

 * ssh(1): add support for configuration tags to ssh(1).
   This adds a ssh_config(5) "Tag" directive and corresponding
   "Match tag" predicate that may be used to select blocks of
   configuration similar to the pf.conf(5) keywords of the same
   name.

 * ssh(1): add a "match localnetwork" predicate. This allows matching
   on the addresses of available network interfaces and may be used to
   vary the effective client configuration based on network location.

 * ssh-agent(1): improve isolation between loaded PKCS#11 modules
   by running separate ssh-pkcs11-helpers for each loaded provider.

 * ssh-agent(1), ssh(1): improve defences against invalid PKCS#11
   modules being loaded by checking that the requested module
   contains the required symbol before loading it.

 * ssh(1): don't incorrectly disable hostname canonicalization when
   CanonicalizeHostname=yes and ProxyJump was expicitly set to
   "none". bz3567

Full release notes at https://www.openssh.com/txt/release-9.4

Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 535af610a4)
(cherry picked from commit 33a23ef287)
2024-01-07 19:49:07 -05:00
Gleb Smirnoff 0fbec53dcf sshd: do not resolve refused client hostname
This is a compromise between POLA and practical reasoning.  We don't
want to block the main server loop in an attempt to resolve.  But we
need to keep the format of the logged message as is, for sake of
sshguard and other scripts.  So let's print just the IP address twice,
this is what libwrap's refuse() would do if it failed to resolve.

Reviewed by:		philip
PR:			269456
Differential revision:	https://reviews.freebsd.org/D40069

(cherry picked from commit 9ff45b8ed8)
2023-12-18 12:35:47 -05:00
Gleb Smirnoff 052f6ec95b sshd: remove unneeded initialization of libwrap logging severities
This part of ca573c9a17 proved to be unnecessary.  As the removed
comment says, we set them merely for logging syntax errors, as we log
refusals ourselves.  However, inside the libwrap the parser logs any
syntax errors with tcpd_warn() which has hardcoded LOG_WARNING inside.

Reviewed by:		philip, emaste
Differential revision:	https://reviews.freebsd.org/D40068

(cherry picked from commit 90f10db8a9)
2023-12-18 12:34:47 -05:00
Gordon Tetlow 3bafcb9744
Implement "strict key exchange" in ssh and sshd.
This adds a protocol extension to improve the integrity of the SSH
transport protocol, particular in and around the initial key exchange
(KEX) phase.

Full details of the extension are in the PROTOCOL file.

OpenBSD-Commit-ID: 2a66ac962f0a630d7945fee54004ed9e9c439f14

Approved by:	so (implicit)
Obtained from:	https://anongit.mindrot.org/openssh.git/patch/?id=1edb00c58f8a6875fad6a497aa2bacf37f9e6cd5
Security:	CVE-2023-48795

(cherry picked from commit 92f58c69a1)
2023-12-18 09:09:18 -08:00
Jung-uk Kim cf3d446e18 OpenSSL: Merge OpenSSL 1.1.1w
(cherry picked from commit a1860b94f62494288804faebb1bf6ea8110ca148)
2023-09-11 13:14:49 -04:00
Ed Maste edd0014a6e ssh: comment deprecated option handling for retired local patches
Older versions of FreeBSD included the HPN patch set and provided
client-side VersionAddendum.  Both of these changes have been retired
but we've retained the option parsing for backwards compatibility to
avoid breaking upgrades.  Add comment references to the relevant
commits.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit a93cbba2de)
2023-08-08 12:42:01 -04:00
Jung-uk Kim 53a7dcac66 OpenSSL: Import OpenSSL 1.1.1v
(cherry picked from commit cc0d356166e39da7f956c39f874e6dee67fd5d60)
2023-08-01 12:16:57 -04:00
Ed Maste d578a19e2c ssh: Update to OpenSSH 9.3p2
From the release notes:

Changes since OpenSSH 9.3
=========================

This release fixes a security bug.

Security
========

Fix CVE-2023-38408 - a condition where specific libaries loaded via
ssh-agent(1)'s PKCS#11 support could be abused to achieve remote
code execution via a forwarded agent socket if the following
conditions are met:

* Exploitation requires the presence of specific libraries on
  the victim system.
* Remote exploitation requires that the agent was forwarded
  to an attacker-controlled system.

Exploitation can also be prevented by starting ssh-agent(1) with an
empty PKCS#11/FIDO allowlist (ssh-agent -P '') or by configuring
an allowlist that contains only specific provider libraries.

This vulnerability was discovered and demonstrated to be exploitable
by the Qualys Security Advisory team.

In addition to removing the main precondition for exploitation,
this release removes the ability for remote ssh-agent(1) clients
to load PKCS#11 modules by default (see below).

Potentially-incompatible changes
--------------------------------

 * ssh-agent(8): the agent will now refuse requests to load PKCS#11
   modules issued by remote clients by default. A flag has been added
   to restore the previous behaviour "-Oallow-remote-pkcs11".

   Note that ssh-agent(8) depends on the SSH client to identify
   requests that are remote. The OpenSSH >=8.9 ssh(1) client does
   this, but forwarding access to an agent socket using other tools
   may circumvent this restriction.

Security:	CVE-2023-38408
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 66fd12cf48)
2023-07-21 10:41:41 -04:00
Ed Maste 792d3f1686 ssh: fix leak and apply style(9) to hostname canonicalization
Fixes:		bf2e2524a2 ("ssh: canonicize the host name before...")
Fixes:		3e74849a1e ("ssh: canonicize the host name before...")
Reviewed by:	rew
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D38441

(cherry picked from commit 19aba210e1)
2023-06-05 12:03:51 -04:00
Jung-uk Kim cb56391c16 OpenSSL: Merge OpenSSL 1.1.1u
(cherry picked from commit 8ecb489345f08012fdc92a202a40119891cac330)
(cherry picked from commit 8f1ef87a6b)
2023-05-30 12:51:24 -04:00
Ed Maste 170520f882 openssh: restore PrintLastLog option
Upstream's autoconf sets DISABLE_LASTLOG if lastlog.ll_line does not
exist, but PrintLastLog also works with utmpx and other mechanisms.

Reported upstream at
https://lists.mindrot.org/pipermail/openssh-unix-dev/2022-May/040242.html

PR:		209441
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 43c6b7a60a)
(cherry picked from commit 170511589e)
2023-04-27 12:45:37 -04:00
Ed Maste 533a942a21 sftp: avoid leaking path arg in calls to make_absolute_pwd_glob
As Coverity reports:
    Overwriting tmp in tmp = make_absolute_pwd_glob(tmp, remote_path)
    leaks the storage that tmp points to.

Consume the first arg in make_absolute_pwd_glob, and add xstrdup() to
the one case which did not assign to the same variable that was passed
in. With this change make_absolute() and make_absolute_pwd_glob() have
the same semantics with respect to freeing the input string.

This change was reported to OpenSSH in
https://lists.mindrot.org/pipermail/openssh-unix-dev/2022-November/040497.html
[and was later adopted upstream].

Reported by:	Coverity Scan
CID:		1500409
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D37253

(cherry picked from commit 69c72a57af)
2023-04-21 09:45:30 -04:00
Ed Maste 802b483630 ssh: Update to OpenSSH 9.3p1
This release fixes a number of security bugs and has minor new
features and bug fixes.  Security fixes, from the release notes
(https://www.openssh.com/txt/release-9.3):

This release contains fixes for a security problem and a memory
safety problem. The memory safety problem is not believed to be
exploitable, but we report most network-reachable memory faults as
security bugs.

 * ssh-add(1): when adding smartcard keys to ssh-agent(1) with the
   per-hop destination constraints (ssh-add -h ...) added in OpenSSH
   8.9, a logic error prevented the constraints from being
   communicated to the agent. This resulted in the keys being added
   without constraints. The common cases of non-smartcard keys and
   keys without destination constraints are unaffected. This problem
   was reported by Luci Stanescu.

 * ssh(1): Portable OpenSSH provides an implementation of the
   getrrsetbyname(3) function if the standard library does not
   provide it, for use by the VerifyHostKeyDNS feature. A
   specifically crafted DNS response could cause this function to
   perform an out-of-bounds read of adjacent stack data, but this
   condition does not appear to be exploitable beyond denial-of-
   service to the ssh(1) client.

   The getrrsetbyname(3) replacement is only included if the system's
   standard library lacks this function and portable OpenSSH was not
   compiled with the ldns library (--with-ldns). getrrsetbyname(3) is
   only invoked if using VerifyHostKeyDNS to fetch SSHFP records. This
   problem was found by the Coverity static analyzer.

Accelerated MFC to prepare for inclusion in 13.2-RELEASE.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 4d3fc8b057)
2023-03-16 15:08:54 -04:00
Cy Schubert 59c26d1a95 heimdal: Fix CVE-2022-4152, signature validation error
When CVE-2022-3437 was fixed by changing memcmp to be a constant
time and the workaround for th e compiler was to add "!=0". However
the logic implmented was inverted resulting in CVE-2022-4152.

Reported by:	Timothy E Zingelman <zingelman _AT_ fnal.gov>
Security:	CVE-2022-4152
Security:	https://www.cve.org/CVERecord?id=CVE-2022-45142
Security:	https://nvd.nist.gov/vuln/detail/CVE-2022-45142
Security:	https://security-tracker.debian.org/tracker/CVE-2022-45142
Security:	https://bugs.gentoo.org/show_bug.cgi?id=CVE-2022-45142
Security:	https://bugzilla.samba.org/show_bug.cgi?id=15296
Security:	https://www.openwall.com/lists/oss-security/2023/02/08/1

(cherry picked from commit 5abaf08664)
2023-03-09 20:07:25 -08:00
Ed Maste 43fd77233c ssh: default VerifyHostKeyDNS to no, following upstream
Revert to upstream's default.  Using VerifyHostKeyDNS may depend on a
trusted nameserver and network path.

This reverts commit 83c6a5242c.

Reported by:	David Leadbeater, G-Research
Reviewed by:	gordon
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D38648

(cherry picked from commit 41ff5ea22c)
2023-03-01 22:09:45 -05:00
Cy Schubert 75b5693ed7 heimdal: Resolve hdb_free_entry() SIGSEGV/SIGILL
When the client sends kadmind a create principal (kadm_create) request
kadm_s_create_principal() returns an error before zeroing out ent (an
hdb entry structure wrapper -- hdb_entry_ex), resulting in a NULL
reference.

Fix obtained from upstream commit 35ea4955a.

PR:		268059
Reported by:	Robert Morris <rtm@lcs.mit.edu>
Obtained from:	Heimdal commit 35ea4955a

(cherry picked from commit 6a70e0b4cd)
2023-02-14 10:32:26 -08:00
Ed Maste 2f43f14582 ssh: update to OpenSSH 9.2p1
Release notes are available at https://www.openssh.com/txt/release-9.2

OpenSSH 9.2 contains fixes for two security problems and a memory safety
problem.  The memory safety problem is not believed to be exploitable.
These fixes have already been committed to OpenSSH 9.1 in FreeBSD.

Some other notable items from the release notes:

 * ssh(1): add a new EnableEscapeCommandline ssh_config(5) option that
   controls whether the client-side ~C escape sequence that provides a
   command-line is available. Among other things, the ~C command-line
   could be used to add additional port-forwards at runtime.

 * sshd(8): add support for channel inactivity timeouts via a new
   sshd_config(5) ChannelTimeout directive. This allows channels that
   have not seen traffic in a configurable interval to be
   automatically closed. Different timeouts may be applied to session,
   X11, agent and TCP forwarding channels.

 * sshd(8): add a sshd_config UnusedConnectionTimeout option to
   terminate client connections that have no open channels for a
   length of time. This complements the ChannelTimeout option above.

 * sshd(8): add a -V (version) option to sshd like the ssh client has.

 * scp(1), sftp(1): add a -X option to both scp(1) and sftp(1) to
   allow control over some SFTP protocol parameters: the copy buffer
   length and the number of in-flight requests, both of which are used
   during upload/download. Previously these could be controlled in
   sftp(1) only. This makes them available in both SFTP protocol
   clients using the same option character sequence.

 * ssh-keyscan(1): allow scanning of complete CIDR address ranges,
   e.g.  "ssh-keyscan 192.168.0.0/24". If a CIDR range is passed, then
   it will be expanded to all possible addresses in the range
   including the all-0s and all-1s addresses. bz#976

 * ssh(1): support dynamic remote port forwarding in escape
   command-line's -R processing. bz#3499

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit f374ba41f5)
2023-02-13 08:16:22 -05:00
Ed Maste 59ab4b9512 ssh: fix SIZEOF_TIME_T #define on i386
Reported by:	imp
Reviewed by:	imp
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D38443

(cherry picked from commit 1aa9a35f63)
2023-02-12 20:19:51 -05:00
Ed Maste 6ad91c17b0 ssh: Be more paranoid with host/domain names coming from the
never write a name with bad characters to a known_hosts file.

replace recently-added valid_domain() check for hostnames going to
known_hosts with a more relaxed check for bad characters.

Obtained from:	OpenSSH-portable commit 445363433ba2
Obtained from:	OpenSSH-portable commit 3cae9f92a318
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 2e82822057)
2023-02-08 16:04:36 -05:00
Ed Maste 375bb3704d ssh: fix bug in PermitRemoteOpen which caused it to ignore...
its first argument unless it was one of the special keywords "any" or
"none".

Obtained from:	OpenSSH-portable commit b3daa8dc5823
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 94e21add45)
2023-02-08 16:04:36 -05:00
Ed Maste 296ec8eae0 ssh: fix double-free caused by compat_kex_proposal()
Security:	CVE-2023-25136
Obtained from:	OpenSSH-portable commit 12da78233364
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit fe1371e8f3)
2023-02-08 16:04:36 -05:00
Jung-uk Kim 0904c29a0a OpenSSL: Merge OpenSSL 1.1.1t
(cherry picked from commit 640242a591)
2023-02-07 17:38:40 -05:00
Ed Maste b338bdf7fb openssh: remove mention of now-unused svn:keywords
Reported by:	gshapiro

(cherry picked from commit 9b7eddfeed)
2023-01-20 16:07:27 -05:00
Ed Maste b1aafaaad5 ssh: remove note about local change to [Use]PrivilegeSeparation
We documented "[Use]PrivilegeSeparation defaults to sandbox" as one of
our modifications to ssh's server-side defaults, but this is not (any
longer) a difference from upstream.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit a752e011a8)
2023-01-09 22:54:23 -05:00
Cy Schubert ed8706c340 heimdal: kadm5_c_get_principal() should check return code
kadm5_c_get_principal() should check the return code from
kadm5_ret_principal_ent(). As it doesn't it assumes success when
there is none and can lead to potential vulnerability. Fix this.

Reported by:	rtm@csail.mit.edu

(cherry picked from commit f6d5d31cd5)
2022-12-12 06:40:37 -08:00
Cy Schubert 08c3ed3469 heimdal: Properly ix bus fault when zero-length request received
Zero length client requests result in a bus fault when attempting to
free malloc()ed pointers within the requests softc. Return an error
when the request is zero length.

This properly fixes PR/268062 without regressions.

PR:		268062
Reported by:	Robert Morris <rtm@lcs.mit.edu>

(cherry picked from commit 3deefb0d14)
2022-12-12 06:40:33 -08:00
Cy Schubert 09072186ee Revert "heimdal: Fix bus fault when zero-length request received"
This is the wrong fix for PR/268062.

This reverts commit 6742ff42ab.

(cherry picked from commit 5319949668)
2022-12-09 06:12:51 -08:00
Cy Schubert 95240a65fb heimdal: Fix bus fault when zero-length request received
Zero length client requests result in a bus fault when attempting to
free malloc()ed pointers within the requests softc. Return an error
when the request is zero length.

PR:		268062
Reported by:	Robert Morris <rtm@lcs.mit.edu>

(cherry picked from commit 6742ff42ab)
2022-12-05 13:50:28 -08:00
Cy Schubert 02c5770995 heimdal: Add additional checks for bad kadmind input
Check return codes for bad input.

(cherry picked from commit d24b272832)
2022-12-05 13:50:28 -08:00
Cy Schubert bc8c756a2f heimdal: Check return code from _hdb_fetch_kvno()
A malformed principal will cause kadmind to segfault. The PR
addresses only when chpass is requested but delete is also affected.
Fix both.

PR:		268002
Reported by:	Robert Morris <rtm@lcs.mit.edu>

(cherry picked from commit 671f55828d)
2022-12-01 06:25:11 -08:00
Cy Schubert 9b631c3318 heimdal: Add missing iprop error checks.
Inspired by upstream 9d6dd21256f87988605fa75172be9cc92535064c.

Obtained from:	Heimdal 9d6dd21256f87988605fa75172be9cc92535064c

(cherry picked from commit 5040a7a9aa)
2022-12-01 06:25:11 -08:00
Cy Schubert fe6c5f4f93 heimdal: Add missing kadmind error checks
Inspired by:	Heimdal commmit 1b213c1082be4ef5a1c23928d614c762f837dbe7

(cherry picked from commit 80999dcd5b)
2022-12-01 06:25:11 -08:00
Cy Schubert d310918268 heimdal: Add missing kadm5 error checks
Obtained from:	Heimdal commit 4a0e01f9edabe36d0f2cab188078dd29fa5aaf02

(cherry picked from commit 879b0e9cd2)
2022-12-01 06:25:10 -08:00
Cy Schubert 0ae2fac599 heimdal: Add missing kadm5 error checks
Generally obtained from upstream 655c057769f56bd8cdb7d16e93f1e7a7cb260342.

PR:		267944, 267972
Obtained from:	Heimdal commit 655c057769f56bd8cdb7d16e93f1e7a7cb260342

(cherry picked from commit 780f663df3)
2022-12-01 06:25:10 -08:00
Cy Schubert fed526b0af heimdal: Fix uninitialized pointer dereference
krb5_ret_preincipal() returns a non-zero return code when
a garbage principal is passed to it. Unfortunately ret_principal_ent()
does not check the return code, with garbage pointing to what would
have been the principal. This results in a segfault when free() is
called.

PR:		267944, 267972
Reported by:	Robert Morris <rtm@lcs.mit.edu>

(cherry picked from commit e13150e28c)
2022-12-01 06:25:10 -08:00
Cy Schubert 53c5d72d28 heimdal: Handle other types of garbage data
In addition to garbage realm data, also handle garbage dbname, acl_file,
stash_file, and invalid bitmask garbage data.

PR:		267912
Reported by:	Robert Morris <rtm@lcs.mit.edu>

(cherry picked from commit 91db848212)
2022-12-01 06:25:10 -08:00
Cy Schubert 387abd4065 heimdal: Fix NULL dereference when mangled realm message
Fix a NULL dereference in _kadm5_s_init_context() when the client
sends a mangled realm message.

PR:		267912
Reported by:	Robert Morris <rtm@lcs.mit.edu>

(cherry picked from commit 05bc50bdb1)
2022-12-01 06:25:10 -08:00