GHSA-xxx9-3xcr-gjj3
Medium · 6.5CVSS
6.5
EPSS
—
Published
Apr 11, 2022
CISA due date
—
Cloudanix analysis
A popular Ruby tool for reading XML and HTML can be tricked by crafted text into treating attacker-controlled content as real document structure, which can distort data and decisions until the tool is updated.
- Exploitation
- Remote Unauthenticated
- Attacker needs
- None
- Complexity
- Moderate
- Impact
- Data Tampering
- Component
- Library
- Class
- Improper Input Validation
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
Insufficient neutralization of untrusted input in Nokogiri’s JRuby path, which relies on the Xerces Java XML parser, allows attacker-controlled text to be interpreted as XML markup rather than character data. Injected elements, attributes, or entity constructs can alter the parsed document tree, change extracted values, and, depending on parser configuration, influence how subsequent application logic consumes the document. Impact is limited to XML/HTML processing on affected Nokogiri releases; it does not by itself yield remote code execution.
Why it matters to the business
Ruby applications that parse untrusted XML or HTML with Nokogiri on JRuby may make decisions on attacker-influenced data, producing integrity failures, incorrect records, authorization bypasses that depend on XML structure, or limited disclosure of document content. Nokogiri is a common RubyGems dependency, so unpatched services, background jobs, and data pipelines remain in scope until upgraded. The issue is medium severity (CVSS 6.5), is not in CISA KEV, has no reported ransomware use, and has no known public exploit maturity. It has been public since April 2022, so remaining exposure is a hygiene and compliance gap rather than a zero-day emergency.
How an attack unfolds
An attacker locates a feature that feeds untrusted markup into Nokogiri on JRuby. They submit input containing XML special characters or structural tokens that are concatenated or parsed without proper escaping or schema constraints. Xerces Java treats those fragments as part of the document, so the resulting node tree includes attacker-chosen structure or values. The application then acts on that tree as if it were legitimate, which can distort stored data, filters, or access checks. No named threat actors or in-the-wild campaigns are associated with this advisory, and no mature public exploit is indicated.
How to fix it
Upgrade the nokogiri RubyGem to 1.13.4 or later on all JRuby and MRI environments that ship the gem; 1.13.4 is the published fix line for this advisory. Pin and deploy via Bundler, rebuild container and CI images, and remove transitive copies older than 1.13.4. Prefer Nokogiri parse options that disable network/entity resolution and reject DTDs for untrusted input, and treat all external markup as untrusted even after the upgrade.
How to confirm the fix worked
Confirm Gemfile.lock, gem specs, and installed gem versions show nokogiri 1.13.4 or newer on every host and image. Run bundle audit or equivalent dependency scanning and re-parse representative untrusted XML/HTML fixtures to verify injected markup is not promoted into the document tree. Inventory JRuby services specifically, since that runtime path uses Xerces Java.
Typical attack path
- Discover an application or job that parses attacker-influenced XML or HTML with an affected Nokogiri release on JRuby.
- Supply markup that breaks out of intended character data because special characters are not escaped or validated.
- Cause the Xerces Java parser to incorporate injected structure into the document tree.
- Abuse the altered parsed values to manipulate business logic, stored records, or XML-based access or filtering controls.
How to detect it
There is no public exploit maturity, KEV listing, or named actor activity, so confirmed historical exploitation is unlikely to leave a distinctive malware trail. Hunt for production runtimes still loading nokogiri older than 1.13.4 on JRuby, XML parse exceptions and schema-validation failures around the time untrusted documents were accepted, and application logs showing unexpected element names or values immediately after inbound XML or HTML processing. Review change and package inventories rather than expecting unique post-exploitation binaries.
What your security team should do
- Patch nokogiri to 1.13.4 or later everywhere it is vendored, including transitive gems and frozen images.
- Prioritize JRuby workloads that parse untrusted XML or HTML, then remaining MRI services for inventory completeness.
- Enforce dependency scanning gates so nokogiri < 1.13.4 cannot ship.
- Harden XML parsing (no external entities, no DTD loading, schema or allow-list validation) as defense in depth.
- Track this as overdue hygiene given multi-year public disclosure and lack of KEV or active exploit reporting.
The record
XML Injection in Xerces Java affects Nokogiri
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| RubyGems | nokogiri | 0 | 1.13.4 |
Related vulnerabilities
- GHSA-vcc3-rw6f-jv97 Duplicate Advisory: Use-after-free in libxml2 via Nokogiri::XML::Reader Also affects nokogiri
- GHSA-pxvg-2qj5-37jq Nokogiri updates packaged libxml2 to v2.10.4 to resolve multiple CVEs Also affects nokogiri
- GHSA-2qc6-mcvw-92cw Update bundled libxml2 to v2.10.3 to resolve multiple CVEs Also affects nokogiri
- GHSA-cgx6-hpwq-fhv5 Integer Overflow or Wraparound in libxml2 affects Nokogiri Also affects nokogiri
- GHSA-gx8x-g87m-h5q6 Denial of Service (DoS) in Nokogiri on JRuby Also affects nokogiri
- GHSA-v6gp-9mmm-c6p5 Out-of-bounds Write in zlib affects Nokogiri Also affects nokogiri
- GHSA-fq42-c5rg-92c2 Vulnerable dependencies in Nokogiri Also affects nokogiri
- GHSA-7rrm-v45f-jp64 Nokogiri updates packaged dependency on libxml2 from 2.9.10 to 2.9.12 Also affects nokogiri