/

CVE-2026-118389

Severity:

HIGH RISK

(8.8)

Improper Neutralization (CWE-74) in RubyGems Registry

CVE-2026-118389

Deferred

Vulnerability type

Category:

Line Injection

CWE:

CWE-74

Impact:

Dependency Manipulation

Severity:

HIGH RISK

(8.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

RubyGems accepted gem metadata containing newline characters, which could let a publisher forge entries in the registry's line-based compact index. Clients resolving gems from an affected registry could be directed to install attacker-chosen dependencies.

Affected context

The issue occurs when a registry accepts newline characters in gem platform names, dependency names, or dependency version requirements and then includes that metadata in its line-based compact index. It becomes risky when someone able to publish gems to an owner's registry can submit metadata that alters how clients interpret index entries.

Exploit preconditions

  • Attack surface: RubyGems registry compact-index generation and consumption
  • Required access: Ability to publish a gem to the affected owner's registry
  • Trigger point: The registry processes and serves gem metadata, and a client resolves gems using the resulting index
  • Why exploitation is possible: Newline characters in metadata can be interpreted as record boundaries, allowing forged index entries and manipulated dependency information

Why this happens

The registry did not reject or safely encode newline characters in fields that were serialized into a line-based index. This allowed metadata to cross record boundaries and be interpreted as additional index content.

This maps to CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component. The underlying insecure pattern is placing untrusted values into a structured downstream format without neutralizing characters that have structural meaning.

Potential impact

  • Clients could be led to resolve nonexistent packages or attacker-chosen versions
  • Dependency metadata could be altered to introduce attacker-selected dependencies
  • Installing affected dependencies may expose users or build environments to malicious package behavior
  • Trust in registry index data and package resolution could be undermined

General mitigation guidance

Defensive patterns include rejecting or safely encoding characters that can alter record boundaries before metadata is serialized. Registries can validate platform and dependency fields against a strict schema and ensure generated index records cannot be extended by user-controlled values.

Reduce trust in published metadata through review and publication controls, and apply least privilege to registry publishing credentials. Clients and build systems can also limit dependency sources to trusted registries and use dependency review or verification controls.

How teams detect issues like this

  • Use static analysis and code review to identify untrusted metadata written into line-based or delimiter-based formats without validation or escaping.
  • Review registry validation rules for platform names, dependency names, and version requirements, including handling of control characters.
  • Test index generation and parsing with boundary and control-character cases, and verify that each input produces only the intended records.
  • Apply publication policies that validate metadata before accepting packages and alert on rejected or unusual metadata.

Sources

SourceLink
blog.gitea.comblog.gitea.com/release-of-28.4.0/
github.comgithub.com/go-gitea/gitea/pull/39782
github.comgithub.com/go-gitea/gitea/pull/39900
github.comgithub.com/go-gitea/gitea/releases/tag/v28.3.0
github.comgithub.com/go-gitea/gitea/security/advisories/GHSA-49c9-hm8q-6rvq

Frequently asked

questions

A person able to publish a gem to an affected owner's registry could submit metadata containing newline characters. The issue affects clients that resolve gems using the registry's compact index.

Yes. The described condition requires the ability to publish a gem to the relevant registry; merely querying the index is not enough to create forged entries.

Reject or safely encode newline characters in metadata fields before they are included in a line-based index, and validate fields against a strict schema.

Treat published metadata as untrusted, enforce format-aware validation at registry boundaries, and test serialization and parsing behavior for structural characters.

Find out what's already
exploitable in your codebase.