<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/command-injection-in-the-spatial-features-ruby-gem-umejnap4o" -->

---
title: Command injection in the spatial_features Ruby gem
description: A security researcher discovered a command injection vulnerability in the spatial_features Ruby gem, triggered by an unsanitized ZIP entry filename that...
canonical: https://daily.dev/posts/command-injection-in-the-spatial-features-ruby-gem-umejnap4o
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Command injection in the spatial_features Ruby gem | daily.dev
og:description: A security researcher discovered a command injection vulnerability in the spatial_features Ruby gem, triggered by an unsanitized ZIP entry filename that...
og:url: https://daily.dev/posts/command-injection-in-the-spatial-features-ruby-gem-umejnap4o
og:image: https://api.daily.dev/og/posts/umeJnAP4o.png
og:image:alt: Command injection in the spatial_features Ruby gem
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.

# Command injection in the spatial_features Ruby gem

**[Ruby Flow](https://daily.dev/sources/rubyflow)** · 4 min read · 0 upvotes · 0 comments

## Summary

A security researcher discovered a command injection vulnerability in the spatial_features Ruby gem, triggered by an unsanitized ZIP entry filename that reached shell commands (system and backticks) before shapefile validation occurred. A crafted filename could execute arbitrary commands, and a related SQL injection via the .prj file's projection data was also found by the maintainer. The bug existed since 2016 through version 3.11.1, scoring 8.8 CVSS. Version 3.11.2, released August 16, 2026, fixes it by using array-form system calls (avoiding shell interpretation), Open3.capture2, SQL parameter quoting, and ZIP path validation. Users of the gem should upgrade immediately.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://base16.fr/en/blog/command-injection-spatial-features>

## Questions this post answers

### What versions of the spatial_features Ruby gem are affected by the command injection vulnerability?

All versions through 3.11.1 are vulnerable; version 3.11.2, released August 16, 2026, contains the fix. The flaw stems from an unsanitized ZIP entry filename being interpolated directly into shell commands via system and backticks, allowing a crafted filename like x";touch /tmp/sf_pwned;".shp to execute arbitrary commands before the shapefile was even validated. It carries a CVSS score of 8.8.

_Track gem CVEs and patched versions like this one on daily.dev before they hit your dependency tree._

### How do I fix a Ruby command injection caused by building a system() call from an interpolated string?

Replace the single interpolated command string with separate arguments passed to system(), such as system('ogr2ogr', '-s_srs', proj4, '-t_srs', 'EPSG:4326', output_path, file_path). This avoids invoking a shell entirely, so quotes and semicolons in user-controlled input like a filename are treated as literal data rather than shell syntax. Backtick calls should be replaced with Open3.capture2 and SQL values escaped with connection.quote.

_Developers hardening shell-out code in Ruby can compare fixes like this on daily.dev._

### Why is CVE severity for a gem sometimes described as depending on the host application rather than the library itself?

Because a library like spatial_features does not control who can upload a file to trigger its vulnerable code path, the actual severity depends on the application embedding it. If uploads require authentication, an attacker can run commands with the application process's privileges; if uploads are public and unauthenticated, the same bug becomes unauthenticated remote code execution, which is why the CVSS score of 8.8 assumes authenticated upload as the baseline.

_Assessing real-world impact of a dependency's CVE score is easier with context daily.dev surfaces around it._

## Similar posts on daily.dev

- [CSV Formula Injection in Customer Export](https://daily.dev/posts/csv-formula-injection-in-customer-export-6wcrlgmld) · RUBYLAND · 1 upvotes · 0 comments
- [Ruby & Rails Weekly: KindaRails2Shell Exploited, Ractor Rails](https://daily.dev/posts/ruby-rails-weekly-kindarails2shell-exploited-ractor-rails-70dte5arg) · Ruby Flow · 3 upvotes · 0 comments
- [Attackers target zero-day vulnerability in geospatial data platform GeoServer](https://daily.dev/posts/attackers-target-zero-day-vulnerability-in-geospatial-data-platform-geoserver-8wtfvoytx) · CSO Online · 0 upvotes · 0 comments

---

Tags: [#security](https://daily.dev/tags/security), [#sql](https://daily.dev/tags/sql), [#ruby](https://daily.dev/tags/ruby), [#appsec](https://daily.dev/tags/appsec)

[View this post on daily.dev](https://daily.dev/posts/command-injection-in-the-spatial-features-ruby-gem-umejnap4o)

```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":"Command injection in the spatial_features Ruby gem","url":"https://daily.dev/posts/command-injection-in-the-spatial-features-ruby-gem-umejnap4o","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/command-injection-in-the-spatial-features-ruby-gem-umejnap4o"},"datePublished":"2026-08-26T22:50:57.038Z","dateModified":"2026-08-26T23:18:59.926Z","description":"A security researcher discovered a command injection vulnerability in the spatial_features Ruby gem, triggered by an unsanitized ZIP entry filename that...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/529e8ae68cca0bddb6567111e5a487ae?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/529e8ae68cca0bddb6567111e5a487ae?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Ruby Flow","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":"Ruby Flow","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/a21aaa8bcbbf448193a016895c90a0e1","url":"https://daily.dev/sources/rubyflow"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/command-injection-in-the-spatial-features-ruby-gem-umejnap4o","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"security,sql,ruby,appsec","timeRequired":"PT4M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Ruby Flow","item":"https://daily.dev/sources/rubyflow"},{"@type":"ListItem","position":3,"name":"Command injection in the spatial_features Ruby gem"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/command-injection-in-the-spatial-features-ruby-gem-umejnap4o#faq","mainEntity":[{"@type":"Question","name":"What versions of the spatial_features Ruby gem are affected by the command injection vulnerability?","acceptedAnswer":{"@type":"Answer","text":"All versions through 3.11.1 are vulnerable; version 3.11.2, released August 16, 2026, contains the fix. The flaw stems from an unsanitized ZIP entry filename being interpolated directly into shell commands via system and backticks, allowing a crafted filename like x\";touch /tmp/sf_pwned;\".shp to execute arbitrary commands before the shapefile was even validated. It carries a CVSS score of 8.8. Track gem CVEs and patched versions like this one on daily.dev before they hit your dependency tree."}},{"@type":"Question","name":"How do I fix a Ruby command injection caused by building a system() call from an interpolated string?","acceptedAnswer":{"@type":"Answer","text":"Replace the single interpolated command string with separate arguments passed to system(), such as system('ogr2ogr', '-s_srs', proj4, '-t_srs', 'EPSG:4326', output_path, file_path). This avoids invoking a shell entirely, so quotes and semicolons in user-controlled input like a filename are treated as literal data rather than shell syntax. Backtick calls should be replaced with Open3.capture2 and SQL values escaped with connection.quote. Developers hardening shell-out code in Ruby can compare fixes like this on daily.dev."}},{"@type":"Question","name":"Why is CVE severity for a gem sometimes described as depending on the host application rather than the library itself?","acceptedAnswer":{"@type":"Answer","text":"Because a library like spatial_features does not control who can upload a file to trigger its vulnerable code path, the actual severity depends on the application embedding it. If uploads require authentication, an attacker can run commands with the application process's privileges; if uploads are public and unauthenticated, the same bug becomes unauthenticated remote code execution, which is why the CVSS score of 8.8 assumes authenticated upload as the baseline. Assessing real-world impact of a dependency's CVE score is easier with context daily.dev surfaces around it."}}]}
```

