2
我已經得到了下一個發現我的Veracode的報告: XML外部實體( 'XXE')的不當限制(CWE ID 611) 指下一個代碼波紋管Veracode的XML外部實體(XXE)
...
> DocumentBuilderFactory dbf=null; DocumentBuilder db = null; try { dbf=DocumentBuilderFactory.newInstance();
> dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
> dbf.setExpandEntityReferences(false);
> dbf.setXIncludeAware(false); dbf.setValidating(false); db =
> dbf.newDocumentBuilder();
> InputStream stream = new ByteArrayInputStream(datosXml.getBytes());
> Document doc = null; doc= db.parse(stream, "");
...
我一直在研究,但我還沒有發現這一發現或使之消失的一種方式的理由。 你能告訴我該怎麼做嗎?
隨着新的規則,這是行不通的。 Veracode報告它 – Xelian
OWASP現在增加了一個關於如何防止XXE的更廣泛的文檔:https://www.owasp.org/index.php/XML_External_Entity_(XXE)_Prevention_Cheat_Sheet 但我必須承認我不知道veracode我根本不能訪問它。所以我不能根據veracode驗證OWASP建議是否完整。但我不明白爲什麼它不再有效。也許你正在使用不同的XML解析器,需要配置有點不同? – DelGurth
不,我使用以前的修復程序,Veracode停止報告它,但幾天前再次開始。我使用相同的解析器。 – Xelian