Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix BIO_f_cipher flushing and other BIO related fixes (1.1.1) #19920

Conversation

mattcaswell
Copy link
Member

If an error occurs during a flush on a BIO_f_cipher() then in some cases
we could get into an infinite loop. We add a check to make sure we are
making progress during flush and exit if not.

This issue was reported by Octavio Galland who also demonstrated an
infinite loop in CMS encryption as a result of this bug.

The security team has assessed this issue as not a CVE. This occurs on
encryption only which is typically processing trusted data. We are not
aware of a way to trigger this with untrusted data.

Backport of #19918 for 1.1.1.

If an error occurs during a flush on a BIO_f_cipher() then in some cases
we could get into an infinite loop. We add a check to make sure we are
making progress during flush and exit if not.

This issue was reported by Octavio Galland who also demonstrated an
infinite loop in CMS encryption as a result of this bug.

The security team has assessed this issue as not a CVE. This occurs on
*encryption* only which is typically processing trusted data. We are not
aware of a way to trigger this with untrusted data.
If the BIO unexpectedly fails to flush then SMIME_crlf_copy() was not
correctly reporting the error. We modify it to properly propagate the
error condition.
Some things that may go wrong in asn1_bio_write() are serious errors
that should be reported as -1, rather than 0 (which just means "we wrote
no data").
If the cipher being used in ossl_cms_EncryptedContent_init_bio() has no
associated OID then we should report an error rather than continuing on
regardless. Continuing on still ends up failing - but later on and with a
more cryptic error message.
@mattcaswell mattcaswell added approval: review pending This pull request needs review by a committer branch: 1.1.1 Merge to OpenSSL_1_1_1-stable branch approval: otc review pending This pull request needs review by an OTC member labels Dec 15, 2022
@mattcaswell mattcaswell changed the title Fix BIO_f_cipher flushing and other BIO related fixes Fix BIO_f_cipher flushing and other BIO related fixes (1.1.1) Dec 15, 2022
@mattcaswell
Copy link
Member Author

Lots of CI failures which don't seem related to this PR!!?

@bernd-edlinger
Copy link
Member

I have a couple CI-fixes in my 111 feature branch, but I figured it would not be acceptable for 1.1.1
so I did not try to create a PR for that.

@bernd-edlinger
Copy link
Member

bernd-edlinger commented Dec 15, 2022

wrong buton. sorry!

@t8m t8m added triaged: bug The issue/pr is/fixes a bug tests: present The PR has suitable tests present tests: exempted The PR is exempt from requirements for testing and removed tests: present The PR has suitable tests present labels Dec 16, 2022
@t8m
Copy link
Member

t8m commented Dec 16, 2022

I assume backporting the test from 3.0 PR would be too big change as the test_cms recipe has quite evolved since 1.1.1

@hlandau hlandau added approval: done This pull request has the required number of approvals and removed approval: review pending This pull request needs review by a committer approval: otc review pending This pull request needs review by an OTC member labels Dec 16, 2022
@openssl-machine openssl-machine added approval: ready to merge The 24 hour grace period has passed, ready to merge and removed approval: done This pull request has the required number of approvals labels Dec 17, 2022
@openssl-machine
Copy link
Collaborator

This pull request is ready to merge

@t8m
Copy link
Member

t8m commented Dec 22, 2022

Merged to 1.1.1 branch.

@t8m t8m closed this Dec 22, 2022
openssl-machine pushed a commit that referenced this pull request Dec 22, 2022
If an error occurs during a flush on a BIO_f_cipher() then in some cases
we could get into an infinite loop. We add a check to make sure we are
making progress during flush and exit if not.

This issue was reported by Octavio Galland who also demonstrated an
infinite loop in CMS encryption as a result of this bug.

The security team has assessed this issue as not a CVE. This occurs on
*encryption* only which is typically processing trusted data. We are not
aware of a way to trigger this with untrusted data.

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from #19920)
openssl-machine pushed a commit that referenced this pull request Dec 22, 2022
If the BIO unexpectedly fails to flush then SMIME_crlf_copy() was not
correctly reporting the error. We modify it to properly propagate the
error condition.

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from #19920)
openssl-machine pushed a commit that referenced this pull request Dec 22, 2022
Some things that may go wrong in asn1_bio_write() are serious errors
that should be reported as -1, rather than 0 (which just means "we wrote
no data").

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from #19920)
openssl-machine pushed a commit that referenced this pull request Dec 22, 2022
If the cipher being used in ossl_cms_EncryptedContent_init_bio() has no
associated OID then we should report an error rather than continuing on
regardless. Continuing on still ends up failing - but later on and with a
more cryptic error message.

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from #19920)
@bernd-edlinger
Copy link
Member

Hmm, I think it seems pointless to back-port commit 1354191,
"Fix SMIME_crlf_copy() to properly report an error" changing the return value
of SMIME_crlf_copy because this return value is never used in 1.1.1
I see it is only propagated in 3.0/3.1/master.
Is this something that also needs to be fixed?

bernd-edlinger pushed a commit to bernd-edlinger/openssl that referenced this pull request Dec 25, 2022
If an error occurs during a flush on a BIO_f_cipher() then in some cases
we could get into an infinite loop. We add a check to make sure we are
making progress during flush and exit if not.

This issue was reported by Octavio Galland who also demonstrated an
infinite loop in CMS encryption as a result of this bug.

The security team has assessed this issue as not a CVE. This occurs on
*encryption* only which is typically processing trusted data. We are not
aware of a way to trigger this with untrusted data.

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from openssl#19920)

(cherry picked from commit e913b91)
bernd-edlinger pushed a commit to bernd-edlinger/openssl that referenced this pull request Dec 25, 2022
If an error occurs during a flush on a BIO_f_cipher() then in some cases
we could get into an infinite loop. We add a check to make sure we are
making progress during flush and exit if not.

This issue was reported by Octavio Galland who also demonstrated an
infinite loop in CMS encryption as a result of this bug.

The security team has assessed this issue as not a CVE. This occurs on
*encryption* only which is typically processing trusted data. We are not
aware of a way to trigger this with untrusted data.

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from openssl#19920)

(cherry picked from commit e913b91)
bernd-edlinger pushed a commit to bernd-edlinger/openssl that referenced this pull request Dec 25, 2022
If an error occurs during a flush on a BIO_f_cipher() then in some cases
we could get into an infinite loop. We add a check to make sure we are
making progress during flush and exit if not.

This issue was reported by Octavio Galland who also demonstrated an
infinite loop in CMS encryption as a result of this bug.

The security team has assessed this issue as not a CVE. This occurs on
*encryption* only which is typically processing trusted data. We are not
aware of a way to trigger this with untrusted data.

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from openssl#19920)

(cherry picked from commit e913b91)
bernd-edlinger pushed a commit to bernd-edlinger/openssl that referenced this pull request Dec 25, 2022
If an error occurs during a flush on a BIO_f_cipher() then in some cases
we could get into an infinite loop. We add a check to make sure we are
making progress during flush and exit if not.

This issue was reported by Octavio Galland who also demonstrated an
infinite loop in CMS encryption as a result of this bug.

The security team has assessed this issue as not a CVE. This occurs on
*encryption* only which is typically processing trusted data. We are not
aware of a way to trigger this with untrusted data.

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from openssl#19920)

(cherry picked from commit e913b91)
bernd-edlinger pushed a commit to bernd-edlinger/openssl that referenced this pull request Dec 25, 2022
If an error occurs during a flush on a BIO_f_cipher() then in some cases
we could get into an infinite loop. We add a check to make sure we are
making progress during flush and exit if not.

This issue was reported by Octavio Galland who also demonstrated an
infinite loop in CMS encryption as a result of this bug.

The security team has assessed this issue as not a CVE. This occurs on
*encryption* only which is typically processing trusted data. We are not
aware of a way to trigger this with untrusted data.

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from openssl#19920)

(cherry picked from commit e913b91)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approval: ready to merge The 24 hour grace period has passed, ready to merge branch: 1.1.1 Merge to OpenSSL_1_1_1-stable branch tests: exempted The PR is exempt from requirements for testing triaged: bug The issue/pr is/fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants