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

[SECURITY] Denial of service because of unsafe regex processing #23

Closed
ghost opened this issue Jun 10, 2021 · 3 comments · Fixed by #25
Closed

[SECURITY] Denial of service because of unsafe regex processing #23

ghost opened this issue Jun 10, 2021 · 3 comments · Fixed by #25

Comments

@ghost
Copy link

ghost commented Jun 10, 2021

I have tried to contact you by zcool321@sina.com and created #22 asking for the contact. Nobody replied.

The JFinal_cms is vulnerable to regex injection that may lead to Denial of Service.

User controlled path and contextPath are used to build and run a regex expression (first argument to replaceFirst):

protected String getFilePath() {
String path = this.get.get("path");
return getFilePath(path);
}
/**
* get File Path
* <p>
* 2016年2月26日 下午3:47:37 flyfox 369191470@qq.com
*
* @return
*/
protected String getFilePath(String path) {
String contextPath = this.get.get("contextPath");
// 根目录
if (StrUtils.isEmpty(contextPath)) {
return path;
}
if (path.startsWith(contextPath)) {
path = path.replaceFirst(contextPath, "");

Since the attacker controls the string and the regex pattern he may cause a ReDoS by regex catastrophic backtracking on the server side.

@zcool321
Copy link
Contributor

Thank u for feedback .
for easy, There is a problem.

@ghost
Copy link
Author

ghost commented Jul 20, 2021

Hi, is there any update on this?

@ghost
Copy link
Author

ghost commented Dec 17, 2021

Mitre assigned CVE-2021-37262 ID for the issue.

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 a pull request may close this issue.

1 participant