diff --git a/its/ruling/src/test/resources/commons-beanutils/java-S9357.json b/its/ruling/src/test/resources/commons-beanutils/java-S9357.json index 8dec2c78df4..fbcbd085cce 100644 --- a/its/ruling/src/test/resources/commons-beanutils/java-S9357.json +++ b/its/ruling/src/test/resources/commons-beanutils/java-S9357.json @@ -1,4 +1,14 @@ { +"commons-beanutils:commons-beanutils:src/main/java/org/apache/commons/beanutils2/BeanMap.java": [ +74, +83, +92, +101, +110, +119, +128, +137 +], "commons-beanutils:commons-beanutils:src/test/java/org/apache/commons/beanutils2/bugs/Jira509TestCase.java": [ 60 ] diff --git a/its/ruling/src/test/resources/eclipse-jetty-similar-to-main/java-S9357.json b/its/ruling/src/test/resources/eclipse-jetty-similar-to-main/java-S9357.json new file mode 100644 index 00000000000..d6f51dd9451 --- /dev/null +++ b/its/ruling/src/test/resources/eclipse-jetty-similar-to-main/java-S9357.json @@ -0,0 +1,11 @@ +{ +"org.eclipse.jetty:jetty-project:jetty-server/src/main/java/org/eclipse/jetty/server/AsyncContextState.java": [ +144 +], +"org.eclipse.jetty:jetty-project:jetty-server/src/main/java/org/eclipse/jetty/server/LowResourceMonitor.java": [ +74 +], +"org.eclipse.jetty:jetty-project:jetty-server/src/main/java/org/eclipse/jetty/server/session/SessionHandler.java": [ +297 +] +} diff --git a/its/ruling/src/test/resources/eclipse-jetty/java-S9357.json b/its/ruling/src/test/resources/eclipse-jetty/java-S9357.json index a234f34288b..a7e2d56f89e 100644 --- a/its/ruling/src/test/resources/eclipse-jetty/java-S9357.json +++ b/its/ruling/src/test/resources/eclipse-jetty/java-S9357.json @@ -1,4 +1,13 @@ { +"org.eclipse.jetty:jetty-project:jetty-server/src/main/java/org/eclipse/jetty/server/AsyncContextState.java": [ +144 +], +"org.eclipse.jetty:jetty-project:jetty-server/src/main/java/org/eclipse/jetty/server/LowResourceMonitor.java": [ +74 +], +"org.eclipse.jetty:jetty-project:jetty-server/src/main/java/org/eclipse/jetty/server/session/SessionHandler.java": [ +297 +], "org.eclipse.jetty:jetty-project:jetty-server/src/test/java/org/eclipse/jetty/server/RequestTest.java": [ 150, 203, @@ -18,6 +27,9 @@ "org.eclipse.jetty:jetty-project:jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SSLEngineTest.java": [ 285 ], +"org.eclipse.jetty:jetty-project:jetty-util/src/main/java/org/eclipse/jetty/util/MemoryUtils.java": [ +37 +], "org.eclipse.jetty:jetty-project:jetty-util/src/test/java/org/eclipse/jetty/util/IteratingCallbackTest.java": [ 219, 293, diff --git a/its/ruling/src/test/resources/guava/java-S9357.json b/its/ruling/src/test/resources/guava/java-S9357.json new file mode 100644 index 00000000000..e7881e1d44d --- /dev/null +++ b/its/ruling/src/test/resources/guava/java-S9357.json @@ -0,0 +1,176 @@ +{ +"com.google.guava:guava:src/com/google/common/base/Converter.java": [ +180 +], +"com.google.guava:guava:src/com/google/common/base/Optional.java": [ +297 +], +"com.google.guava:guava:src/com/google/common/base/Splitter.java": [ +148, +179, +230, +294 +], +"com.google.guava:guava:src/com/google/common/cache/CacheBuilder.java": [ +183 +], +"com.google.guava:guava:src/com/google/common/cache/LocalCache.java": [ +2327, +3547 +], +"com.google.guava:guava:src/com/google/common/cache/LongAddables.java": [ +38, +45 +], +"com.google.guava:guava:src/com/google/common/cache/RemovalListeners.java": [ +45, +48 +], +"com.google.guava:guava:src/com/google/common/collect/Collections2.java": [ +302 +], +"com.google.guava:guava:src/com/google/common/collect/FilteredEntryMultimap.java": [ +398 +], +"com.google.guava:guava:src/com/google/common/collect/Interners.java": [ +46 +], +"com.google.guava:guava:src/com/google/common/collect/Iterables.java": [ +1014 +], +"com.google.guava:guava:src/com/google/common/collect/Iterators.java": [ +1296 +], +"com.google.guava:guava:src/com/google/common/collect/MapConstraints.java": [ +227, +485 +], +"com.google.guava:guava:src/com/google/common/collect/Maps.java": [ +1863, +1874, +1888, +1922, +3098 +], +"com.google.guava:guava:src/com/google/common/collect/Multimaps.java": [ +519, +1202, +1702 +], +"com.google.guava:guava:src/com/google/common/collect/Multisets.java": [ +305 +], +"com.google.guava:guava:src/com/google/common/collect/MutableClassToInstanceMap.java": [ +64 +], +"com.google.guava:guava:src/com/google/common/collect/Range.java": [ +117, +129 +], +"com.google.guava:guava:src/com/google/common/collect/RegularImmutableTable.java": [ +114 +], +"com.google.guava:guava:src/com/google/common/collect/StandardTable.java": [ +721, +794 +], +"com.google.guava:guava:src/com/google/common/collect/Tables.java": [ +240, +390, +419, +429, +592 +], +"com.google.guava:guava:src/com/google/common/collect/TreeBasedTable.java": [ +321 +], +"com.google.guava:guava:src/com/google/common/escape/Escaper.java": [ +90 +], +"com.google.guava:guava:src/com/google/common/eventbus/Subscriber.java": [ +76 +], +"com.google.guava:guava:src/com/google/common/io/CharSource.java": [ +442 +], +"com.google.guava:guava:src/com/google/common/net/MediaType.java": [ +406, +744 +], +"com.google.guava:guava:src/com/google/common/reflect/ClassPath.java": [ +64 +], +"com.google.guava:guava:src/com/google/common/reflect/MutableTypeToInstanceMap.java": [ +124 +], +"com.google.guava:guava:src/com/google/common/reflect/TypeToken.java": [ +701 +], +"com.google.guava:guava:src/com/google/common/reflect/Types.java": [ +61 +], +"com.google.guava:guava:src/com/google/common/util/concurrent/AbstractExecutionThreadService.java": [ +45, +50, +145 +], +"com.google.guava:guava:src/com/google/common/util/concurrent/AbstractIdleService.java": [ +40, +50, +64, +95 +], +"com.google.guava:guava:src/com/google/common/util/concurrent/AbstractScheduledService.java": [ +205, +210, +232, +304 +], +"com.google.guava:guava:src/com/google/common/util/concurrent/AggregateFuture.java": [ +138 +], +"com.google.guava:guava:src/com/google/common/util/concurrent/AtomicLongMap.java": [ +294 +], +"com.google.guava:guava:src/com/google/common/util/concurrent/Callables.java": [ +44, +94 +], +"com.google.guava:guava:src/com/google/common/util/concurrent/Futures.java": [ +1168, +1494, +1569, +1662, +1749 +], +"com.google.guava:guava:src/com/google/common/util/concurrent/FuturesGetChecked.java": [ +253 +], +"com.google.guava:guava:src/com/google/common/util/concurrent/JdkFutureAdapters.java": [ +160 +], +"com.google.guava:guava:src/com/google/common/util/concurrent/MoreExecutors.java": [ +204, +754, +856 +], +"com.google.guava:guava:src/com/google/common/util/concurrent/Runnables.java": [ +31 +], +"com.google.guava:guava:src/com/google/common/util/concurrent/ServiceManager.java": [ +598 +], +"com.google.guava:guava:src/com/google/common/util/concurrent/Striped.java": [ +199, +214, +236, +252, +283 +], +"com.google.guava:guava:src/com/google/common/util/concurrent/ThreadFactoryBuilder.java": [ +161 +], +"com.google.guava:guava:src/com/google/common/util/concurrent/WrappingExecutorService.java": [ +67 +] +} diff --git a/its/ruling/src/test/resources/mall/java-S9357.json b/its/ruling/src/test/resources/mall/java-S9357.json new file mode 100644 index 00000000000..1245f4a90b1 --- /dev/null +++ b/its/ruling/src/test/resources/mall/java-S9357.json @@ -0,0 +1,6 @@ +{ +"com.macro.mall:mall:mall-portal/src/main/java/com/macro/mall/portal/service/impl/OmsPromotionServiceImpl.java": [ +177, +211 +] +} diff --git a/its/ruling/src/test/resources/sonar-server/java-S9357.json b/its/ruling/src/test/resources/sonar-server/java-S9357.json index ab90c0f4e03..859e9241a2d 100644 --- a/its/ruling/src/test/resources/sonar-server/java-S9357.json +++ b/its/ruling/src/test/resources/sonar-server/java-S9357.json @@ -1,4 +1,11 @@ { +"org.sonarsource.sonarqube:sonar-server:src/main/java/org/sonar/server/computation/task/projectanalysis/issue/NewEffortCalculator.java": [ +55 +], +"org.sonarsource.sonarqube:sonar-server:src/main/java/org/sonar/server/issue/IssuesFinderSort.java": [ +89, +142 +], "org.sonarsource.sonarqube:sonar-server:src/test/java/org/sonar/server/computation/task/container/TaskContainerImplTest.java": [ 64 ], diff --git a/sonar-java-plugin/src/main/resources/org/sonar/l10n/java/rules/java/S5542.html b/sonar-java-plugin/src/main/resources/org/sonar/l10n/java/rules/java/S5542.html index affebc7a3fa..6ea4bfb91ce 100644 --- a/sonar-java-plugin/src/main/resources/org/sonar/l10n/java/rules/java/S5542.html +++ b/sonar-java-plugin/src/main/resources/org/sonar/l10n/java/rules/java/S5542.html @@ -17,8 +17,9 @@

Why is this an issue?

For AES, the weakest mode is ECB (Electronic Codebook). Repeated blocks of data are encrypted to the same value, making them easy to identify and reducing the difficulty of recovering the original cleartext.

For RSA, the weakest algorithms are either using it without padding or using the PKCS1v1.5 padding scheme.

+

For RSA signatures, the generally recommended good practice is to use RSASSA-PSS.

What is the potential impact?

-

The cleartext of an encrypted message might be recoverable. Additionally, it might be possible to modify the cleartext of an encrypted message.

+

The cleartext of an encrypted message might be recoverable, modifiable, or a signature might be forged.

Below are some real-world scenarios that illustrate possible impacts of an attacker exploiting the vulnerability.

Theft of sensitive data

The encrypted message might contain data that is considered sensitive and should not be known to third parties.

@@ -26,6 +27,9 @@

Theft of sensitive data

Additional attack surface

By modifying the cleartext of the encrypted message it might be possible for an attacker to trigger other vulnerabilities in the code. Encrypted values are often considered trusted, since under normal circumstances it would not be possible for a third party to modify them.

+

Forged signatures

+

A weak signature padding scheme without a security proof might allow an attacker to forge a signature that a flawed verifier implementation accepts +as valid, undermining the trust and integrity guarantees signatures are meant to provide.

How to fix it in Java Cryptography Extension

Code examples

Noncompliant code example

@@ -104,6 +108,10 @@

For AES: use authenticated encryption modes

For RSA: use the OAEP scheme

The Optimal Asymmetric Encryption Padding scheme (OAEP) adds randomness and a secure hash function that strengthens the regular inner workings of RSA.

+

For RSA signatures: use the RSASSA-PSS scheme

+

The Probabilistic Signature Scheme (RSASSA-PSS) uses a randomized encoding and comes with a security proof, whereas the older PKCS#1 v1.5 signature +scheme (RSASSA-PKCS1-v1_5) has none and has repeatedly enabled signature forgery against flawed verifier implementations.

+

IETF RFC 8017 therefore requires RSASSA-PSS for new applications, in the interest of increased robustness.

Resources

Articles & blog posts

+ diff --git a/sonar-java-plugin/src/main/resources/profiles/Sonar_way/S9345 b/sonar-java-plugin/src/main/resources/profiles/Sonar_way/S9345 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/sonarpedia.json b/sonarpedia.json index f0cde627ead..b1acb92d2cf 100644 --- a/sonarpedia.json +++ b/sonarpedia.json @@ -4,7 +4,7 @@ "JAVA" ], "profiles-path": "./sonar-java-plugin/src/main/resources/profiles", - "latest-update": "2026-08-20T11:55:51.315148260Z", + "latest-update": "2026-08-27T11:00:00.611131466Z", "options": { "no-language-in-filenames": true, "preserve-filenames": false