new capacity bits (#67)

This commit is contained in:
Eli Peter 2026-05-07 01:29:31 -04:00 committed by GitHub
parent afaffc0df6
commit 7d0e7320e2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
261 changed files with 10591 additions and 231 deletions

View 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));
}
}