Skip to content

[3.9] gh-121284: Fix email address header folding with parsed encoded-word (GH-122754) - #131412

Merged
ambv merged 1 commit into
python:3.9from
encukou:backport-295b53d-3.9
Apr 3, 2025
Merged

[3.9] gh-121284: Fix email address header folding with parsed encoded-word (GH-122754)#131412
ambv merged 1 commit into
python:3.9from
encukou:backport-295b53d-3.9

Conversation

@encukou

@encukouencukou commented Mar 18, 2025

Copy link
Copy Markdown
Member

Email generators using email.policy.default may convert an RFC 2047 encoded-word to unencoded form during header refolding. In a structured header, this could allow 'specials' chars outside a quoted-string, leading to invalid address headers and enabling spoofing. This change ensures a parsed encoded-word that contains specials is kept as an encoded-word while the header is refolded.

[Better fix from @bitdancer.]


(cherry picked from commit 295b53d)

…ncoded-word (pythonGH-122754)
Email generators using email.policy.default may convert an RFC 2047
encoded-word to unencoded form during header refolding. In a structured
header, this could allow 'specials' chars outside a quoted-string,
leading to invalid address headers and enabling spoofing. This change
ensures a parsed encoded-word that contains specials is kept as an
encoded-word while the header is refolded.
[Better fix from @bitdancer.]
---------
(cherry picked from commit 295b53d)
Co-authored-by: Mike Edmunds <medmunds@gmail.com>
Co-authored-by: R David Murray <rdmurray@bitdance.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
@ambv
ambv merged commit 9a31386 into python:3.9Apr 3, 2025
gentoo-bot pushed a commit to gentoo/cpython that referenced this pull request Apr 9, 2025
…ncoded-word (pythonGH-122754) (pythonGH-131412)
Email generators using email.policy.default may convert an RFC 2047
encoded-word to unencoded form during header refolding. In a structured
header, this could allow 'specials' chars outside a quoted-string,
leading to invalid address headers and enabling spoofing. This change
ensures a parsed encoded-word that contains specials is kept as an
encoded-word while the header is refolded.
[Better fix from @bitdancer.]
(cherry picked from commit 295b53d)
Co-authored-by: Mike Edmunds <medmunds@gmail.com>
Co-authored-by: R David Murray <rdmurray@bitdance.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic-emailtype-securityA security issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@encukou@bitdancer@ambv@medmunds