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 are XSS vulnerabilities in some cases #188

Closed
ghost opened this issue May 13, 2021 · 2 comments
Closed

There are XSS vulnerabilities in some cases #188

ghost opened this issue May 13, 2021 · 2 comments

Comments

@ghost
Copy link

ghost commented May 13, 2021

The main reason is that the controller does not filter the parameters during rendering, which leads to malicious input of users and may lead to XSS

I wrote a demo:

Controller

@Path("/test")
public class TestController extends Controller{

    public void index() {
        String param  = getPara("param");
        System.out.println(param);
        set("param", param);
        render("test.html");
    }
}

test.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
#(param)
</body>
</html>

The request parameter is "param",payload is http://[your-ip]/test?param=<svg/onload='alert(1)'>

If the user's input is output directly, XSS will be caused after the controller's set method is set. If the malicious parameters of controller are taken from the database, XSS vulnerability will be stored

  • Repair

The attributeValue should be judged before the set method calls request.setAttribute. If it is in string format, the harmful characters should be filtered, such as <script>

public Controller set(String attributeName, Object attributeValue) {
  request.setAttribute(attributeName, attributeValue);
  return this;
}
@OS-WS
Copy link

OS-WS commented Jun 27, 2021

Hi @jfinal @HyCXSS ,
This issue was assigned with CVE-2021-33348
Was this issue fixed?
If so, in what commit?

@jfinal
Copy link
Owner

jfinal commented Jun 28, 2021

@HyCXSS @OS-WS web Web framework doesn't need to filter request data. In addition to performance, it also needs to consider JS script in user business data

@jfinal jfinal closed this as completed Jun 28, 2021
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

2 participants