rails GitHub avatar

rails-forensics-CVE-2026-66066

rails

A forensics toolkit and method for Rails/Active Storage apps to determine exposure to and exploitation of CVE-2026-66066 (KindaRails2Shell), using skills, reference docs, and a scanner.

Stars

6

7-day growth

No data

Forks

0

Open issues

0

License

MIT

Last updated

2026-07-30

AI repository intelligence
FR-AI / ANALYSIS

Why it is worth attention

It addresses the hard post-advisory forensics question the advisory does not answer, with an ordered investigation process, a detector that can classify crafted files via ranged reads, and provenance from a real 37signals investigation.

Who it is for

  • Rails teams using Active Storage with the vips variant processor
  • Security engineers and incident responders needing to assess possible exploitation
  • Developers who want to understand the attack chain and investigation method
  • Operators using AI coding agents such as Claude Code to run structured skills

Use cases

  • Run kr2s-was-i-vulnerable to establish the exposure window after patching
  • Run kr2s-was-i-exploited to produce a written forensic analysis when exploitation is suspected
  • Scan the Active Storage blob store for crafted MAT files with bin/kr2s_scan_active_storage_blobs.rb
  • Read reference/the-attack.md and reference/the-investigation.md to understand the vulnerability and why artifacts remain

Strengths

  • Attack chain and investigation are documented call by call with the load-bearing junctions marked
  • Detector needs only the first 128 bytes via a ranged read, so candidates can be classified without downloading whole objects
  • The production scanner is committed as a single self-contained file requiring no build step
  • Tooling came from a real 37signals investigation and correctly identified the security researchers' test files

Considerations

  • Only covers Active Storage with the :vips variant processor and tracked variant records; other libvips upload paths need separate sweeps
  • A clean scan result is strong evidence, not proof, and the analysis template has a mandatory limits section
  • Skills depend on repository-relative shared references, so copying a skill directory alone breaks them; investigation is time-sensitive because logs expire and unattached blobs are purged

README quick start

rails-forensics-CVE-2026-66066

Tooling and method for answering two questions about a Rails application and CVE-2026-66066, the Active Storage and libvips arbitrary file read known as KindaRails2Shell:

  1. Was I vulnerable, and for how long?
  2. Was I exploited, and if so, what left the building?

The advisory explains the vulnerability and names the patched versions. It does not tell you how to find out whether anyone used it against you. That question decides whether secret_key_base and everything it signs have to be rotated, and it is harder than it looks. The evidence is spread across your object store and three Active Storage tables, application logs expire long before the exposure window does, and a scheduled purge of unattached blobs destroys precisely the records the answer depends on.

If you are going to ask, ask soon. Every one of those is a clock that is already running.

This is a documentation and skill repository rather than a library. Nothing here is installed into your application. An agent reads it and works against your application checked out somewhere else, and the one script that runs in production is a single self-contained file you copy into a container.

The vulnerability in one paragraph

Rails decides a blob may be image-processed by reading a content_type column that a direct upload lets the client set without the bytes ever being examined. libvips then decides what the file actually is by sniffing magic bytes. A file whose first ten bytes claim MATLAB 5.0 is routed to libvips' MATLAB loader, which hands it to libmatio, which dispatches on a different byte range and finds MAT 7.3, which is HDF5. HDF5's External File List lets a dataset's bytes live in another file named by path and offset, so rendering the "image" reads an attacker-chosen file off the server and returns its contents as pixels. The same confusion, twice, at two layers that cannot see each other's fields.

reference/the-attack.md traces the whole call chain, from the inbound request to the point where libmatio opens the target file, with the four load-bearing junctions marked. reference/the-investigation.md then explains why the attack is investigable at all: it leaves three artifacts of increasing strength, and the strongest of them is the rendered variant, which holds the stolen bytes as pixel values in your own object store.

Start

Related repositories

Similar projects matched by category, topics, and programming language.

deerwork-ai
Featured
deerwork-ai GitHub avatar

deer-workflow

An open-source Dynamic Workflow runtime that combines deterministic TypeScript orchestration with replaceable Agent runtimes.

AI & Machine LearningLarge Language Models
312
gavamedia
Featured
gavamedia GitHub avatar

deltafin

Deltafin is a research project that runs the 2.8-trillion-parameter Mixture-of-Experts model Kimi K3 on a single Apple Silicon Mac (e.g., M1 Max with 64 GB) at about 16 seconds per token, using exact, reproducible inference with local or streaming expert loading.

AI & Machine LearningLarge Language Models
304
7-e1even
Featured
7-e1even GitHub avatar

learn-agent

A collection of notes on building coding agents, derived from the production development of the desktop agent Reina, with each mechanism simplified into a zero-dependency, single-file Node.js demo.

AI & Machine LearningLarge Language Models
218