← Back to Pull requests

Fix SQLi + XXE CVEs (CVE-2026-82583, -78224, -82578) with regression tests #441

Closed
unknown closed this pull request without merging on Sep 23, 2026 15:05 UTC
View on GitHub
unknown unknown commented on Sep 14, 2026 15:27 UTC
Author

Summary

Fixes three publicly-disclosed vulnerabilities (advisory) present in this tree (4.6.0 is below every upstream fix version). Each fix uses an idiom already established in this codebase; the branch is one commit per CVE (fix + its tests together).

| CVE | Component | Fix |
| --- | --- | --- |
| CVE-2026-82583 (SQLi, CWE-89) | DatabaseConnectorServlet | Ignore caller selectLimit; resolve the probe template server-side from the built-in driver list; escape identifiers |
| CVE-2026-78224 (XSLT XXE, CWE-611) | XsltStep | Deny external DTDs in the source XML; restrict stylesheet references to the file protocol (fail-closed) |
| CVE-2026-82578 (XML batch XXE, CWE-611) | XMLBatchAdaptor | Parse with a hardened, namespace-aware DocumentBuilderFactory, then evaluate XPath |

The fixes

CVE-2026-82583 — SQL injection


DatabaseConnectorServlet.getTables executed the caller-supplied selectLimit query parameter as SQL via Statement.executeQuery. selectLimit is only ever a driver-specific metadata-probe template (the metadata dialog sends the driver's own value), so it is now ignored and resolved server-side from the built-in DriverInfo list keyed by the JDBC driver class; anything unrecognised uses the safe DatabaseMetaData.getColumns() path.

Resolving only from DriverInfo.getDefaultDrivers() — never the API-writable configured driver list — closes the injection regardless of the deployment's authorization model. resolveSelectLimit is static and unit-tested with no database or live server.

The probe query also embeds the schema/table identifier. Those names come from database metadata but may themselves contain a ", which would break out of the quoting (a second-order injection); quoteSchemaTable now doubles any embedded quote per the SQL standard. The generic getColumns() paths are scoped to the connecting user's discovered schema so a same-named table in another schema cannot leak its columns.

Deliberately out of scope (follow-ups): the endpoint's @MirthOperation has no permission and auditable = false, and driver/url are unconstrained. The same gap exists on every other connector test servlet (file/tcp/http/smtp/ws/jms) and is better handled as its own change.

CVE-2026-78224 — XSLT step XXE


XsltStep builds a TransformerFactory inside generated JavaScript, so it was never reached by the Java-side XML hardening elsewhere in the tree. The source XML is attacker-controlled, so the generated script sets ACCESS_EXTERNAL_DTD="" on both the normal and iterator paths — denying external DTDs/entities in it, which is what closes the CVE. The stylesheet is channel-author content, so following the OWASP XXE cheat sheet ("restrict rather than close" external references in your own stylesheets), ACCESS_EXTERNAL_STYLESHEET is restricted to the file protocol rather than blocked: local xsl:import/xsl:include/document() keep working while http(s) SSRF is denied. Neither is swallowed: a factory that rejects the attribute fails the transform rather than running with external access silently open.

FEATURE_SECURE_PROCESSING is deliberately not enabled: on the JDK's built-in Xalan it also disables Java XSLT extension functions, which would break existing stylesheets that call Java.

_Note: the stylesheet is loaded from a StringReader with no base URI, so relative hrefs may not resolve regardless; the file filter mainly governs absolute file:///… references._

CVE-2026-82578 — XML batch adaptor XXE


XMLBatchAdaptor evaluated XPath directly over an InputSource, letting the XPath engine build its own DOCTYPE-resolving parser. It now parses with DocumentSerializer.getSecureDocumentBuilderFactory() (disallow-doctype-decl, external entities/DTD off, no entity expansion) and evaluates against the parsed Document. namespaceAware is set true to preserve the prior path's namespace-aware parsing (namespace-uri()/prefix-sensitive split queries). The hardened parse is factored into a static parseBatchSecurely helper.

Tests

  • DatabaseConnectorServletTest (server unit test) — resolveSelectLimit returns the built-in template per driver and "" for unknown/injected drivers (proof the caller value never reaches executeQuery); quoteSchemaTable doubles embedded quotes (second-order-injection payload stays a single quoted identifier).

  • XsltStepSecurityTest (server unit test) — the generated script denies external DTD access ('') and restricts stylesheet access to 'file' on both paths, does not emit FEATURE_SECURE_PROCESSING, and is not wrapped in a swallowing catch.

  • ci/tests/200-xslt-step-xxe (fixture) — an external-entity message → ERROR; a well-formed control → TRANSFORMED.

  • XMLBatchAdaptorSecurityTest (server unit test) — external- and internal-entity DOCTYPEs are rejected with a specific DOCTYPE oracle (not catch-all); a benign namespaced batch still parses and a namespace-uri() predicate matches.

  • XmlBatchXxeTest (smoketest) — deploys a batch-splitting channel and pairs the malicious batch with a benign control that must split, so the "marker not expanded" assertion cannot pass on an unrelated failure.
  • Behavior changes

  • XML batch: disallow-doctype-decl rejects all DOCTYPEs — batches with an internal-subset DTD that previously parsed now error.

  • JDBC metadata: unknown/custom drivers use the generic getColumns() path (correct, possibly slower), now scoped to the connecting user's schema when one is discovered; identifiers are escaped.

  • XSLT: external DTD access (source XML) is denied and the step fails closed if a factory rejects the restriction. External stylesheet references are restricted to the file protocol (OWASP "restrict rather than close"), so local xsl:import/xsl:include/document() still work but http(s) stylesheet fetches are denied. FEATURE_SECURE_PROCESSING is intentionally not enabled, so Java XSLT extension functions keep working.
  • Verification

  • ./gradlew :server:test — DatabaseConnectorServletTest, XsltStepSecurityTest, XMLBatchAdaptorSecurityTest pass; existing datatypes.xml, DocumentSerializer, and jdbc tests still pass.

  • ci/runtests.sh alpine-temurin21-derby — the XSLT fixture (malicious ERROR / benign TRANSFORMED) and the hardened XmlBatchXxeTest run in every configuration; no oie.db.* or --add-opens needed.
  • 🤖 Generated with Claude Code

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: pacmano1 Review duration: 12937m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #441"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 20.5% · Safe to merge
    20.5%