Skip to content

Add reachable CVE-2022-42889 (Text4Shell) via commons-text 1.9#83

Closed
michail-melizanis-sonarsource wants to merge 1 commit into
mainfrom
feature/reachability-demo
Closed

Add reachable CVE-2022-42889 (Text4Shell) via commons-text 1.9#83
michail-melizanis-sonarsource wants to merge 1 commit into
mainfrom
feature/reachability-demo

Conversation

@michail-melizanis-sonarsource

Copy link
Copy Markdown

Purpose

Demonstrates SCA reachability analysis for Java on SonarQube.

What this PR does

  • Adds commons-text:1.9 to pom.xml (affected by CVE-2022-42889, "Text4Shell")
  • Adds TemplateServlet.java which calls StringSubstitutor.replaceSystemProperties(userInput) — a direct, single-hop call to the vulnerable function in the dependency

Why this triggers reachability

The call graph is clear and shallow:

TemplateServlet.doGet()
  → StringSubstitutor.replaceSystemProperties(template)   ← vulnerable function (CVE-2022-42889)

User-controlled input (template request parameter) flows directly into the vulnerable method, making this CVE reachable from first-party code.

Expected SonarQube result

After analysis, the SCA panel should show commons-text:1.9 with hasReachableLocations: true for CVE-2022-42889.

Adds TemplateServlet that calls StringSubstitutor.replaceSystemProperties()
with user-controlled input, creating a direct reachable path to the
vulnerable function in commons-text 1.9 (Text4Shell, CVE-2022-42889).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sonar-nautilus

sonar-nautilus Bot commented May 13, 2026

Copy link
Copy Markdown

Quality Gate failed Quality Gate failed

Failed conditions
1 New issue

See analysis details on SonarQube

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE SonarQube for IDE

Comment thread src/main/java/demo/security/servlet/TemplateServlet.java Dismissed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants