GITEA.DEV · CVE-2026-118389 · Package
FIX → 28.3.0
Gitea's RubyGems registry accepts gem platform and dependency fields containing newline characters, which forge extra entries in the line-based compact index served to Bundler. An attacker can make Bundler resolve a poisoned version of a real gem that pulls in a malicious dependency, running attacker code on developer machines.
first public Nov 15, 2026 · 2 sources
Check it with your coding agent
It reads this page and tells you if your code or app is affected.
Any Gitea instance that serves as a RubyGems registry is exposed, because attacker-supplied gem metadata reaches the index that Bundler reads. Teams that do not run Gitea's package registry for RubyGems, or that use only rubygems.org, are not affected.
Not affected if managed-hosting, no-rubygems-registry
Who cares bundler, gitea, rubygems, self-hosted
gitea --version and confirm whether it is 28.2.0 or earlier.Upgrade to 28.3.0
28.3.0, which adds newline validation to the RubyGems metadata fields.The Gitea package registry accepts RubyGems packages whose dependency names, version requirements, and platform fields contain newline characters (\n). Because the RubyGems compact index format is line-based, an injected newline forges arbitrary entries in two critical index endpoints:
/versions — the global package listing. Platform injection forges entries for packages that don't exist, making bundler clients believe a fake package is hosted on this registry.info/<name> — the per-package dependency index. Dependency name injection forges fake version entries with attacker-controlled dependencies under a real package.This is a supply chain attack: any developer using this Gitea instance as a RubyGems source gets poisoned resolution data, and bundler will install attacker-controlled gems as transitive dependencies.
modules/packages/rubygems/metadata.go — the parseMetadataFile function validates the gem name (\A[\w.-]+\z) and version, but does not validate the Platform, dependency , or fields for newline characters.
Are you affected?
Ask from here. InfraStack checks the affected versions against your stack and answers in your inbox.
InfraStack checks the affected versions against your stack and answers in Slack, with the evidence and the fix.
InfraStack checks it against your stack and answers on your report, with the evidence and the fix.
NameVersionRequirementThose fields flow directly into the compact index output via makePackageVersionDependency and writePackageVersionForList in routers/api/packages/rubygems/rubygems.go, which use fmt.Fprintf with no sanitization.
trojaned-lib in /versionstrojaned-lib with malicious post-install hook99.99.99 under innocent-gem with dependency trojaned-libgem "innocent-gem" to Gemfileinnocent-gem 99.99.99 → installs trojaned-lib → attacker code executesSupply chain integrity compromise: Any Gitea instance serving as a RubyGems registry is vulnerable to index poisoning. The attack forges phantom packages, forges version entries with attacker-controlled dependencies, and executes attacker code on developer machines via gem install hooks. The attack is invisible to the victim — the Gemfile references a real package; the malicious dependency is injected at the index level.
Trust model violation: Organizations using Gitea's package registry trust that the index accurately reflects uploaded packages. Index-level injection bypasses all package-level integrity checks because forged entries are added before bundler ever downloads a gem file.
Gitea <= 28.2.0 (confirmed). The fix is in commit c52e7c0c which adds newline validation to metadata fields.
Validate that Platform, dependency Name, and VersionRequirement fields do not contain \r or \n characters in modules/packages/rubygems/metadata.go before storing the metadata. Return an error if they do. (This is what commit c52e7c0c implements.)
NVD data is provided by NIST and is public domain. Posts quoted belong to their authors.