bundler-audit 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +11 -6
  3. data/ChangeLog.md +7 -1
  4. data/Gemfile +1 -1
  5. data/README.md +13 -7
  6. data/bin/bundler-audit +3 -0
  7. data/data/ruby-advisory-db.ts +1 -1
  8. data/data/ruby-advisory-db/.gitignore +0 -1
  9. data/data/ruby-advisory-db/.travis.yml +0 -6
  10. data/data/ruby-advisory-db/CONTRIBUTING.md +34 -21
  11. data/data/ruby-advisory-db/CONTRIBUTORS.md +2 -0
  12. data/data/ruby-advisory-db/Gemfile +1 -1
  13. data/data/ruby-advisory-db/README.md +38 -21
  14. data/data/ruby-advisory-db/gems/RedCloth/{OSVDB-115941.yml → CVE-2012-6684.yml} +6 -1
  15. data/data/ruby-advisory-db/gems/actionpack/CVE-2015-7576.yml +102 -102
  16. data/data/ruby-advisory-db/gems/actionpack/CVE-2015-7581.yml +2 -2
  17. data/data/ruby-advisory-db/gems/actionpack/CVE-2016-0751.yml +45 -45
  18. data/data/ruby-advisory-db/gems/actionpack/CVE-2016-0752.yml +96 -0
  19. data/data/ruby-advisory-db/gems/actionpack/CVE-2016-2097.yml +90 -0
  20. data/data/ruby-advisory-db/gems/actionpack/CVE-2016-2098.yml +89 -0
  21. data/data/ruby-advisory-db/gems/actionpack/CVE-2016-6316.yml +57 -0
  22. data/data/ruby-advisory-db/gems/actionview/CVE-2016-0752.yml +80 -80
  23. data/data/ruby-advisory-db/gems/actionview/CVE-2016-2097.yml +89 -0
  24. data/data/ruby-advisory-db/gems/actionview/CVE-2016-6316.yml +56 -0
  25. data/data/ruby-advisory-db/gems/activemodel/CVE-2016-0753.yml +78 -78
  26. data/data/ruby-advisory-db/gems/activerecord/CVE-2015-7577.yml +91 -91
  27. data/data/ruby-advisory-db/gems/activerecord/CVE-2016-6317.yml +73 -0
  28. data/data/ruby-advisory-db/gems/administrate/CVE-2016-3098.yml +14 -0
  29. data/data/ruby-advisory-db/gems/aescrypt/CVE-2013-7463.yml +10 -0
  30. data/data/ruby-advisory-db/gems/archive-tar-minitar/CVE-2016-10173.yml +16 -0
  31. data/data/ruby-advisory-db/gems/colorscore/CVE-2015-7541.yml +2 -1
  32. data/data/ruby-advisory-db/gems/doorkeeper/CVE-2016-6582.yml +43 -0
  33. data/data/ruby-advisory-db/gems/espeak-ruby/CVE-2016-10193.yml +15 -0
  34. data/data/ruby-advisory-db/gems/festivaltts4r/CVE-2016-10194.yml +12 -0
  35. data/data/ruby-advisory-db/gems/git-fastclone/CVE-2015-8968.yml +21 -0
  36. data/data/ruby-advisory-db/gems/git-fastclone/CVE-2015-8969.yml +13 -0
  37. data/data/ruby-advisory-db/gems/mail/OSVDB-131677.yml +18 -11
  38. data/data/ruby-advisory-db/gems/minitar/CVE-2016-10173.yml +16 -0
  39. data/data/ruby-advisory-db/gems/nokogiri/CVE-2015-8806.yml +42 -0
  40. data/data/ruby-advisory-db/gems/nokogiri/CVE-2016-4658.yml +32 -0
  41. data/data/ruby-advisory-db/gems/nokogiri/CVE-2017-5029.yml +44 -0
  42. data/data/ruby-advisory-db/gems/passenger/CVE-2016-10345.yml +16 -0
  43. data/data/ruby-advisory-db/gems/rack-mini-profiler/CVE-2016-4442.yml +17 -0
  44. data/data/ruby-advisory-db/gems/ruby-saml/CVE-2016-5697.yml +17 -0
  45. data/data/ruby-advisory-db/gems/rubyzip/CVE-2017-5946.yml +14 -0
  46. data/data/ruby-advisory-db/gems/safemode/CVE-2016-3693.yml +13 -0
  47. data/data/ruby-advisory-db/gems/spina/CVE-2015-4619.yml +16 -0
  48. data/data/ruby-advisory-db/gems/twitter-bootstrap-rails/OSVDB-109206.yml +1 -1
  49. data/data/ruby-advisory-db/rubies/ruby/CVE-2015-1855.yml +17 -0
  50. data/data/ruby-advisory-db/rubies/ruby/CVE-2015-9096.yml +19 -0
  51. data/data/ruby-advisory-db/spec/advisory_example.rb +19 -4
  52. data/gemspec.yml +1 -1
  53. data/lib/bundler/audit/cli.rb +10 -5
  54. data/lib/bundler/audit/database.rb +13 -3
  55. data/lib/bundler/audit/version.rb +1 -1
  56. data/spec/bundle/secure/Gemfile +1 -1
  57. data/spec/cli_spec.rb +80 -25
  58. data/spec/database_spec.rb +5 -5
  59. data/spec/integration_spec.rb +2 -2
  60. metadata +35 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 650484979d4eb765a3c725eb4b31303d24fe5b59
4
- data.tar.gz: dfc8d83b2c4488bf7284103276941bd4ab8d5f1c
3
+ metadata.gz: b0f922ef909402f6b0285e60d2a36e772b2427a2
4
+ data.tar.gz: ba58dffc77a682e3441b76a1b4ce3983b6d675e3
5
5
  SHA512:
6
- metadata.gz: 4da6b5b6f801ee56c94b581c2190d0cf0f607c347269b1ad5c5b3ce3bfbfdcf4e8679abc9f4d5f34542587936beede85315ba25ebc78dffe077e52ac670ecc62
7
- data.tar.gz: 961867353bb8145023a2f9ab6ba41e609c8594c697adc1c6c3e4e86708e3d39b9c6326a1d8baafeff521101a8109f0b9a9edf15e8ded29383e9e29606f36a523
6
+ metadata.gz: af61e9d2970568342a984a4dc0b617ed42fb9bff22cb510dda8daac2460bc0023c2a9f1e33b3d36e1f3e7ea92a12fdf0cefc769da3bc302da41e61996b635808
7
+ data.tar.gz: ae6ef78b2786d7b0da5b90ee8a450116e501ffe5ad4f29094a55c4bcd86b16408a712cbb5f3cc44334b9cc7ef9cd8939ca9abef493f59a7474050bb13c2b4359
@@ -1,7 +1,12 @@
1
+ language: ruby
1
2
  rvm:
2
- - 1.9.3
3
- - 2.0
4
- - 2.1
5
- - 2.2
6
- before_install:
7
- - gem install rspec
3
+ - 2.1.8
4
+ - 2.2.4
5
+ - 2.3.0
6
+ - jruby
7
+ - rbx-3
8
+
9
+ matrix:
10
+ allow_failures:
11
+ - rvm: jruby
12
+ - rvm: rbx-3
@@ -1,4 +1,10 @@
1
- ### 0.5.0 / 2015-02-28
1
+ ### 0.6.0 / 2017-07-18
2
+
3
+ * Added `--quiet` option to `check` and `update` commands (@jaredbeck).
4
+ * Added `bin/bundler-audit` which will be executed when `bundle audit` is ran
5
+ (@vassilevsky).
6
+
7
+ ### 0.5.0 / 2016-02-28
2
8
 
3
9
  * Added {Bundler::Audit::Task}.
4
10
  * Added {Bundler::Audit::Advisory#date}.
data/Gemfile CHANGED
@@ -3,7 +3,7 @@ source 'https://rubygems.org/'
3
3
  gemspec
4
4
 
5
5
  group :development do
6
- gem 'rake', '~> 10.0'
6
+ gem 'rake'
7
7
  gem 'kramdown', '~> 0.14'
8
8
 
9
9
  gem 'rubygems-tasks', '~> 0.2'
data/README.md CHANGED
@@ -21,9 +21,9 @@ Patch-level verification for [Bundler][bundler].
21
21
 
22
22
  ## Synopsis
23
23
 
24
- Audit a projects `Gemfile.lock`:
24
+ Audit a project's `Gemfile.lock`:
25
25
 
26
- $ bundle-audit
26
+ $ bundle audit
27
27
  Name: actionpack
28
28
  Version: 3.2.10
29
29
  Advisory: OSVDB-91452
@@ -82,9 +82,9 @@ Audit a projects `Gemfile.lock`:
82
82
 
83
83
  Unpatched versions found!
84
84
 
85
- Update the [ruby-advisory-db] that `bundle-audit` uses:
85
+ Update the [ruby-advisory-db] that `bundle audit` uses:
86
86
 
87
- $ bundle-audit update
87
+ $ bundle audit update
88
88
  Updating ruby-advisory-db ...
89
89
  remote: Counting objects: 44, done.
90
90
  remote: Compressing objects: 100% (24/24), done.
@@ -110,16 +110,16 @@ Update the [ruby-advisory-db] that `bundle-audit` uses:
110
110
 
111
111
  Update the [ruby-advisory-db] and check `Gemfile.lock` (useful for CI runs):
112
112
 
113
- $ bundle-audit check --update
113
+ $ bundle audit check --update
114
114
 
115
115
  Ignore specific advisories:
116
116
 
117
- $ bundle-audit check --ignore OSVDB-108664
117
+ $ bundle audit check --ignore OSVDB-108664
118
118
 
119
119
  Rake task:
120
120
 
121
121
  ```ruby
122
- require_relative 'lib/bundler/audit/task'
122
+ require 'bundler/audit/task'
123
123
  Bundler::Audit::Task.new
124
124
 
125
125
  task default: 'bundle:audit'
@@ -136,6 +136,12 @@ task default: 'bundle:audit'
136
136
 
137
137
  $ gem install bundler-audit
138
138
 
139
+ ## Contributing
140
+
141
+ 1. Clone the repo
142
+ 1. `git submodule update --init` # To populate data dir.
143
+ 1. `bundle exec rake`
144
+
139
145
  ## License
140
146
 
141
147
  Copyright (c) 2013-2016 Hal Brodigan (postmodern.mod3 at gmail.com)
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ load File.expand_path('../bundle-audit', __FILE__)
@@ -1 +1 @@
1
- 2016-01-26 04:57:48 UTC
1
+ 2017-06-13 16:51:56 UTC
@@ -1,2 +1 @@
1
- Gemfile.lock
2
1
  _site
@@ -4,12 +4,6 @@ sudo: false
4
4
 
5
5
  cache: bundler
6
6
 
7
- deploy:
8
- provider: script
9
- script: scripts/post-advisories.sh
10
- on:
11
- branch: master
12
-
13
7
  notifications:
14
8
  irc: chat.freenode.net#rubysec
15
9
 
@@ -10,32 +10,40 @@ bundle install
10
10
  bundle exec rspec
11
11
  ```
12
12
 
13
- * Follow the schema. Here is a sample advisory:
13
+ * Follow the schema. Here is an example advisory:
14
14
 
15
15
  ```yaml
16
16
  ---
17
- gem: activerecord
18
- framework: rails
19
- cve: 2014-3514
20
- url: https://groups.google.com/forum/#!msg/rubyonrails-security/M4chq5Sb540/CC1Fh0Y_NWwJ
21
- title: Data Injection Vulnerability in Active Record
22
- date: 2014-08-18
23
-
24
- description: >-
25
- The create_with functionality in Active Record was implemented
26
- incorrectly and completely bypasses the strong parameters
27
- protection. Applications which pass user-controlled values to
28
- create_with could allow attackers to set arbitrary attributes on
29
- models.
30
-
31
- cvss_v2: 8.7
17
+ gem: examplegem
18
+ cve: 2013-0156
19
+ url: https://github.com/rubysec/ruby-advisory-db/issues/123456
20
+ title: |
21
+ Ruby on Rails params_parser.rb Action Pack Type Casting Parameter Parsing
22
+ Remote Code Execution
32
23
 
33
- unaffected_versions:
34
- - "< 4.0.0"
24
+ description: |
25
+ Ruby on Rails contains a flaw in params_parser.rb of the Action Pack.
26
+ The issue is triggered when a type casting error occurs during the parsing
27
+ of parameters. This may allow a remote attacker to potentially execute
28
+ arbitrary code.
29
+
30
+ cvss_v2: 10.0
35
31
 
36
32
  patched_versions:
37
- - ~> 4.0.9
38
- - ">= 4.1.5"
33
+ - ~> 2.3.15
34
+ - ~> 3.0.19
35
+ - ~> 3.1.10
36
+ - ">= 3.2.11"
37
+ unaffected_versions:
38
+ - ~> 2.4.3
39
+
40
+ related:
41
+ cve:
42
+ - 2013-1234567
43
+ - 2013-1234568
44
+ url:
45
+ - https://github.com/rubysec/ruby-advisory-db/issues/123457
46
+
39
47
  ```
40
48
  ### Schema
41
49
 
@@ -43,14 +51,19 @@ bundle exec rspec
43
51
  * `framework` \[String\] (optional): Name of framework gem belongs to.
44
52
  * `platform` \[String\] (optional): If this vulnerability is platform-specific, name of platform this vulnerability affects (e.g. JRuby)
45
53
  * `cve` \[String\]: CVE id.
46
- * `osvdb` \[Fixnum\]: OSVDB id.
54
+ * `osvdb` \[Integer\]: OSVDB id.
47
55
  * `url` \[String\]: The URL to the full advisory.
48
56
  * `title` \[String\]: The title of the advisory.
49
57
  * `date` \[Date\]: Disclosure date of the advisory.
50
58
  * `description` \[String\]: Multi-paragraph description of the vulnerability.
51
59
  * `cvss_v2` \[Float\]: The [CVSSv2] score for the vulnerability.
60
+ * `cvss_v3` \[Float\]: The [CVSSv3] score for the vulnerability.
52
61
  * `unaffected_versions` \[Array\<String\>\] (optional): The version requirements for the
53
62
  unaffected versions of the Ruby library.
54
63
  * `patched_versions` \[Array\<String\>\]: The version requirements for the
55
64
  patched versions of the Ruby library.
65
+ * `related` \[Hash\<Array\<String\>\>\]: Sometimes an advisory references many urls and cves. Supported keys: `cve` and `url`
66
+
56
67
 
68
+ [CVSSv2]: https://www.first.org/cvss/v2/guide
69
+ [CVSSv3]: https://www.first.org/cvss/user-guide
@@ -34,5 +34,7 @@ This database would not be possible without volunteers willing to submit pull re
34
34
  * [Andrew Selder](https://github.com/aselder)
35
35
  * [Vanessa Henderson](https://github.com/VanessaHenderson)
36
36
  * [Reed Loden](https://github.com/reedloden)
37
+ * [ecneladis](https://github.com/ecneladis)
38
+ * [Brendan Coles](https://github.com/bcoles)
37
39
 
38
40
  The rubysec.com domain was graciously donated by [Jordi Massaguer](https://github.com/jordimassaguerpla).
@@ -1,6 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'rspec', '3.3.0'
3
+ gem 'rspec'
4
4
  gem 'rake'
5
5
 
6
6
  group :development do
@@ -1,53 +1,60 @@
1
1
  # Ruby Advisory Database
2
2
 
3
- The Ruby Advisory Database aims to compile all advisories that are relevant to Ruby libraries.
3
+ The Ruby Advisory Database is a community effort to compile all security advisories that are relevant to Ruby libraries.
4
4
 
5
- ## Goals
5
+ You can check your own Gemfile.locks against this database by using [bundler-audit](https://github.com/rubysec/bundler-audit).
6
6
 
7
- 1. Provide advisory **metadata** in a **simple** yet **structured** [YAML]
8
- schema for automated tools to consume.
9
- 2. Avoid reinventing [CVE]s.
10
- 3. Avoid duplicating the efforts of the [OSVDB].
7
+ ## Support Ruby security!
8
+
9
+ Do you know about a vulnerability that isn't listed in this database? Open an issue, submit a PR, or [use this form](https://rubysec.com/advisories/new) which will email the maintainers.
11
10
 
12
11
  ## Directory Structure
13
12
 
14
13
  The database is a list of directories that match the names of Ruby libraries on
15
14
  [rubygems.org]. Within each directory are one or more advisory files
16
- for the Ruby library. These advisory files are typically named using
17
- the advisories [OSVDB] identifier number.
15
+ for the Ruby library. These advisory files are named using
16
+ the advisories' [CVE] identifier number.
18
17
 
19
18
  gems/:
20
19
  actionpack/:
21
- OSVDB-79727.yml OSVDB-84513.yml OSVDB-89026.yml OSVDB-91454.yml
22
- OSVDB-84243.yml OSVDB-84515.yml OSVDB-91452.yml
20
+ CVE-2014-0130.yml CVE-2014-7818.yml CVE-2014-7829.yml CVE-2015-7576.yml
21
+ CVE-2015-7581.yml CVE-2016-0751.yml CVE-2016-0752.yml
23
22
 
24
23
  ## Format
25
24
 
26
25
  Each advisory file contains the advisory information in [YAML] format:
27
26
 
28
27
  ---
29
- gem: actionpack
30
- framework: rails
28
+ gem: examplegem
31
29
  cve: 2013-0156
32
- osvdb: 89026
33
- url: http://osvdb.org/show/osvdb/89026
30
+ url: https://github.com/rubysec/ruby-advisory-db/issues/123456
34
31
  title: |
35
32
  Ruby on Rails params_parser.rb Action Pack Type Casting Parameter Parsing
36
- Remote Code Execution
37
-
33
+ Remote Code Execution
34
+
38
35
  description: |
39
36
  Ruby on Rails contains a flaw in params_parser.rb of the Action Pack.
40
37
  The issue is triggered when a type casting error occurs during the parsing
41
38
  of parameters. This may allow a remote attacker to potentially execute
42
39
  arbitrary code.
43
-
40
+
44
41
  cvss_v2: 10.0
45
-
42
+
46
43
  patched_versions:
47
44
  - ~> 2.3.15
48
45
  - ~> 3.0.19
49
46
  - ~> 3.1.10
50
47
  - ">= 3.2.11"
48
+ unaffected_versions:
49
+ - ~> 2.4.3
50
+
51
+ related:
52
+ cve:
53
+ - 2013-1234567
54
+ - 2013-1234568
55
+ url:
56
+ - https://github.com/rubysec/ruby-advisory-db/issues/123457
57
+
51
58
 
52
59
  ### Schema
53
60
 
@@ -55,16 +62,26 @@ Each advisory file contains the advisory information in [YAML] format:
55
62
  * `framework` \[String\] (optional): Name of framework gem belongs to.
56
63
  * `platform` \[String\] (optional): If this vulnerability is platform-specific, name of platform this vulnerability affects (e.g. JRuby)
57
64
  * `cve` \[String\]: CVE id.
58
- * `osvdb` \[Fixnum\]: OSVDB id.
65
+ * `osvdb` \[Integer\]: OSVDB id.
59
66
  * `url` \[String\]: The URL to the full advisory.
60
67
  * `title` \[String\]: The title of the advisory.
61
68
  * `date` \[Date\]: Disclosure date of the advisory.
62
69
  * `description` \[String\]: Multi-paragraph description of the vulnerability.
63
70
  * `cvss_v2` \[Float\]: The [CVSSv2] score for the vulnerability.
71
+ * `cvss_v3` \[Float\]: The [CVSSv3] score for the vulnerability.
64
72
  * `unaffected_versions` \[Array\<String\>\] (optional): The version requirements for the
65
73
  unaffected versions of the Ruby library.
66
74
  * `patched_versions` \[Array\<String\>\]: The version requirements for the
67
75
  patched versions of the Ruby library.
76
+ * `related` \[Hash\<Array\<String\>\>\]: Sometimes an advisory references many urls and cves. Supported keys: `cve` and `url`
77
+
78
+ ### Tests
79
+ Prior to submitting a pull request, run the tests:
80
+
81
+ ```
82
+ bundle install
83
+ bundle exec rspec
84
+ ```
68
85
 
69
86
  ## Credits
70
87
 
@@ -76,7 +93,7 @@ developed by the Open Security Foundation (OSF) and its contributors.
76
93
  [rubygems.org]: https://rubygems.org/
77
94
  [CVE]: http://cve.mitre.org/
78
95
  [OSVDB]: http://www.osvdb.org/
79
- [CVSSv2]: http://www.first.org/cvss/cvss-guide.html
80
- [OSVDB]: http://www.osvdb.org/
96
+ [CVSSv2]: https://www.first.org/cvss/v2/guide
97
+ [CVSSv3]: https://www.first.org/cvss/user-guide
81
98
  [YAML]: http://www.yaml.org/
82
99
  [CONTRIBUTORS.md]: https://github.com/rubysec/ruby-advisory-db/blob/master/CONTRIBUTORS.md
@@ -2,7 +2,7 @@
2
2
  gem: RedCloth
3
3
  cve: 2012-6684
4
4
  osvdb: 115941
5
- url: http://www.osvdb.org/show/osvdb/115941
5
+ url: https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2012-6684
6
6
  title: RedCloth Gem for Ruby Textile Link Parsing XSS
7
7
  date: 2012-02-29
8
8
  description: |
@@ -14,3 +14,8 @@ description: |
14
14
  their browser and the server.
15
15
  cvss_v2: 4.3
16
16
  patched_versions:
17
+ - ">= 4.3.0"
18
+ related:
19
+ url:
20
+ - https://github.com/jgarber/redcloth/commit/2f6dab4d6aea5cee778d2f37a135637fe3f1573c
21
+ - http://co3k.org/blog/redcloth-unfixed-xss-en
@@ -8,109 +8,109 @@ url: "https://groups.google.com/forum/#!topic/rubyonrails-security/ANv0HDHEC3k"
8
8
  title: Timing attack vulnerability in basic authentication in Action Controller.
9
9
 
10
10
  description: |
11
- There is a timing attack vulnerability in the basic authentication support
12
- in Action Controller. This vulnerability has been assigned the CVE
13
- identifier CVE-2015-7576.
14
-
15
- Versions Affected: All.
16
- Not affected: None.
17
- Fixed Versions: 5.0.0.beta1.1, 4.2.5.1, 4.1.14.1, 3.2.22.1
18
-
19
- Impact
20
- ------
21
- Due to the way that Action Controller compares user names and passwords in
22
- basic authentication authorization code, it is possible for an attacker to
23
- analyze the time taken by a response and intuit the password.
24
-
25
- For example, this string comparison:
26
-
27
- "foo" == "bar"
28
-
29
- is possibly faster than this comparison:
30
-
31
- "foo" == "fo1"
32
-
33
- Attackers can use this information to attempt to guess the username and
34
- password used in the basic authentication system.
35
-
36
- You can tell you application is vulnerable to this attack by looking for
37
- `http_basic_authenticate_with` method calls in your application.
38
-
39
- All users running an affected release should either upgrade or use one of
40
- the workarounds immediately.
41
-
42
- Releases
43
- --------
44
- The FIXED releases are available at the normal locations.
45
-
46
- Workarounds
47
- -----------
48
- If you can't upgrade, please use the following monkey patch in an initializer
49
- that is loaded before your application:
50
-
51
- ```
52
- $ cat config/initializers/basic_auth_fix.rb
53
- module ActiveSupport
54
- module SecurityUtils
55
- def secure_compare(a, b)
56
- return false unless a.bytesize == b.bytesize
57
-
58
- l = a.unpack "C#{a.bytesize}"
59
-
60
- res = 0
61
- b.each_byte { |byte| res |= byte ^ l.shift }
62
- res == 0
63
- end
64
- module_function :secure_compare
65
-
66
- def variable_size_secure_compare(a, b)
67
- secure_compare(::Digest::SHA256.hexdigest(a), ::Digest::SHA256.hexdigest(b))
68
- end
69
- module_function :variable_size_secure_compare
70
- end
71
- end
72
-
73
- module ActionController
74
- class Base
75
- def self.http_basic_authenticate_with(options = {})
76
- before_action(options.except(:name, :password, :realm)) do
77
- authenticate_or_request_with_http_basic(options[:realm] || "Application") do |name, password|
78
- # This comparison uses & so that it doesn't short circuit and
79
- # uses `variable_size_secure_compare` so that length information
80
- # isn't leaked.
81
- ActiveSupport::SecurityUtils.variable_size_secure_compare(name, options[:name]) &
82
- ActiveSupport::SecurityUtils.variable_size_secure_compare(password, options[:password])
83
- end
84
- end
85
- end
86
- end
87
- end
88
- ```
89
-
90
-
91
- Patches
92
- -------
93
- To aid users who aren't able to upgrade immediately we have provided patches for
94
- the two supported release series. They are in git-am format and consist of a
95
- single changeset.
96
-
97
- * 4-1-basic_auth.patch - Patch for 4.1 series
98
- * 4-2-basic_auth.patch - Patch for 4.2 series
99
- * 5-0-basic_auth.patch - Patch for 5.0 series
100
-
101
- Please note that only the 4.1.x and 4.2.x series are supported at present. Users
102
- of earlier unsupported releases are advised to upgrade as soon as possible as we
103
- cannot guarantee the continued availability of security fixes for unsupported
104
- releases.
105
-
106
- Credits
107
- -------
108
-
109
- Thank you to Daniel Waterworth for reporting the problem and working with us to
11
+ There is a timing attack vulnerability in the basic authentication support
12
+ in Action Controller. This vulnerability has been assigned the CVE
13
+ identifier CVE-2015-7576.
14
+
15
+ Versions Affected: All.
16
+ Not affected: None.
17
+ Fixed Versions: 5.0.0.beta1.1, 4.2.5.1, 4.1.14.1, 3.2.22.1
18
+
19
+ Impact
20
+ ------
21
+ Due to the way that Action Controller compares user names and passwords in
22
+ basic authentication authorization code, it is possible for an attacker to
23
+ analyze the time taken by a response and intuit the password.
24
+
25
+ For example, this string comparison:
26
+
27
+ "foo" == "bar"
28
+
29
+ is possibly faster than this comparison:
30
+
31
+ "foo" == "fo1"
32
+
33
+ Attackers can use this information to attempt to guess the username and
34
+ password used in the basic authentication system.
35
+
36
+ You can tell you application is vulnerable to this attack by looking for
37
+ `http_basic_authenticate_with` method calls in your application.
38
+
39
+ All users running an affected release should either upgrade or use one of
40
+ the workarounds immediately.
41
+
42
+ Releases
43
+ --------
44
+ The FIXED releases are available at the normal locations.
45
+
46
+ Workarounds
47
+ -----------
48
+ If you can't upgrade, please use the following monkey patch in an initializer
49
+ that is loaded before your application:
50
+
51
+ ```
52
+ $ cat config/initializers/basic_auth_fix.rb
53
+ module ActiveSupport
54
+ module SecurityUtils
55
+ def secure_compare(a, b)
56
+ return false unless a.bytesize == b.bytesize
57
+
58
+ l = a.unpack "C#{a.bytesize}"
59
+
60
+ res = 0
61
+ b.each_byte { |byte| res |= byte ^ l.shift }
62
+ res == 0
63
+ end
64
+ module_function :secure_compare
65
+
66
+ def variable_size_secure_compare(a, b)
67
+ secure_compare(::Digest::SHA256.hexdigest(a), ::Digest::SHA256.hexdigest(b))
68
+ end
69
+ module_function :variable_size_secure_compare
70
+ end
71
+ end
72
+
73
+ module ActionController
74
+ class Base
75
+ def self.http_basic_authenticate_with(options = {})
76
+ before_action(options.except(:name, :password, :realm)) do
77
+ authenticate_or_request_with_http_basic(options[:realm] || "Application") do |name, password|
78
+ # This comparison uses & so that it doesn't short circuit and
79
+ # uses `variable_size_secure_compare` so that length information
80
+ # isn't leaked.
81
+ ActiveSupport::SecurityUtils.variable_size_secure_compare(name, options[:name]) &
82
+ ActiveSupport::SecurityUtils.variable_size_secure_compare(password, options[:password])
83
+ end
84
+ end
85
+ end
86
+ end
87
+ end
88
+ ```
89
+
90
+
91
+ Patches
92
+ -------
93
+ To aid users who aren't able to upgrade immediately we have provided patches for
94
+ the two supported release series. They are in git-am format and consist of a
95
+ single changeset.
96
+
97
+ * 4-1-basic_auth.patch - Patch for 4.1 series
98
+ * 4-2-basic_auth.patch - Patch for 4.2 series
99
+ * 5-0-basic_auth.patch - Patch for 5.0 series
100
+
101
+ Please note that only the 4.1.x and 4.2.x series are supported at present. Users
102
+ of earlier unsupported releases are advised to upgrade as soon as possible as we
103
+ cannot guarantee the continued availability of security fixes for unsupported
104
+ releases.
105
+
106
+ Credits
107
+ -------
108
+
109
+ Thank you to Daniel Waterworth for reporting the problem and working with us to
110
110
  fix it.
111
111
 
112
112
  patched_versions:
113
- - "~> 5.0.0.beta1.1"
114
- - "~> 4.2.5.1"
115
- - "~> 4.1.14.1"
113
+ - ">= 5.0.0.beta1.1"
114
+ - "~> 4.2.5, >= 4.2.5.1"
115
+ - "~> 4.1.14, >= 4.1.14.1"
116
116
  - "~> 3.2.22.1"