Skip to content

Commit 803d62f

Browse files
authored
Merge pull request #380 from rschultheis/rails_vuln
rails vulns march 13 CVE-2019-5418 and CVE-2019-5420
2 parents 2b3eea2 + c4086af commit 803d62f

2 files changed

Lines changed: 144 additions & 0 deletions

File tree

gems/actionview/CVE-2019-5418.yml

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
---
2+
gem: actionview
3+
framework: rails
4+
cve: 2019-5418
5+
date: 2019-03-13
6+
url: https://groups.google.com/forum/#!topic/rubyonrails-security/pFRKI96Sm8Q
7+
8+
title: File Content Disclosure in Action View
9+
10+
description: |
11+
There is a possible file content disclosure vulnerability in Action View. This
12+
vulnerability has been assigned the CVE identifier CVE-2019-5418.
13+
14+
Versions Affected: All.
15+
Not affected: None.
16+
Fixed Versions: 6.0.0.beta3, 5.2.2.1, 5.1.6.2, 5.0.7.2, 4.2.11.1
17+
18+
Impact
19+
------
20+
There is a possible file content disclosure vulnerability in Action View.
21+
Specially crafted accept headers in combination with calls to `render file:`
22+
can cause arbitrary files on the target server to be rendered, disclosing the
23+
file contents.
24+
25+
The impact is limited to calls to `render` which render file contents without
26+
a specified accept format. Impacted code in a controller looks something like
27+
this:
28+
29+
```
30+
class UserController < ApplicationController
31+
def index
32+
render file: "#{Rails.root}/some/file"
33+
end
34+
end
35+
```
36+
37+
Rendering templates as opposed to files is not impacted by this vulnerability.
38+
39+
All users running an affected release should either upgrade or use one of the
40+
workarounds immediately.
41+
42+
Releases
43+
--------
44+
The 6.0.0.beta3, 5.2.2.1, 5.1.6.2, 5.0.7.2, and 4.2.11.1 releases are
45+
available at the normal locations.
46+
47+
Workarounds
48+
-----------
49+
This vulnerability can be mitigated by specifying a format for file rendering,
50+
like this:
51+
52+
```
53+
class UserController < ApplicationController
54+
def index
55+
render file: "#{Rails.root}/some/file", formats: [:html]
56+
end
57+
end
58+
```
59+
60+
In summary, impacted calls to `render` look like this:
61+
62+
```
63+
render file: "#{Rails.root}/some/file"
64+
```
65+
66+
The vulnerability can be mitigated by changing to this:
67+
68+
```
69+
render file: "#{Rails.root}/some/file", formats: [:html]
70+
```
71+
72+
Other calls to `render` are not impacted.
73+
74+
Alternatively, the following monkey patch can be applied in an initializer:
75+
76+
```
77+
$ cat config/initializers/formats_filter.rb
78+
# frozen_string_literal: true
79+
80+
ActionDispatch::Request.prepend(Module.new do
81+
def formats
82+
super().select do |format|
83+
format.symbol || format.ref == "*/*"
84+
end
85+
end
86+
end)
87+
```
88+
89+
Credits
90+
-------
91+
Thanks to John Hawthorn <john@hawthorn.email> of GitHub
92+
93+
patched_versions:
94+
- "~> 4.2.11, >= 4.2.11.1"
95+
- "~> 5.0.7, >= 5.0.7.2"
96+
- "~> 5.1.6, >= 5.1.6.2"
97+
- "~> 5.2.2, >= 5.2.2.1"
98+
- ">= 6.0.0.beta3"

gems/railties/CVE-2019-5420.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
gem: railties
3+
framework: rails
4+
cve: 2019-5420
5+
date: 2019-03-13
6+
url: https://groups.google.com/forum/#!topic/rubyonrails-security/IsQKvDqZdKw
7+
8+
title: Possible Remote Code Execution Exploit in Rails Development Mode
9+
10+
description: |
11+
There is a possible a possible remote code executing exploit in Rails when in
12+
development mode. This vulnerability has been assigned the CVE identifier
13+
CVE-2019-5420.
14+
15+
Versions Affected: 6.0.0.X, 5.2.X.
16+
Not affected: None.
17+
Fixed Versions: 6.0.0.beta3, 5.2.2.1
18+
19+
Impact
20+
------
21+
With some knowledge of a target application it is possible for an attacker to
22+
guess the automatically generated development mode secret token. This secret
23+
token can be used in combination with other Rails internals to escalate to a
24+
remote code execution exploit.
25+
26+
All users running an affected release should either upgrade or use one of the
27+
workarounds immediately.
28+
29+
Releases
30+
--------
31+
The 6.0.0.beta3 and 5.2.2.1 releases are available at the normal locations.
32+
33+
Workarounds
34+
-----------
35+
This issue can be mitigated by specifying a secret key in development mode.
36+
In "config/environments/development.rb" add this:
37+
38+
config.secret_key_base = SecureRandom.hex(64)
39+
40+
Credits
41+
-------
42+
Thanks to ooooooo_q
43+
44+
patched_versions:
45+
- "~> 5.2.2, >= 5.2.2.1"
46+
- ">= 6.0.0.beta3"

0 commit comments

Comments
 (0)