Feeds

RoR Paperclip infested by content type spoofing bug

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

Top 5 reasons to deploy VMware with Tegile

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.” ®

Internet Security Threat Report 2014

More from The Register

next story
'Kim Kardashian snaps naked selfies with a BLACKBERRY'. *Twitterati gasps*
More alleged private, nude celeb pics appear online
Hackers pop Brazil newspaper to root home routers
Step One: try default passwords. Step Two: Repeat Step One until success
UK.gov lobs another fistful of change at SME infosec nightmares
Senior Lib Dem in 'trying to be relevant' shocker. It's only taxpayers' money, after all
Spies would need SUPER POWERS to tap undersea cables
Why mess with armoured 10kV cables when land-based, and legal, snoop tools are easier?
TOR users become FBI's No.1 hacking target after legal power grab
Be afeared, me hearties, these scoundrels be spying our signals
Snowden, Dotcom, throw bombs into NZ election campaign
Claim of tapped undersea cable refuted by Kiwi PM as Kim claims extradition plot
Freenode IRC users told to change passwords after securo-breach
Miscreants probably got in, you guys know the drill by now
THREE QUARTERS of Android mobes open to web page spy bug
Metasploit module gobbles KitKat SOP slop
BitTorrent's peer-to-peer chat app Bleep goes live as public alpha
A good day for privacy as invisble.im also reveals its approach to untraceable chats
prev story

Whitepapers

Secure remote control for conventional and virtual desktops
Balancing user privacy and privileged access, in accordance with compliance frameworks and legislation. Evaluating any potential remote control choice.
Intelligent flash storage arrays
Tegile Intelligent Storage Arrays with IntelliFlash helps IT boost storage utilization and effciency while delivering unmatched storage savings and performance.
WIN a very cool portable ZX Spectrum
Win a one-off portable Spectrum built by legendary hardware hacker Ben Heck
High Performance for All
While HPC is not new, it has traditionally been seen as a specialist area – is it now geared up to meet more mainstream requirements?
Beginner's guide to SSL certificates
De-mystify the technology involved and give you the information you need to make the best decision when considering your online security options.