# 資安稽核找出 tomcat 的問題 ### 網站伺服器Tomcat相關目錄存在目錄瀏覽問題,使原本在Reverse Proxy架構下無法存取之Tomcat網頁可直接存取 解法: 修改 /opt/tomcat/conf/web.xml 將以下xml 註解起來,讓說明文件無法讀取就好 ``` <!-- <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> </welcome-file-list> --> ``` ### 有 Error 時,版本號會被看到 先到 /opt/tomcat/lib ,建立 org/apache/catalina/util 資料夾,然後建立一個文件 ServerInfo.properties 流程為 ``` cd /opt/tomcat/lib sudo -u tomcat mkdir -p org/apache/catalina/util cd org/apache/catalina/util sudo -u tomcat vi ServerInfo.properties ``` 輸入 ``` server.info=Apache Tomcat Version X ``` 儲存後, ``` sudo systemctl restart tomcat ``` 然後就可以看到版本變成 Apache Tomcat Version X ### 防範 xss jstl 中,最簡易的防範 xss 就是 ``` ${fn:escapeXml(變數)} ``` 這個比 xss filter 還有效