Bug 2704

Summary: Avoid passing pointers between processes
Product: Portable OpenSSH Reporter: Brooks Davis <brooks>
Component: sshdAssignee: Damien Miller <djm>
Status: CLOSED FIXED    
Severity: enhancement CC: djm, dtucker
Priority: P5    
Version: -current   
Hardware: Other   
OS: All   
Bug Depends on:    
Bug Blocks: 2698    
Attachments:
Description Flags
Patch to pass ciphers by name rather than by virtual address
none
revised diff dtucker: ok+

Description Brooks Davis 2017-04-06 11:48:34 AEST
Created attachment 2972 [details]
Patch to pass ciphers by name rather than by virtual address

The newkeys_(from|to)_blob() functions currently pass a pointer to the static cipher structure between processes.  This works as long as pointers are opaque integer data.  With upcoming pointer integrity schemes such as CHERI (which ensures pointer derivations are valid with hardware tags) this no longer works and the pointer is instantiated out of thin air from the perspective of the receiving process.  Given the current structure of the cipher code, it's trivial to pass the name instead as is done in the attached patch.

This change appears to be sufficient to run OpenSSH with hardware enforced memory bounds on CHERI.
Comment 1 Damien Miller 2017-06-23 13:35:58 AEST
Created attachment 2997 [details]
revised diff

enc->name already contains the cipher name, so I don't think it's necessary to pass it again. It probably was on the version that you based your patch on, but we've since removed SSHv1 support and with it all ciphers that were not explicitly identified by name.
Comment 2 Damien Miller 2017-06-24 16:38:31 AEST
Patch applied. This will be in openssh-7.6
Comment 3 Damien Miller 2021-04-23 15:09:59 AEST
closing resolved bugs as of 8.6p1 release