Skip to content
Permalink
main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time

Arbitrary file upload / CVE-2022-28052

  1. cn/roothub/web/front/CommonController.java:35
    At "/common/upload" api, parameter "customPath" is used as 2nd param of storageService.store();
    image



  1. Then the "path" is concatenated to storageProperties.getUploadFiledir(), finally passed to path.resolve();
    image



  1. In FileNameUtil.getFileName(), it just simply renames the basename of file with random uuid and concatenated the suffix;
    image



  1. So we only need to
    - tamper the suffix of an originally valid file to bypass the front-end validation
    - construct the customPath param in post body params which includes "../" to complete path traversal



  1. Final payload:
    image



  1. Here we used /etc/bash_completion.d to add an shell script, so the RCE will be triggered automatically each time the victim logs into bash, which is super ez to achieve.
    image



  1. After the login, we can see that the code had gotten executed.
    image