Re:CVE-2019-5418 – File Content Disclosure on Rails
by archgoon on Thursday March 21, 2019 @06:45PM
(#19458107)
The technical analysis (from the article), complete with a step by step trace walkthrough, is here:
https://chybeta.github.io/2019/03/16/Analysis-for%E3%80%90CV...
Also, if interested, direct link to patch fix:
https://github.com/rails/rails/commit/f4c70c2222180b8d9d924f...
Re:CVE-2019-5418 – File Content Disclosure on Rails
by anitil on Thursday March 21, 2019 @07:31PM
(#19458373)
Thanks for that, I was missing the step that assets are named $filename.$mime-type.erb in Rails. I was missing the high-level view
Re:CVE-2019-5418 – File Content Disclosure on Rails
by tptacek on Thursday March 21, 2019 @06:35PM
(#19458032)
Because the media types are parsed and used to select layout templates (layout.html.erb vs layout.xml.erb, etc).
Re:CVE-2019-5418 – File Content Disclosure on Rails
by Something1234 on Thursday March 21, 2019 @06:45PM
(#19458101)
So why wouldn't we just have a mapping between mime-types and extensions for look ups? Why bother examining the accept header beyond splitting and searching within the list? Like in such a way that we're opening arbitrary files with it?
Re:CVE-2019-5418 – File Content Disclosure on Rails
by tptacek on Thursday March 21, 2019 @06:48PM
(#19458125)
That's essentially what the patch does; the "symbol" call only resolves for known-good mime types.
Re:CVE-2019-5418 – File Content Disclosure on Rails
by Something1234 on Thursday March 21, 2019 @06:56PM
(#19458188)
Where would this code be in the rails code base? I usually don't touch ruby. I'm mildly curious what was there originally.
Re:CVE-2019-5418 – File Content Disclosure on Rails
by tptacek on Thursday March 21, 2019 @06:59PM
(#19458211)
In the template resolver in ActionView. It's spread over multiple files and a bit hard to follow, which no doubt contributed to the problem.
Re:CVE-2019-5418 – File Content Disclosure on Rails
by lostapathy on Thursday March 21, 2019 @09:47PM
(#19459010)
Unfortunately a lot of rails internals are like this :(.
I was under the impression the 'Accept:' header is a list of media types, so why would that be making filesystem calls? Or does Rails implicitly organize assets in a filesystem structure (something like ~/assets/audio or ~/assets/text)?