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

The Broken Access Control vulnerability exists in the latest version of SENS #21

Open
altEr1125 opened this issue Nov 19, 2022 · 0 comments

Comments

@altEr1125
Copy link

This project has file upload function. The corresponding code for this function is located in com.liuyanzhao.sens.web.controller.admin#upload

@PostMapping(value = "/upload", produces = {"application/json;charset=UTF-8"})
    @ResponseBody
    @SystemLog(description = "上传文件", type = LogTypeEnum.ATTACHMENT)
    public Map<String, Object> upload(@RequestParam("file") MultipartFile file,
                                      HttpServletRequest request) {
        return uploadAttachment(file, request);
}

The Upload method calls the uploadAttachment() method.

image

After audit, we can find that the code does not restrict the ownership of files, so you can access the files uploaded by any user without authorization.
Use the website provided by the project author to demonstrate the vulnerability.
The user a, upload a file, the file path is “/upload/2022/11/test1.HTML”

image

At this time, log in to another user and enter the above path to achieve unauthorized access to any file.

image

Solution: Add a filtering mechanism.

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