Feeds

RoR Paperclip infested by content type spoofing bug

Rise and shine, Ruby devs, it's patching time!

Next gen security for virtualised datacentres

Ruby on Rails developers using the Paperclip uploader to receive files need to update to a new version, after a developer turned up an XSS bug in the software that could possibly be extended to remote code execution.

The new version, here, implements stricter incoming file typing to eliminate the bug.

What Egor Homakov discovered, here, is that Paperclip had a bug that let him upload files with arbitrary extensions.

In Paperclip, he explains, the developer is supposed to specify @content_type so that it agrees with the file that's being uploaded, but that isn't checked, so “I crafted a special URL http://www.sakurity.com/img.jpg.htm serving a JPEG file with content-type = image/jpg, but with .htm extension in the path”.

“Paperclip thinks the file we "supplied" with URL is an image and saves it with original filename (file.jpg.htm). Furthermore, to make Paperclip download your remote file no configuration is required!” he writes. All the user needs do is remove type="file" from the input field.

That allowed Homakov to put XSS code in the image's EXIF header. Homakov believes that this could be exploited for remote code execution, but he did not test that.

In the patch, Paperclip's developers write that “Starting at version 4.0.0, all attachments are *required* to include a +content_type validation, a file_name validation, or to explicitly state that +they're not going to have either. *Paperclip will raise an error* if you do not +do this.

“Also starting at version 4.0.0, Paperclip has another validation that +cannot be turned off. This validation will prevent content type spoofing.” ®

The essential guide to IT transformation

More from The Register

next story
Goog says patch⁵⁰ your Chrome
64-bit browser loads cat vids FIFTEEN PERCENT faster!
Chinese hackers spied on investigators of Flight MH370 - report
Classified data on flight's disappearance pinched
NIST to sysadmins: clean up your SSH mess
Too many keys, too badly managed
Scratched PC-dispatch patch patched, hatched in batch rematch
Windows security update fixed after triggering blue screens (and screams) of death
Researchers camouflage haxxor traps with fake application traffic
Honeypots sweetened to resemble actual workloads, complete with 'secure' logins
prev story

Whitepapers

Top 10 endpoint backup mistakes
Avoid the ten endpoint backup mistakes to ensure that your critical corporate data is protected and end user productivity is improved.
Implementing global e-invoicing with guaranteed legal certainty
Explaining the role local tax compliance plays in successful supply chain management and e-business and how leading global brands are addressing this.
Backing up distributed data
Eliminating the redundant use of bandwidth and storage capacity and application consolidation in the modern data center.
The essential guide to IT transformation
ServiceNow discusses three IT transformations that can help CIOs automate IT services to transform IT and the enterprise
Next gen security for virtualised datacentres
Legacy security solutions are inefficient due to the architectural differences between physical and virtual environments.