mirror of
https://github.com/elicpeter/nyx.git
synced 2026-06-09 19:45:13 +02:00
Dynamic (#77)
This commit is contained in:
parent
55247b7fcd
commit
991c84a1eb
1464 changed files with 225448 additions and 1985 deletions
18
tests/dynamic_fixtures/xxe/java/Benign.java
Normal file
18
tests/dynamic_fixtures/xxe/java/Benign.java
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
// Phase 05 (Track J.3) — Java XXE benign fixture.
|
||||
//
|
||||
// Same parser surface as `vuln.java` but the factory is hardened with
|
||||
// `disallow-doctype-decl`, so the same payload's `<!ENTITY>` block is
|
||||
// rejected at parse time and no entity body is substituted.
|
||||
import java.io.ByteArrayInputStream;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import org.w3c.dom.Document;
|
||||
|
||||
public class Benign {
|
||||
public static Document run(byte[] payload) throws Exception {
|
||||
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
|
||||
DocumentBuilder builder = factory.newDocumentBuilder();
|
||||
return builder.parse(new ByteArrayInputStream(payload));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue