Intel

AIKIDO-2026-495234

kt-paperclip is vulnerable to Unrestricted Upload of File with Dangerous Type

GHSA-q76g-j4m5-xhg4Published Oct 19, 2026
October 19, 2026

54

CVE Score

Medium

Unrestricted Upload of File with Dangerous Type

Are you affected? Scan for Free

TL;DR

Paperclip::MediaTypeSpoofDetector uses the filename as a hint for a file's content type, so content with no magic number of its own, such as plain text or CSV, gets its type from the extension. A text file renamed to payload.jpg and uploaded with Content-Type: image/jpeg passes validates_media_type_spoof_detection and is stored with content_type: image/jpeg, so a spoofed upload reaches validates_attachment_content_type undetected. Serving that stored file back to a browser creates a stored XSS risk. The fix sets the content type from the file contents only, using both magic number detection and the Unix file command.

How do I fix this?

Upgrade the kt-paperclip library to the patch version.

Who does this affect?

You are affected if you are using a version that falls within the vulnerable range and you use validates_media_type_spoof_detection to check uploaded file content types.

Versions

8.0.0 - 8.0.0

Fixed in 8.0.1

Background info

kt-paperclip is vulnerable to Unrestricted Upload of File with Dangerous Type in versions 8.0.0 - 8.0.0.

Get secure today,
quickly and for free.

Secure your code, cloud, and runtime in one central system. Connect a repo to discover what the reasoning agents find in your codebase.

No credit card required | Scan results in 32 seconds.

Trusted by 150k+ orgs
  • Revolut
  • n8n
  • Lovable
  • Deel
  • Prove
  • Omnea