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][sec] Upgrade Bouncycastle to 1.75 to address CVE-2023-33201 #20631

Merged
merged 5 commits into from
Jun 23, 2023

Conversation

lhotari
Copy link
Member

@lhotari lhotari commented Jun 22, 2023

Motivation

OWASP Dependency Check fails

Error:  bcprov-ext-jdk15on-1.69.jar: CVE-2023-33201(6.5)
Error:  bcprov-jdk15on-1.69.jar: CVE-2023-33201(6.5)

Upgrade Bouncycastle to 1.75 to address CVE-2023-33201.

Modifications

Bouncycastle has switched to Java 8 (1.8) as the baseline since 1.71. When upgrading to 1.75, it is necessary to
exclude thebc*-jdk15on dependencies and instead use the bc*-jdk18on dependencies. Since many libraries
have the jdk15on dependency as a transient dependency, it is necessary to handle the exclusions while upgrading.

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

@lhotari
Copy link
Member Author

lhotari commented Jun 22, 2023

  Caused by: java.lang.IllegalArgumentException: cannot handle supplied parameter spec: must be passed IES parameters
  	at org.bouncycastle.jcajce.provider.asymmetric.ec.IESCipher.engineInit(Unknown Source)
  	at java.base/javax.crypto.Cipher.init(Cipher.java:1296)
  	at java.base/javax.crypto.Cipher.init(Cipher.java:1236)
  	at org.apache.pulsar.client.impl.crypto.MessageCryptoBc.addPublicKeyCipher(MessageCryptoBc.java:336)
  	at org.apache.pulsar.client.impl.crypto.MessageCryptoBc.encrypt(MessageCryptoBc.java:395)
  	at org.apache.pulsar.client.impl.ProducerImpl.encryptMessage(ProducerImpl.java:829)
  	at org.apache.pulsar.client.impl.ProducerImpl.serializeAndSendMessage(ProducerImpl.java:682)
  	at org.apache.pulsar.client.impl.ProducerImpl.sendAsync(ProducerImpl.java:559)
  	... 17 more

It seems that some code changes are required:

For at least some ECIES variants (e.g. when using CBC) there is an issue with potential malleability of a nonce (implying silent malleability of the plaintext) that must be sent alongside the ciphertext but is outside the IES integrity check. For this reason the automatic generation of nonces with IED is now disabled and they have to be passed in using an IESParameterSpec. The current advice is to agree on a nonce between parties and then rely on the use of the ephemeral key component to allow the nonce (rather the so called nonce) usage to be extended.

https://www.bouncycastle.org/releasenotes.html , changes in 1.72

Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

I wonder if the bookie would start with TLS enabled given that we had to do some changes in the code

@lhotari
Copy link
Member Author

lhotari commented Jun 22, 2023

this seems to be the change that makes it necessary to pass the IESParametersSpec:
bcgit/bc-java@5f7b6e7

@lhotari lhotari merged commit 46b6dcd into apache:master Jun 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/security doc-not-needed Your PR changes do not impact docs ready-to-test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants