mirror of
https://github.com/elicpeter/nyx.git
synced 2026-06-09 19:45:13 +02:00
[pitboss] phase 05: Track J.3 + Track L.3 — XXE corpus + DocumentBuilder / lxml / libxml / SimpleXML adapters
This commit is contained in:
parent
637b733928
commit
4de925c3ef
35 changed files with 1985 additions and 23 deletions
19
tests/dynamic_fixtures/xxe/java/vuln.java
Normal file
19
tests/dynamic_fixtures/xxe/java/vuln.java
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
// Phase 05 (Track J.3) — Java XXE vuln fixture.
|
||||
//
|
||||
// The function feeds attacker bytes to a stock `DocumentBuilderFactory`
|
||||
// without setting `disallow-doctype-decl` / `XMLConstants.FEATURE_
|
||||
// SECURE_PROCESSING`, so any `<!ENTITY xxe SYSTEM "file:///…">`
|
||||
// declaration in the payload is resolved and its body substituted
|
||||
// into the parsed tree.
|
||||
import java.io.ByteArrayInputStream;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import org.w3c.dom.Document;
|
||||
|
||||
public class Vuln {
|
||||
public static Document run(byte[] payload) throws Exception {
|
||||
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilder builder = factory.newDocumentBuilder();
|
||||
return builder.parse(new ByteArrayInputStream(payload));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue