Struts2 Actions 應利用 Struts Validation 框架防止未經檢驗的輸入產生漏洞。
在 J2EE 應用程序中,未經檢驗的輸入是導致漏洞發生的首要原因。未經檢驗的輸入數據會導致許多漏洞,如 cross-site scripting、process control 和 SQL injection。雖然 J2EE 應用程序通常情況下不容易受到內存損壞的影響,但是如果 J2EE 應用程序連接到未執行數組邊界檢查的本地代碼,攻擊者就可能會利用 J2EE 應用程序中一個輸入校驗錯誤發起 buffer overflow 攻擊。
為了避免此類攻擊,我們應在應用程序處理輸入之前,使用 Struts Validation 框架來檢驗所有的程序輸入。使用 HP Fortify Static Code Analyzer(HP Fortify 靜態代碼分析器)來確保您的 Struts Validator 配置中不存在任何漏洞。
驗證器在例子中的用法包括檢查并確保以下內容:
- 在電話號碼字段中只包含有效字符
- 布爾值僅為 "T" 或者 "F"
- 未限定格式的字符串必須具有合理的長度,并且由有效的字符組成
[1] Standards Mapping - OWASP Top 10 2004 - (OWASP 2004) A1 Unvalidated Input
[2] Standards Mapping - OWASP Top 10 2010 - (OWASP 2010) A6 Security Misconfiguration
[3] Standards Mapping - Security Technical Implementation Guide Version 3 - (STIG 3) APP3510 CAT I
[4] Standards Mapping - Security Technical Implementation Guide Version 3.4 - (STIG 3.4) APP3510 CAT I
[5] Standards Mapping - Common Weakness Enumeration - (CWE) CWE ID 101
[6] Standards Mapping - Payment Card Industry Data Security Standard Version 1.2 - (PCI 1.2) Requirement 6.3.1.1
[7] Standards Mapping - Payment Card Industry Data Security Standard Version 1.1 - (PCI 1.1) Requirement 6.5.1
[8] Standards Mapping - FIPS200 - (FISMA) SI
[9] T. Husted et al. Struts in Action:Building Web Applications with the Leading Java Framework Manning Publications
[10] The Struts Project The Apache Foundation