mirror of
https://github.com/elicpeter/nyx.git
synced 2026-06-09 19:45:13 +02:00
new capacity bits (#67)
This commit is contained in:
parent
afaffc0df6
commit
7d0e7320e2
261 changed files with 10591 additions and 231 deletions
23
tests/fixtures/xxe/java/UnsafeLog4jConfig.java
vendored
Normal file
23
tests/fixtures/xxe/java/UnsafeLog4jConfig.java
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
// Unsafe: Log4Shell-shape XXE leg. The DOMConfigurator-style loader
|
||||
// reads an XML config file path supplied by the user, then parses it
|
||||
// through DocumentBuilder without enabling FEATURE_SECURE_PROCESSING or
|
||||
// disallowing DOCTYPE declarations. External entities resolve, giving
|
||||
// the attacker a file-disclosure / SSRF primitive on the host. Real-
|
||||
// world precedent: CVE-2022-23305 / CVE-2022-23307 (Log4j 1.x JDBC /
|
||||
// chainsaw config XXE). Exercises the TypeFacts-tagged builder receiver
|
||||
// + xml_config sidecar end-to-end: builder is XmlParser-typed, no
|
||||
// secure-processing fact recorded, parse fires the XXE sink.
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import org.w3c.dom.Document;
|
||||
import java.io.File;
|
||||
|
||||
public class UnsafeLog4jConfig {
|
||||
public Document loadConfig(HttpServletRequest req) throws Exception {
|
||||
String configPath = req.getParameter("config");
|
||||
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilder builder = factory.newDocumentBuilder();
|
||||
return builder.parse(new File(configPath));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue