smtp(1) - unexpected behaviour, core dump

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

smtp(1) - unexpected behaviour, core dump

Ross L Richardson

>Synopsis: smtp(1) - fails to verify certificate, dumps core
>Category: amd64
>Environment:
        System      : OpenBSD 6.6
        Details     : OpenBSD 6.6-beta (GENERIC.MP) #266: Thu Aug 29 17:29:15 MDT 2019
                         [hidden email]:/usr/src/sys/arch/amd64/compile/GENERIC.MP

        Architecture: OpenBSD.amd64
        Machine     : amd64
>Description:
        On -current and 6.5, smtp(1) is behaving unexpectedly when
        validating certificates for (at least) smtps.

        As an example, consider smtp.fastmail.com...


        Confirm that the certificate is valid:

        $ nc -cvz smtp.fastmail.com smtps
        Connection to smtp.fastmail.com 465 port [tcp/smtps] succeeded!
        TLS handshake negotiated TLSv1.2/ECDHE-RSA-AES256-GCM-SHA384 with host smtp.fastmail.com
        Peer name: smtp.fastmail.com
        Subject: /C=AU/L=Melbourne/O=FastMail Pty Ltd/CN=*.fastmail.com
        Issuer: /C=US/O=DigiCert Inc/CN=DigiCert SHA2 Secure Server CA
        Valid From: Fri Sep 22 10:00:00 2017
        Valid Until: Fri Oct  9 23:00:00 2020
        Cert Hash: SHA256:b16a72a2d36869b7104c6b889967d8b58d119328680242ea5e79ce68da92e41a
        OCSP URL: http://ocsp.digicert.com


        smtp(1) reports the certificate is invalid:

        $ smtp -nv -s smtps://smtp.fastmail.com:smtps
        trying host 66.111.4.139 port 465...
        validating server certificate...
        connection error: Invalid server certificate
        done...


        Try with smtp(1), without requiring valid certificate:

        $ smtp -Cnv -s smtps://smtp.fastmail.com:smtps
        trying host 66.111.4.139 port 465...
        validating server certificate...
        connection ready...
        connection closed...
        trying host 66.111.4.140 port 465...
        Bus error (core dumped)

>How-To-Repeat:
        $ smtp -nv -s smtps://smtp.fastmail.com:smtps
        $ smtp -Cnv -s smtps://smtp.fastmail.com:smtps
>Fix:
        Unknown

dmesg:
OpenBSD 6.6-beta (GENERIC.MP) #266: Thu Aug 29 17:29:15 MDT 2019
    [hidden email]:/usr/src/sys/arch/amd64/compile/GENERIC.MP
real mem = 8415350784 (8025MB)
avail mem = 8147619840 (7770MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.8 @ 0xece40 (53 entries)
bios0: vendor American Megatrends Inc. version "EB120IMS.830" date 08/26/2016
bios0: Micro-Star International Co., Ltd. MS-B120
acpi0 at bios0: ACPI 5.0
acpi0: sleep states S0 S3 S4 S5
acpi0: tables DSDT FACP APIC FPDT FIDT MCFG SLIC SSDT SSDT SSDT UEFI LPIT CSRT
acpi0: wakeup devices XHC1(S4) HDEF(S4) RP01(S4) PXSX(S4) RP02(S4) PXSX(S4) RP03(S4) PXSX(S4) RP04(S4) PXSX(S4) BRC1(S0)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Celeron(R) CPU N3060 @ 1.60GHz, 1680.47 MHz, 06-4c-04
cpu0: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,SSE4.1,SSE4.2,MOVBE,POPCNT,DEADLINE,AES,RDRAND,NXE,RDTSCP,LONG,LAHF,3DNOWP,PERF,ITSC,TSC_ADJUST,SMEP,ERMS,SENSOR,ARAT,MELTDOWN
cpu0: 1MB 64b/line 16-way L2 cache
tsc_timecounter_init: TSC skew=0 observed drift=0
cpu0: smt 0, core 0, package 0
mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges
cpu0: apic clock running at 79MHz
cpu0: mwait min=64, max=64, C-substates=0.2.0.0.0.0.3.3, IBE
cpu1 at mainbus0: apid 4 (application processor)
TSC skew=-90
cpu1: Intel(R) Celeron(R) CPU N3060 @ 1.60GHz, 1600.00 MHz, 06-4c-04
cpu1: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,SSE4.1,SSE4.2,MOVBE,POPCNT,DEADLINE,AES,RDRAND,NXE,RDTSCP,LONG,LAHF,3DNOWP,PERF,ITSC,TSC_ADJUST,SMEP,ERMS,MD_CLEAR,IBRS,IBPB,STIBP,SENSOR,ARAT,MELTDOWN
cpu1: 1MB 64b/line 16-way L2 cache
tsc_timecounter_init: TSC skew=-90 observed drift=0
cpu1: smt 0, core 2, package 0
ioapic0 at mainbus0: apid 1 pa 0xfec00000, version 20, 115 pins
acpimcfg0 at acpi0
acpimcfg0: addr 0xe0000000, bus 0-255
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus 1 (RP01)
acpiprt2 at acpi0: bus 2 (RP02)
acpiprt3 at acpi0: bus 3 (RP03)
acpiprt4 at acpi0: bus -1 (RP04)
acpiec0 at acpi0: not present
acpicpu0 at acpi0: C1(1000@1 mwait.1), PSS
acpicpu1 at acpi0: C1(1000@1 mwait.1), PSS
acpipwrres0 at acpi0: CLK0, resource for CAMD
acpipwrres1 at acpi0: CLK0, resource for CAM1
acpipwrres2 at acpi0: CLK1, resource for CAM2, CAM3
acpipwrres3 at acpi0: USBC, resource for XHC1
acpipwrres4 at acpi0: FN00, resource for FAN0
acpitz0 at acpi0: critical temperature is 95 degC
acpicmos0 at acpi0
acpipci0 at acpi0 PCI0: 0x00000000 0x00000011 0x00000001
"BCM2E64" at acpi0 not configured
"BCM4752" at acpi0 not configured
"SMO91D0" at acpi0 not configured
"INTCF1C" at acpi0 not configured
"MSFT0002" at acpi0 not configured
"PNP0C14" at acpi0 not configured
acpibtn0 at acpi0: SLPB
"PNP0C14" at acpi0 not configured
"PNP0C0B" at acpi0 not configured
acpivideo0 at acpi0: GFX0
acpivout0 at acpivideo0: DD1F
pci0 at acpipci0 bus 0
pchb0 at pci0 dev 0 function 0 "Intel Braswell Host" rev 0x35
inteldrm0 at pci0 dev 2 function 0 "Intel HD Graphics" rev 0x35
drm0 at inteldrm0
inteldrm0: msi
sdhc0 at pci0 dev 16 function 0 vendor "Intel", unknown product 0x2294 rev 0x35: apic 1 int 16
sdhc0: SDHC 3.0, 200 MHz base clock
sdmmc0 at sdhc0: 8-bit, sd high-speed, mmc high-speed, dma
ahci0 at pci0 dev 19 function 0 "Intel Braswell AHCI" rev 0x35: msi, AHCI 1.3.1
ahci0: port 0: 6.0Gb/s
ahci0: PHY offline on port 1
scsibus1 at ahci0: 32 targets
sd0 at scsibus1 targ 0 lun 0: <ATA, KINGSTON SUV400S, 0C3J> SCSI3 0/direct fixed naa.0550380440010000
sd0: 114473MB, 512 bytes/sector, 234441648 sectors, thin
xhci0 at pci0 dev 20 function 0 "Intel Braswell xHCI" rev 0x35: msi, xHCI 1.0
usb0 at xhci0: USB revision 3.0
uhub0 at usb0 configuration 1 interface 0 "Intel xHCI root hub" rev 3.00/1.00 addr 1
"Intel Braswell TXE" rev 0x35 at pci0 dev 26 function 0 not configured
azalia0 at pci0 dev 27 function 0 "Intel Braswell HD Audio" rev 0x35: msi
azalia0: codecs: Realtek/0x0283, Intel/0x2883, using Realtek/0x0283
audio0 at azalia0
ppb0 at pci0 dev 28 function 0 "Intel Braswell PCIE" rev 0x35: msi
pci1 at ppb0 bus 1
iwm0 at pci1 dev 0 function 0 "Intel Dual Band Wireless AC 3160" rev 0x83, msi
ppb1 at pci0 dev 28 function 1 "Intel Braswell PCIE" rev 0x35: msi
pci2 at ppb1 bus 2
ppb2 at pci0 dev 28 function 2 "Intel Braswell PCIE" rev 0x35: msi
pci3 at ppb2 bus 3
re0 at pci3 dev 0 function 0 "Realtek 8168" rev 0x0c: RTL8168G/8111G (0x4c00), msi, address xx:xx:xx:xx:xx:xx
rgephy0 at re0 phy 7: RTL8251 PHY, rev. 0
pcib0 at pci0 dev 31 function 0 "Intel Braswell PCU LPC" rev 0x35
ichiic0 at pci0 dev 31 function 3 "Intel Braswell SMBus" rev 0x35: apic 1 int 18
iic0 at ichiic0
spdmem0 at iic0 addr 0x50: 4GB DDR3 SDRAM PC3-14200 SO-DIMM
spdmem1 at iic0 addr 0x51: 4GB DDR3 SDRAM PC3-14200 SO-DIMM
isa0 at pcib0
isadma0 at isa0
com0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo
com0: probed fifo depth: 15 bytes
pckbc0 at isa0 port 0x60/5 irq 1 irq 12
pckbd0 at pckbc0 (kbd slot)
wskbd0 at pckbd0: console keyboard
pcppi0 at isa0 port 0x61
spkr0 at pcppi0
cpu0: using Silvermont MDS workaround
cpu0: Enhanced SpeedStep 1680 MHz: speeds: 1601, 1600, 1520, 1440, 1360, 1280, 1200, 1120, 1040, 960, 880, 800, 720, 640, 560, 480 MHz
vmm0 at mainbus0: VMX/EPT (using slow L1TF mitigation)
sdmmc0: can't enable card
uhub1 at uhub0 port 4 configuration 1 interface 0 "Apple, Inc. Keyboard Hub" rev 2.00/95.15 addr 2
uhidev0 at uhub1 port 2 configuration 1 interface 0 "Apple, Inc Apple Keyboard" rev 2.00/0.69 addr 3
uhidev0: iclass 3/1
ukbd0 at uhidev0: 8 variable keys, 5 key codes, country code 33
wskbd1 at ukbd0 mux 1
uhidev1 at uhub1 port 2 configuration 1 interface 1 "Apple, Inc Apple Keyboard" rev 2.00/0.69 addr 3
uhidev1: iclass 3/0
uhid0 at uhidev1: input=1, output=0, feature=0
uhidev2 at uhub1 port 3 configuration 1 interface 0 "Logitech USB Optical Mouse" rev 2.00/43.01 addr 4
uhidev2: iclass 3/1
ums0 at uhidev2: 8 buttons, Z and W dir
wsmouse0 at ums0 mux 0
ugen0 at uhub0 port 5 "Intel product 0x07dc" rev 2.00/0.01 addr 5
vscsi0 at root
scsibus2 at vscsi0: 256 targets
softraid0 at root
scsibus3 at softraid0: 256 targets
root on sd0a (0deadbeef0123456.a) swap on sd0b dump on sd0b
inteldrm0: 1920x1080, 32bpp
wsdisplay0 at inteldrm0 mux 1: console (std, vt100 emulation), using wskbd0
wskbd1: connecting to wsdisplay0
wsdisplay0: screen 1-5 added (std, vt100 emulation)
iwm0: hw rev 0x160, fw ver 16.242414.0, address xx:xx:xx:xx:xx:xx

Reply | Threaded
Open this post in threaded view
|

Re: smtp(1) - unexpected behaviour, core dump

Ross L Richardson
On Fri, Aug 30, 2019 at 08:23:06PM +1000, Ross L Richardson wrote:
>
> >Synopsis: smtp(1) - fails to verify certificate, dumps core
>[...]

The recent update fixed the core dump [thanks!], but there is still
a problem with certificate validation.


nc(1) considers the certificate to be valid...

$ nc -cvz smtp.fastmail.com smtps
Connection to smtp.fastmail.com 465 port [tcp/smtps] succeeded!
TLS handshake negotiated TLSv1.2/ECDHE-RSA-AES256-GCM-SHA384 with host smtp.fastmail.com
Peer name: smtp.fastmail.com
Subject: /C=AU/L=Melbourne/O=FastMail Pty Ltd/CN=*.fastmail.com
Issuer: /C=US/O=DigiCert Inc/CN=DigiCert SHA2 Secure Server CA
Valid From: Fri Sep 22 10:00:00 2017
Valid Until: Fri Oct  9 23:00:00 2020
Cert Hash: SHA256:b16a72a2d36869b7104c6b889967d8b58d119328680242ea5e79ce68da92e41a
OCSP URL: http://ocsp.digicert.com


...but smtp(1) reports it as invalid.

$ smtp -nv -s smtps://smtp.fastmail.com
trying host 66.111.4.139 port 465...
validating server certificate...
connection error: Invalid server certificate
done...


Ross