欧美精品免费观看二区/在线观看av/粉嫩国产精品14xxxxx/亚洲精品视频在线观看免费

網站漏洞之“敏感目錄” 與 “敏感文件” 處理
發布時間:2023-10-07

    敏感目錄
    在訪問host/download/請求時,返回403 Forbidden:

    Forbidden
    You don't have permission to access /download/ on this server.
    Additionally a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.


    檢查了一下documentroot下的download目錄,發現原來是用來存放一些供用戶下載的軟件之類的東西,直接訪問的話就會返回403的錯誤。

    怎么解決呢?那就寫個.c把這類請求rewrite一下吧。


            RewriteEngine On
            RewriteCond %{REQUEST_FILENAME} -d
            RewriteRule ^(.*)$ ../../index.php [QSAR]



    好的,現在如果再有請求訪問documentroot下的不給訪問的目錄的話,就會直接把請求轉到官網主頁上了。

    敏感文件
    訪問host/server-status,竟然可!以!看!到!Apache的運行信息!

    Apache竟然還有這么個功能,真是亮瞎了老夫的鈦合金眼鏡!

    這個好處理一些,直接把這個功能給它關閉掉。
    由于Apache都是用模塊的方式,那找到Apache的配置文件,將mods-status相關的配置給清理掉:

    rm -f /etc/apache2/mods-enabled/status.conf 
    rm -f /etc/apache2/mods-enabled/status.load
    
    /etc/init.d/apache2 restart


    清理完成之后不要忘記重啟Apache使修改生效。