CVE-2020-8929
Ciphertext Malleability Issue in Tink Java
Description
Impact
Tink's Java version before 1.5 under some circumstances allowed attackers to change the key ID part of the ciphertext, resulting in the attacker creating a second ciphertext that will decrypt to the same plaintext. This can be a problem in particular in the case of encrypting with a deterministic AEAD with a single key, and relying on the fact that there is only a single valid ciphertext per plaintext.
No loss of confidentiality or loss of plaintext integrity occurs due to this problem, only ciphertext integrity is compromised.
Patches
The issue was fixed in this pull request.
Workarounds
The only workaround is to backport the fixing pull request.
Details
Tink uses the first five bytes of a ciphertext for a version byte and a four byte key ID. Since each key has a well defined prefix, this extends non-malleability properties (but technically not indistinguishability). However, in the Java version this prefix lookup used a hash map indexed by unicode strings instead of the byte array, which means that invalid Unicode characters would be replaced by U+FFFD by the Java API's default behavior. This means several different values for the five bytes would result in the same hash table key, which allows an attacker to exchange one invalid byte sequence for another, creating a mutated ciphertext that still decrypts (to the same plaintext).
Acknowledgements
We'd like to thank Peter Esbensen for finding this issue and raising it internally.
For more information
If you have any questions or comments about this advisory:
- Open an issue in Tink
Affected Maven artifacts (1)
| Artifact | Affected versions | Fixed in |
|---|---|---|
| com.google.crypto.tink » tink | < 1.5.0 | 1.5.0 |
Blast radius
62% of the dependent artifacts (633) still pull an affected version in their latest release.
| Depth | Dependent versions |
|---|---|
| Direct | 3,077 |
| 2 hops | 6,457 |
| 3 hops | 5,065 |
| 4 hops | 719 |
| 5 hops | 179 |
| 6 hops | 88 |
Most used dependents
- com.android.tools.build » gradle2,197 usages
- com.avito.android » android38 usages
- org.codice.ddf » kernel27 usages
- org.jenkins-ci.plugins » trilead-api27 usages
- org.jenkins-ci » trilead-ssh223 usages
- com.rickbusarow.modulecheck » modulecheck-project-api23 usages
- ddf.features » test-utilities21 usages
- com.raxdenstudios » android-plugins20 usages
- org.odpi.egeria » repository-services-implementation17 usages
- com.quinn.hunter » hunter-transform17 usages
- io.freefair.gradle » android-gradle-plugins16 usages
- org.odpi.egeria » connector-configuration-factory16 usages
- io.gravitee.am.gateway.handler » gravitee-am-gateway-handler-common15 usages
- com.avito.android » impact14 usages
- com.squareup.misk » misk-hibernate14 usages
Computed from the dependency graph of build 20261129.2353 (compile and runtime scopes, nearest version wins). Exclusions and dependency management in consuming projects are not applied, so dependents are potentially affected. When several artifacts are affected, a dependent version that pulls more than one of them is counted once per artifact.
Other ecosystems
Also affects PyPI (1 package) . See all on OSV
References
| Advisory | NVD CVE-2020-8929 | nvd.nist.gov |
| Web | google/tink advisory GHSA-g5vf-v6wf-7w2r | github.com |
| Web | google/tink commit 93d839a | github.com |
| Web | pypa/advisory-database PYSEC-2020-142.yaml | github.com |
