Skip to content
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

There is an Incorrect Access Control vulnerability in MallChat #179

Open
RacerZ-fighting opened this issue Sep 28, 2024 · 0 comments
Open

Comments

@RacerZ-fighting
Copy link

RacerZ-fighting commented Sep 28, 2024

Version: latest

Brach: main

Problem

There is an authentication bypass vulnerability in MallChat. An attacker can exploit this vulnerability to access /capi/ API without any token.

Sourcecode

  1. The affected source code class is com.abin.mallchat.common.common.intecepter.TokenInterceptor, and the affected function is preHandle. In the filter code, use request.getRequestURI() to obtain the request path,
image

and then determine whether the third part of path equals public.

image

If the condition is met, it will execute return true to bypass the Interceptor. Otherwise, it will block the current request and issue an login error in the response.

  1. The problem lies in using request.getRequestURI() to obtain the request path. The path obtained by this function will not parse special symbols, but will be passed on directly, so you can use ../ to bypass it.

The prerequisite for the vulnerability exploitation is that the server.servlet.context-path configuration is non-empty. Here, it is exemplified with /demo.Taking one of the backend interfaces /capi/user/userInfo as an example(full path in case is /demo/capi/user/userInfo), using /xxx/yyy/public/../../../demo/capi/user/userInfo can make it satisfy isPublicURI(), and at the same time, it can request the userInfo interface to achieve login bypass.

Reproduce the vulnerablitity

Accessing http://localhost:8080/demo/capi/user/userInfo directly will result in an error response.
image
However, accessing http://localhost:8080/xxx/yyy/public/../../../demo/capi/user/userInfo will bypass the authentication check.
image

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

No branches or pull requests

1 participant