項目上要進行IBM的App scan安全漏洞掃描,要有Web應用程序報告,網上找了很多內容,集中項目中,常出現的有如下幾類php
- 發現壓縮目錄
直接在nginx上,添加配置
location ~* \.(php|zip|arj|lzma|wim|war|ear|ar)$ {
deny all;
}
限制不能傳後綴爲這些的 - Oracle Application Server PL/SQL 未受權的 SQL 查詢執行 查詢執行
若是肯定沒用oracle,那應該是controller的問題,用了PathVariable,而後參數是數字型,掃描傳了字符串,能夠改成字符串,而後判斷是否數字,
還有其它修改方式,主要是傳了有SQL腳本的字符串,但全局性異常抓取了,但軟件要求不能返回狀態爲200 - 跨站點請求僞造
解決這個有兩種方式
一種是在網關上,判斷referer裏面的ip,要在信任的ip範圍內,不在裏面,返回錯誤報文
一種是在nginx上,添加referer白名單valid_referers none blocked 127.0.0.1 192.168.0.1;前端
if ($invalid_referer) {
return 403;
}nginx - Apache Struts2 REST 插件 XStream 遠程代碼執行
在肯定沒用struts2的前提下,看有沒如下依賴,若是有,刪除依賴包<dependency> <groupId>com.thoughtworks.xstream</groupId> <artifactId>xstream</artifactId> <version>1.4.10</version> </dependency>
- 「Content-Security-Policy」頭缺失或不安全
在nginx添加配置
add_header Content-Security-Policy "default-src 'self'; script-src 'self'; connect-src 'self'; img-src 'self'; style-src 'self'; frame-ancestors 'self'; ";
default-src 'self'; script-src 'self'; connect-src 'self'; 這三個爲必須項,但有時會影響前端js,因此,要根據策略進行修改 - 「X-Content-Type-Options」頭缺失或不安全 頭缺失或不安全
在nginx添加配置
add_header X-Content-Type-Options nosniff; - 「X-XSS-Protection」頭缺失或不安全 頭缺失或不安全 在nginx添加配置 add_header X-XSS-Protection "1; mode=block";