<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/ghsa-wgrc-4g2v-9qxv-gemstash-gem-push-reads-the-whole-request-body-into-memory-before-checking-th-kzjlf7um4" -->

---
title: GHSA-wgrc-4g2v-9qxv (gemstash): Gem push reads the whole...
description: Gemstash's gem push endpoint reads the entire request body into memory before verifying the API key. An unauthenticated client can force the server to allocate...
canonical: https://daily.dev/posts/ghsa-wgrc-4g2v-9qxv-gemstash-gem-push-reads-the-whole-request-body-into-memory-before-checking-th-kzjlf7um4
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: GHSA-wgrc-4g2v-9qxv (gemstash): Gem push reads the whole request body into memory before checking the API key | daily.dev
og:description: Gemstash's gem push endpoint reads the entire request body into memory before verifying the API key. An unauthenticated client can force the server to allocate...
og:url: https://daily.dev/posts/ghsa-wgrc-4g2v-9qxv-gemstash-gem-push-reads-the-whole-request-body-into-memory-before-checking-th-kzjlf7um4
og:image: https://api.daily.dev/og/posts/kzjlf7um4.png
og:image:alt: GHSA-wgrc-4g2v-9qxv (gemstash): Gem push reads the whole request body into memory before checking the API key
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# GHSA-wgrc-4g2v-9qxv (gemstash): Gem push reads the whole request body into memory before checking the API key

**[RUBYLAND](https://daily.dev/sources/rubyla)** · 1 min read · 0 upvotes · 0 comments

## Summary

Gemstash's gem push endpoint reads the entire request body into memory before verifying the API key. An unauthenticated client can force the server to allocate memory proportional to the upload size, and only gets rejected with a 401 afterward. The issue is patched in version 2.9.0 and up.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://rubysec.com/advisories/GHSA-wgrc-4g2v-9qxv>

## Questions this post answers

### Why does gemstash allocate memory before checking the API key on gem push?

Gemstash's POST /private/api/v1/gems endpoint reads the entire request body into memory before validating the API key, so an unauthenticated client can force memory allocation proportional to the upload size. The server only returns a 401 after that allocation happens, and there is no limit on body size, enabling a denial-of-service attack. This is fixed in gemstash 2.9.0.

_Teams running private gem servers can track fixes like this gemstash patch on daily.dev._

### How do I fix the gemstash unauthenticated memory exhaustion vulnerability GHSA-wgrc-4g2v-9qxv?

Upgrade gemstash to version 2.9.0 or later, which checks the API key before reading the full request body into memory on gem push. Versions before 2.9.0 allow unauthenticated clients to trigger unbounded memory allocation via large uploads before rejection with a 401.

_Developers patching private gem server vulnerabilities can follow advisories like this one on daily.dev._

## Similar posts on daily.dev

- [GHSA-xg28-cqw2-pggq \(gemstash\): Gemstash caches and serves unvalidated dependency data from an upstream](https://daily.dev/posts/ghsa-xg28-cqw2-pggq-gemstash-gemstash-caches-and-serves-unvalidated-dependency-data-from-an-upstr-jbvwaxfi2) · RUBYLAND · 0 upvotes · 0 comments
- [Gemstash 2.9.0 security release, and the end of Gemstash](https://daily.dev/posts/gemstash-2-9-0-security-release-and-the-end-of-gemstash-67gnyew44) · RUBYLAND · 0 upvotes · 0 comments
- [GemStuffer Campaign Abuses RubyGems as Exfiltration Channel ...](https://daily.dev/posts/gemstuffer-campaign-abuses-rubygems-as-exfiltration-channel--a8nbznkit) · Socket · 1 upvotes · 0 comments
- [GHSA-3553-vcg5-72jw \(dalli\): Unbounded decompression and reply sizes allow memory exhaustion](https://daily.dev/posts/ghsa-3553-vcg5-72jw-dalli-unbounded-decompression-and-reply-sizes-allow-memory-exhaustion-8ykhzq2lz) · RUBYLAND · 0 upvotes · 0 comments

---

Tags: [#cyber](https://daily.dev/tags/cyber), [#ruby](https://daily.dev/tags/ruby)

[View this post on daily.dev](https://daily.dev/posts/ghsa-wgrc-4g2v-9qxv-gemstash-gem-push-reads-the-whole-request-body-into-memory-before-checking-th-kzjlf7um4)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"GHSA-wgrc-4g2v-9qxv (gemstash): Gem push reads the whole request body into memory before checking the API key","url":"https://daily.dev/posts/ghsa-wgrc-4g2v-9qxv-gemstash-gem-push-reads-the-whole-request-body-into-memory-before-checking-th-kzjlf7um4","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/ghsa-wgrc-4g2v-9qxv-gemstash-gem-push-reads-the-whole-request-body-into-memory-before-checking-th-kzjlf7um4"},"datePublished":"2026-11-20T19:24:56.566Z","dateModified":"2026-11-20T19:25:16.949Z","description":"Gemstash's gem push endpoint reads the entire request body into memory before verifying the API key. An unauthenticated client can force the server to allocate...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/5fa7bf38a8a9c178c1d458f9f735556c?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/5fa7bf38a8a9c178c1d458f9f735556c?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"RUBYLAND","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"RUBYLAND","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/rubyla","url":"https://daily.dev/sources/rubyla"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/ghsa-wgrc-4g2v-9qxv-gemstash-gem-push-reads-the-whole-request-body-into-memory-before-checking-th-kzjlf7um4","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"cyber,ruby","timeRequired":"PT1M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"RUBYLAND","item":"https://daily.dev/sources/rubyla"},{"@type":"ListItem","position":3,"name":"GHSA-wgrc-4g2v-9qxv (gemstash): Gem push reads the whole request body into memory before checking the API key"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/ghsa-wgrc-4g2v-9qxv-gemstash-gem-push-reads-the-whole-request-body-into-memory-before-checking-th-kzjlf7um4#faq","mainEntity":[{"@type":"Question","name":"Why does gemstash allocate memory before checking the API key on gem push?","acceptedAnswer":{"@type":"Answer","text":"Gemstash's POST /private/api/v1/gems endpoint reads the entire request body into memory before validating the API key, so an unauthenticated client can force memory allocation proportional to the upload size. The server only returns a 401 after that allocation happens, and there is no limit on body size, enabling a denial-of-service attack. This is fixed in gemstash 2.9.0. Teams running private gem servers can track fixes like this gemstash patch on daily.dev."}},{"@type":"Question","name":"How do I fix the gemstash unauthenticated memory exhaustion vulnerability GHSA-wgrc-4g2v-9qxv?","acceptedAnswer":{"@type":"Answer","text":"Upgrade gemstash to version 2.9.0 or later, which checks the API key before reading the full request body into memory on gem push. Versions before 2.9.0 allow unauthenticated clients to trigger unbounded memory allocation via large uploads before rejection with a 401. Developers patching private gem server vulnerabilities can follow advisories like this one on daily.dev."}}]}
```

