Skip to content

Commit 49c71fc

Browse files
committed
Fix potential XSS in host-manager.
This is CVE-2008-1947. git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@662582 13f79535-47bb-0310-9956-ffa450edef68
1 parent e0200b0 commit 49c71fc

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

java/org/apache/catalina/manager/host/HTMLHostManagerServlet.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import java.io.IOException;
2222
import java.io.PrintWriter;
2323
import java.io.StringWriter;
24+
import java.net.URLEncoder;
2425
import java.text.MessageFormat;
2526
import java.util.Iterator;
2627
import java.util.Map;
@@ -278,17 +279,20 @@ public void list(HttpServletRequest request,
278279
args = new Object[7];
279280
args[0] = response.encodeURL
280281
(request.getContextPath() +
281-
"/html/start?name=" + hostName);
282+
"/html/start?name=" +
283+
URLEncoder.encode(hostName, "UTF-8"));
282284
args[1] = hostsStart;
283285
args[2] = response.encodeURL
284286
(request.getContextPath() +
285-
"/html/stop?name=" + hostName);
287+
"/html/stop?name=" +
288+
URLEncoder.encode(hostName, "UTF-8"));
286289
args[3] = hostsStop;
287290
args[4] = response.encodeURL
288291
(request.getContextPath() +
289-
"/html/remove?name=" + hostName);
292+
"/html/remove?name=" +
293+
URLEncoder.encode(hostName, "UTF-8"));
290294
args[5] = hostsRemove;
291-
args[6] = hostName;
295+
args[6] = RequestUtil.filter(hostName);
292296
if (host == this.host) {
293297
writer.print(MessageFormat.format(
294298
MANAGER_HOST_ROW_BUTTON_SECTION, args));

0 commit comments

Comments
 (0)