Subject: bug#40397: 28.0.50; epg decrypt does not verify signed content in smime encrypted and signed message

From: Sebastian Fieber <[email-masked]>
Date: Fri, 03 Apr 2020 01:37:04 +0200

Hey there,

I'm currently running master on commit
1242ae904a9b7871658f11fb98da5730ea8838c9.

When I open an smime encrypted AND signed message in gnus with a content
type looking like this:

Content-Type: application/pkcs7-mime; smime-type=enveloped-data;
	name="smime.p7m"

I end up with a buffer looking like this:

Content-Type: application/x-pkcs7-mime; name=smime.p7m; smime-type=signed-data
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=smime.p7m

[base64 encoded smime.p7m]

This is the signed content which would have to be verified again. I
tried to fix this myself but are really unfamiliar with the gnus
codebase. I tried to run mm-dissect-buffer on this content alone which
gives some results. I think a fix would look like this: there just needs
to be some checking whats inside the enveloped data that is being
correctly decrypted and if its another application/(x-)pkcs7-mime just
handle this one too.

Best regards
Sebastian

In GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.14, cairo version 1.17.3)
 of 2020-03-21 built on comedian
Repository revision: 1242ae904a9b7871658f11fb98da5730ea8838c9
Repository branch: makepkg
Windowing system distributor 'The X.Org Foundation', version 11.0.12007000
System Description: Arch Linux

Recent messages:
nnimap web splitting mail...done
nnimap read 2k from disroot.org
Reading active file via nndraft...done
Checking new news...done
Auto-saving...
Outdated usage of ‘bbdb-search’
Parsing BBDB file ‘~/.emacs.d/bbdb’...done
Buffer *unsent mail* modified; kill anyway? (y or n) y
next-line: End of buffer
<s-backspace> is undefined

Configured using:
 'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
 --localstatedir=/var --mandir=/usr/share/man
 --pdfdir=/usr/share/doc/emacs/pdf --without-gconf --with-sound=alsa
 --with-x-toolkit=gtk3 --without-toolkit-scroll-bars --with-mailutils
 --with-gameuser=yes --with-xft 'CFLAGS=-march=x86-64 -mtune=generic -O2
 -pipe -fstack-protector-strong -fno-plt'
 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now
 CPPFLAGS=-D_FORTIFY_SOURCE=2'

Configured features:
XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND GPM DBUS GSETTINGS GLIB NOTIFY
INOTIFY ACL GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF ZLIB GTK3
X11 XDBE XIM MODULES THREADS LIBSYSTEMD JSON PDUMPER LCMS2 GMP

Important settings:
  value of $LC_MONETARY: de_DE.utf8
  value of $LC_NUMERIC: de_DE.utf8
  value of $LC_TIME: de_DE.utf8
  value of $LANG: en_US.utf8
  locale-coding-system: utf-8-unix

Major mode: Group

Minor modes in effect:
  gnus-agent-group-mode: t
  shell-dirtrack-mode: t
  gnus-undo-mode: t
  auto-insert-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  global-company-mode: t
  company-mode: t
  global-morlock-mode: t
  eval-sexp-fu-flash-mode: t
  persistent-scratch-autosave-mode: t
  smartparens-global-mode: t
  guru-global-mode: t
  guru-mode: t
  show-paren-mode: t
  editorconfig-mode: t
  solaire-global-mode: t
  minibuffer-depth-indicate-mode: t
  save-place-mode: t
  guide-key-mode: t
  immortal-scratch-mode: t
  winner-mode: t
  diff-hl-flydiff-mode: t
  global-diff-hl-mode: t
  doom-modeline-mode: t
  projectile-mode: t
  savehist-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  temp-buffer-resize-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t

Load-path shadows:
/home/judas/.emacs.d/elpa/cmake-mode-20190710.1319/cmake-mode hides /usr/share/emacs/site-lisp/cmake-mode
/home/judas/.emacs.d/elpa/less-css-mode-20161001.453/less-css-mode hides /usr/share/emacs/28.0.50/lisp/textmodes/less-css-mode

Features:
(shadow emacsbug bbdb-message sendmail nnir finder finder-inf lisp-mnt
skeleton gnus-html url-queue url-cache mm-url expand-region
subword-mode-expansions text-mode-expansions the-org-mode-expansions
er-basic-expansions expand-region-core expand-region-custom pulse sort
smiley gnus-cite pp cl-print debug magit-utils mule-util jka-compr
misearch multi-isearch info-colors eieio-opt speedbar ezimage dframe
help-fns radix-tree mm-archive mail-extr gnus-async gnus-bcklg qp
gnus-ml disp-table nndraft nnmh utf-7 nnfolder tabify editorconfig-core
editorconfig-core-handle editorconfig-fnmatch bbdb-gnus bbdb-mua
bbdb-com crm gnutls network-stream nsm gnus-agent gnus-srvr gnus-score
score-mode nnvirtual gnus-msg nntp gnus-cache vc-git edebug backtrace
lisp-extra-font-lock local-layer personal gnus-icalendar org-capture
ob-plantuml ob-ditaa ob-python ob-shell shell ob-json sound-wav deferred
notifications dbus ox-md ox-odt rng-loc rng-uri rng-parse rng-match
rng-dt rng-util rng-pttrn nxml-parse nxml-ns nxml-enc xmltok nxml-util
ox-latex ox-icalendar ox-html table ox-ascii ox-publish ox org-element
avl-tree org ob ob-tangle ob-ref ob-lob ob-table ob-exp org-macro
org-footnote org-src ob-comint org-pcomplete pcomplete org-list
org-faces org-entities noutline outline org-version ob-emacs-lisp
ob-core ob-eval org-table ol org-keys org-compat org-macs org-loaddefs
find-func gnus-art mm-uu mml2015 mm-view mml-smime smime dig gnus-sum
url url-proxy url-privacy url-expand url-methods url-history mailcap shr
url-cookie url-domsuf url-util svg xml dom gnus-group gnus-undo
gnus-start gnus-cloud nnimap nnmail mail-source utf7 netrc nnoo
parse-time iso8601 gnus-spec gnus-int gnus-range message rmc puny dired
dired-loaddefs format-spec rfc822 mml mml-sec mailabbrev mailheader
gnus-win mm-decode mm-bodies mm-encode mail-parse rfc2231 gmm-utils
icalendar diary-lib diary-loaddefs cal-menu calendar cal-loaddefs
epa-file epa derived epg epg-config bbdb bbdb-site timezone gnus
nnheader gnus-util rmail rmail-loaddefs rfc2047 rfc2045 ietf-drums
text-property-search time-date mail-utils mm-util mail-prsvr wid-edit
ansible-layer dotnet-layer mark-layer visible-mark sf-kbd sf-guix
haskell-layer cc-layer js-layer eglot-layer latex-layer org-layer
python-layer perl-layer php-layer web-layer gnus-layer convenience-layer
yatemplate autoinsert auto-complete-layer string-inflection
clojure-snippets cl-extra yasnippet company-oddmuse company-keywords
company-etags etags fileloop generator company-gtags
company-dabbrev-code company-dabbrev company-files company-capf
company-cmake company-xcode company-clang company-semantic company-eclim
company-template company-bbdb company pcase elisp-layer morlock paxedit
rainbow-delimiters paredit eval-sexp-fu std-layer server
display-line-numbers cap-words superword subword highlight-symbol
persistent-scratch smartparens help-mode xref project guru-mode edmacro
kmacro paren editorconfig face-remap solaire-mode mb-depth saveplace
guide-key advice popwin ace-window avy immortal-scratch cc-styles
cc-align cc-engine cc-vars cc-defs winner diff-hl-flydiff diff diff-hl
vc-dir ewoc vc vc-dispatcher diff-mode easy-mmode doom-modeline
doom-modeline-segments doom-modeline-env doom-modeline-core shrink-path
f s all-the-icons all-the-icons-faces data-material data-weathericons
data-octicons data-fileicons data-faicons data-alltheicons memoize dash
projectile grep ibuf-ext ibuffer ibuffer-loaddefs thingatpt savehist
diminish sf-autoloads loader cerbere-mode-autoloads
docblock-mode-autoloads warnings compile comint ansi-color ring
hyperlight-theme rx tex-site info package easymenu browse-url
url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs
eieio-loaddefs password-cache json subr-x map url-vars seq byte-opt gv
bytecomp byte-compile cconv cl-loaddefs cl-lib early-init tooltip eldoc
electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win
x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite charscript charprop case-table epa-hook
jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote threads dbusbind inotify lcms2 dynamic-setting
system-font-setting font-render-setting cairo move-toolbar gtk x-toolkit
x multi-tty make-network-process emacs)

Memory information:
((conses 16 550291 213990)
 (symbols 48 39611 1)
 (strings 32 198004 26591)
 (string-bytes 1 7496295)
 (vectors 16 68196)
 (vector-slots 8 1612421 168866)
 (floats 8 876 1697)
 (intervals 56 23869 2698)
 (buffers 1000 68))