Skip to content

Commit

Permalink
Fixed: Logout may create a "HTTP Status 500 - Internal Server Error" …
Browse files Browse the repository at this point in the history
…(OFBIZ-13136)

Using <tracking-mode>COOKIE</tracking-mode> did not work.
A workaround is to check we don't need to handle the CVE-2024-32113, bypassing
by using
  if (!requestUri.matches("/control/logout;jsessionid=[A-Z0-9]{32}\\.jvm1")) {
  • Loading branch information
JacquesLeRoux committed Sep 8, 2024
1 parent 1940a9d commit ff72e55
Showing 1 changed file with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,17 +134,19 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha
String requestUri = httpRequest.getRequestURI().substring(httpRequest.getContextPath().length());

// Reject wrong URLs
try {
String url = new URI(((HttpServletRequest) request).getRequestURL().toString())
.normalize().toString()
.replaceAll(";", "")
.replaceAll("(?i)%2e", "");
if (!((HttpServletRequest) request).getRequestURL().toString().equals(url)) {
Debug.logError("For security reason this URL is not accepted", module);
throw new RuntimeException("For security reason this URL is not accepted");
if (!requestUri.matches("/control/logout;jsessionid=[A-Z0-9]{32}\\.jvm1")) {
try {
String url = new URI(((HttpServletRequest) request).getRequestURL().toString())
.normalize().toString()
.replaceAll(";", "")
.replaceAll("(?i)%2e", "");
if (!((HttpServletRequest) request).getRequestURL().toString().equals(url)) {
Debug.logError("For security reason this URL is not accepted", module);
throw new RuntimeException("For security reason this URL is not accepted");
}
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}

int offset = requestUri.indexOf("/", 1);
Expand Down

2 comments on commit ff72e55

@saicharanreddykowkuntla

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "HTTP Status 500 - Internal Server Error" occurs for other requests as well (see attached snapshot from demo)!Image

Line 137 may be replaced with : if (requestUri.matches(".*;jsessionid=[A-Z0-9]{32}\\.jvm1")) {

@JacquesLeRoux
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @saicharanreddykowkuntla,

How did you get to have a jessionid in this URL if not manually? TIA

Please sign in to comment.