Apache HTTPd 2.4.49 路径穿越与命令执行漏洞(CVE-2021-41773)
https://help.aliyun.com/noticelist/articleid/1060919610.html
在路径穿越目录允许被访问的的情况下,攻击者可利用该路径穿越漏洞读取到Web目录之外的其他文件。同时若Apache HTTPd开启了cgi支持,攻击者可构造恶意请求执行命令,控制服务器。
https://httpd.apache.org/security/vulnerabilities_24.html
Acknowledgements: This issue was reported by Ash Daulton along with the cPanel Security Team.
POC如下:
https://github.com/Sakura-nee/CVE-2021-41773
https://github.com/habibiefaried/CVE-2021-41773-PoC
https://github.com/inbug-team/CVE-2021-41773_CVE-2021-42013
127.0.0.1/cgi-bin/.%2e/%2e%2e/%2e%2e/%2e%2e/etc/passwd
阻断方案 :同时满足1和2
1-路径含有:(除去“含有”,还有URL前缀,URL绝对路径)
/cgi-bin/
2-路径含有:(/etc目录下文件很多,任意文件读取不仅限于/etc目录,/etc/passwd只是用于测试)
如下的路径可以制作一个字典集合。
/etc/passwd,/etc/profile,/etc/hosts,/etc/issue,/etc/shells,/etc/shadow,/etc/group
../,%2E%2E/,.%2E/,%2E./
..%2F,2E%2E%2F,.%2E%2F,%2E.%2F
..\,%2E%2E\,.%2E\,%2E.\
..%5C,%2E%2E%5C,.%2E%5C,%2E.%5C
不排除攻击者采取特殊字符等进行绕过测试,目前的措施可以拦截绝大部分的攻击行为,添加/cgi-bin/这个条件是为了保证拦截的高度准确性。
直接拦截条件2的路径也没问题,很难出现误拦。