
Responsive Filemanager < 9.12.0에서 업로드 제한 우회로 RCE를 유발하는 PoC
Responsive Filemanager < 9.12.0의 업로드 제한 우회로 인한 RCE PoC
새 파일을 업로드할 때 fix_filename 함수를 거칩니다: https://github.com/trippo/ResponsiveFilemanager/blob/9a7411f3eab3b7d8e2c78dcf40b4325bde2c548d/filemanager/upload.php#L112
이 함수에는 대괄호를 찾아 제거하는 strip_tags 함수가 있습니다: https://github.com/trippo/ResponsiveFilemanager/blob/9a7411f3eab3b7d8e2c78dcf40b4325bde2c548d/filemanager/include/utils.php#L581
따라서 shell.php<.txt와 같은 파일명으로 전송하면 strip_tags 함수에 의해 shell.php로 이름이 변경됩니다.
하지만 파일 콘텐츠를 기반으로 한 추가 파일 유형 검사가 있습니다: https://github.com/trippo/ResponsiveFilemanager/blob/9a7411f3eab3b7d8e2c78dcf40b4325bde2c548d/filemanager/upload.php#L101
따라서 일반적인 PHP 셸 <?php system($_GET['c']);?>을 업로드할 수 없습니다. 하지만 약간의 트릭을 사용할 수 있습니다: get_extension_from_mime 함수는 파일의 처음 몇 문자를 기준으로 작동합니다. 따라서 페이로드의 시작 부분에 몇 개의 'a' 문자를 추가하면 txt 유형으로 감지될 수 있습니다.
shell.php<.txt로 변경합니다.

