kt-paperclip is vulnerable to Unrestricted Upload of File with Dangerous Type
54
CVE Score
Medium
Unrestricted Upload of File with Dangerous Type
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.
Upgrade the kt-paperclip library to the patch version.
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.
8.0.0 - 8.0.0
Fixed in 8.0.1kt-paperclip is vulnerable to Unrestricted Upload of File with Dangerous Type in versions 8.0.0 - 8.0.0.
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.
I consent to receiving marketing communications based on Aikido’s Privacy Policy.
SOC 2Compliant
ISO 27001Compliant
ISO 42001Compliant© All Intel data is openly available and commercially licensed.