-
Notifications
You must be signed in to change notification settings - Fork 60
Add reachable CVE-2022-42889 (Text4Shell) via commons-text 1.9 #83
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| package demo.security.servlet; | ||
|
|
||
| import org.apache.commons.text.StringSubstitutor; | ||
|
|
||
| import javax.servlet.ServletException; | ||
| import javax.servlet.annotation.WebServlet; | ||
| import javax.servlet.http.HttpServlet; | ||
| import javax.servlet.http.HttpServletRequest; | ||
| import javax.servlet.http.HttpServletResponse; | ||
| import java.io.IOException; | ||
| import java.io.PrintWriter; | ||
|
|
||
| @WebServlet("/template") | ||
| public class TemplateServlet extends HttpServlet { | ||
|
|
||
| protected void doGet(HttpServletRequest request, HttpServletResponse response) | ||
|
Check warning on line 16 in src/main/java/demo/security/servlet/TemplateServlet.java
|
||
| throws ServletException, IOException { | ||
| String template = request.getParameter("template"); | ||
| // CVE-2022-42889: StringSubstitutor with user-controlled input allows | ||
| // arbitrary code execution via script/dns/url lookups | ||
| String result = StringSubstitutor.replaceSystemProperties(template); | ||
| response.setContentType("text/html"); | ||
| PrintWriter out = response.getWriter(); | ||
|
Check warning on line 23 in src/main/java/demo/security/servlet/TemplateServlet.java
|
||
| out.print("<p>" + result + "</p>"); | ||
| out.close(); | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.