Unauthenticated RCE in Writebook, from a public thumbnail (GHSA-x698-jp54-59c5)
On November 20 I reported an unauthenticated remote code execution on three production Writebook servers. Today 37signals published GHSA-x698-jp54-59c5. Releases through 1.2.2 are affected. 1.2.3 is the fix. The advisory scores it 9.8.
Two of them were on revision 01367202, committed October 29, 2024. The third was on 90c1cd1f, from June 27, 2024. Those trees pin image_processing 1.13.0 and 1.12.2, on Rails 8.0.0.beta1 and 8.0.0.alpha, and they generate variants with libvips. A visitor with no account could run commands as uid=1000(rails) on all three.
CVE-2026-66066, published July 29, is this file read in Rails. Writebook 1.2.1, released July 28, turns off the libvips loaders that are unsafe for untrusted files. In November these three servers were still on the 2024 revisions.
The upload
Writebook's controllers call require_authentication. Direct uploads are mounted on ActiveStorage::DirectUploadsController and ActiveStorage::DiskController, which inherit from ActiveStorage::BaseController and skip that filter. GET / sets a session cookie and a CSRF token. POST /rails/active_storage/direct_uploads then returns a signed blob id, and the PUT of the file returns 204.
The thumbnail
libvips picks a loader from the file's magic bytes. I sent the upload as image/png. The bytes were a MATLAB 7.3 file, which is HDF5 with a MATLAB header in front of it. HDF5 can store a dataset's bytes in another file, named by path. I pointed that path at /proc/1/environ.
Both revisions define the large picture variant as resize_to_limit: [1500, 1500]. Public picture pages include the signed key for that variant. The key signs the transformation, and the blob id is signed on its own, so a key from any picture works on a blob uploaded a moment earlier. Requesting the representation drew /proc/1/environ into the thumbnail. SECRET_KEY_BASE was in those bytes.
The variation
With that key I signed a new variation. On the Rails commit these hosts were running, transformation names are checked only when the processor is MiniMagick:
if ActiveStorage.variant_processor == :mini_magick
validate_transformation(name, argument)
end
Vips skips that check. image_processing sends the method name with public_send while it is still building the pipeline. instance_eval is a public method, so the string runs on that object. The string I passed returned a lambda. apply returned the lambda, and the .call that writes the variant ran it. The lambda put id and uname -a in a tempfile. Active Storage stored the file and redirected to it. All three came back the same:
uid=1000(rails) gid=1000(rails) groups=1000(rails)
Linux 5.15.0-112-generic #122-Ubuntu SMP Thu May 23 07:48:21 UTC 2024 x86_64 GNU/Linux
The fix
1.2.1 adds config/initializers/vips.rb:
ActiveStorage::Transformers::Vips
Vips.block_untrusted(true)
Vips.block("VipsForeignLoadOpenslide", true)
Rails.application.config.active_storage.variable_content_types -=
%w[ image/bmp image/vnd.microsoft.icon image/vnd.adobe.photoshop ]
The test that came with it expects matload to refuse a MATLAB file. 1.2.1 and 1.2.2 still accept an anonymous direct upload. 1.2.3 adds a before_action on the direct-upload controller and on the disk service's update, and returns 401 unless the cookie is a Writebook session. The comment in that initializer says the app's own uploads are a multipart POST on a different controller. These Rails routes had no session check.
A 1.2.9 install I checked returned 401 for the same POST.
Upgrading leaves a leaked SECRET_KEY_BASE in place. The advisory tells operators to run once keys reset --secret-key-base, or to set a new SECRET_KEY_BASE in the container environment and restart. That signs everyone out.
Rails calls Vips.block_untrusted(true) at boot from Active Storage 7.2.3.2, 8.0.5.1, and 8.1.3.1, and refuses to boot when ruby-vips is too old to do it. Writebook 1.2.9 still depends on image_processing 1.13.0. The loader block and the session check are in the app.
Timeline
2026-11-20
Reported via HackerOne.
2026-11-22
Jeremy asked me to stop testing and to delete anything I had retrieved. I had already stopped. The commands were id, uname -a, and hostname.
2026-11-23
Confirmed. The three instances were taken offline. Writebook is not eligible for a bounty. They published GHSA-x698-jp54-59c5 the same evening.