Skip to content

Commit dd3905e

Browse files
author
RubySec CI
committed
Updated advisory posts against rubysec/ruby-advisory-db@6445bea
1 parent f36975b commit dd3905e

File tree

2 files changed

+81
-0
lines changed

2 files changed

+81
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
layout: advisory
3+
title: ! 'CVE-2016-6316 (actionview): Possible XSS Vulnerability in Action View'
4+
comments: false
5+
categories:
6+
- actionview
7+
- rails
8+
advisory:
9+
gem: actionview
10+
framework: rails
11+
cve: 2016-6316
12+
date: 2016-08-11
13+
url: https://groups.google.com/forum/#!topic/rubyonrails-security/I-VWr034ouk
14+
title: Possible XSS Vulnerability in Action View
15+
description: ! "There is a possible XSS vulnerability in Action View. Text declared
16+
as \"HTML\nsafe\" will not have quotes escaped when used as attribute values in
17+
tag\nhelpers.\n\nImpact\n------\n\nText declared as \"HTML safe\" when passed
18+
as an attribute value to a tag helper\nwill not have quotes escaped which can
19+
lead to an XSS attack. Impacted code\nlooks something like this:\n\n```ruby\ncontent_tag(:div,
20+
\"hi\", title: user_input.html_safe)\n```\n\nSome helpers like the `sanitize`
21+
helper will automatically mark strings as\n\"HTML safe\", so impacted code could
22+
also look something like this:\n\n```ruby\ncontent_tag(:div, \"hi\", title: sanitize(user_input))\n```\n\nAll
23+
users running an affected release should either upgrade or use one of the\nworkarounds
24+
immediately.\n\nWorkarounds\n-----------\nYou can work around this issue by either
25+
*not* marking arbitrary user input as\nsafe, or by manually escaping quotes like
26+
this:\n\n```ruby\ndef escape_quotes(value)\n value.gsub(/\"/, '"'.freeze)\nend\n\ncontent_tag(:div,
27+
\"hi\", title: escape_quotes(sanitize(user_input)))\n```\n"
28+
unaffected_versions:
29+
- < 3.0.0
30+
patched_versions:
31+
- ~> 3.2.22.3
32+
- ~> 4.2.7.1
33+
- ! '>= 5.0.0.1'
34+
---
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
layout: advisory
3+
title: ! 'CVE-2016-6317 (activerecord): Unsafe Query Generation Risk in Active Record'
4+
comments: false
5+
categories:
6+
- activerecord
7+
- rails
8+
advisory:
9+
gem: activerecord
10+
framework: rails
11+
cve: 2016-6317
12+
date: 2016-08-11
13+
url: https://groups.google.com/forum/#!topic/rubyonrails-security/rgO20zYW33s
14+
title: Unsafe Query Generation Risk in Active Record
15+
description: ! "There is a vulnerability when Active Record is used in conjunction
16+
with JSON\nparameter parsing. This vulnerability is similar to CVE-2012-2660,\nCVE-2012-2694
17+
and CVE-2013-0155.\n\nImpact\n------\n\nDue to the way Active Record interprets
18+
parameters in combination with the way\nthat JSON parameters are parsed, it is
19+
possible for an attacker to issue\nunexpected database queries with \"IS NULL\"
20+
or empty where clauses. This issue\ndoes *not* let an attacker insert arbitrary
21+
values into an SQL query, however\nthey can cause the query to check for NULL
22+
or eliminate a WHERE clause when\nmost users wouldn't expect it.\n\nFor example,
23+
a system has password reset with token functionality:\n\n```ruby\n unless params[:token].nil?\n
24+
\ user = User.find_by_token(params[:token])\n user.reset_password!\n
25+
\ end\n```\n\nAn attacker can craft a request such that `params[:token]` will
26+
return\n`[nil]`. The `[nil]` value will bypass the test for nil, but will still
27+
add\nan \"IN ('xyz', NULL)\" clause to the SQL query.\n\nSimilarly, an attacker
28+
can craft a request such that `params[:token]` will\nreturn an empty hash. An
29+
empty hash will eliminate the WHERE clause of the\nquery, but can bypass the `nil?`
30+
check.\n\nNote that this impacts not only dynamic finders (`find_by_*`) but also\nrelations
31+
(`User.where(:name => params[:name])`).\n\nAll users running an affected release
32+
should either upgrade or use one of the\nwork arounds immediately. All users running
33+
an affected release should upgrade\nimmediately. Please note, this vulnerability
34+
is a variant of CVE-2012-2660,\nCVE-2012-2694, and CVE-2013-0155. Even if you
35+
upgraded to address those\nissues, you must take action again.\n\nIf this chance
36+
in behavior impacts your application, you can manually decode\nthe original values
37+
from the request like so:\n\n `ActiveSupport::JSON.decode(request.body)`\n\nWorkarounds\n-----------\nThis
38+
problem can be mitigated by casting the parameter to a string before\npassing
39+
it to Active Record. For example:\n\n ```ruby\n unless params[:token].nil?
40+
|| params[:token].to_s.empty?\n user = User.find_by_token(params[:token].to_s)\n
41+
\ user.reset_password!\n end\n ```\n"
42+
unaffected_versions:
43+
- < 4.2.0
44+
- ! '>= 5.0.0'
45+
patched_versions:
46+
- ~> 4.2.7.1
47+
---

0 commit comments

Comments
 (0)