-
-
Notifications
You must be signed in to change notification settings - Fork 232
Expand file tree
/
Copy pathCVE-2022-32224.yml
More file actions
78 lines (64 loc) · 2.73 KB
/
CVE-2022-32224.yml
File metadata and controls
78 lines (64 loc) · 2.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
---
gem: activerecord
framework: rails
cve: 2022-32224
ghsa: 3hhc-qp5v-9p2j
url: https://groups.google.com/g/rubyonrails-security/c/MmFO3LYQE8U
title: Possible RCE escalation bug with Serialized Columns in Active Record
date: 2022-07-12
description: |
There is a possible escalation to RCE when using YAML serialized columns in
Active Record. This vulnerability has been assigned the CVE identifier
CVE-2022-32224.
Versions Affected: All.
Not affected: None
Fixed Versions: 7.0.3.1, 6.1.6.1, 6.0.5.1, 5.2.8.1
Impact
------
When serialized columns that use YAML (the default) are deserialized, Rails
uses `YAML.unsafe_load` to convert the YAML data in to Ruby objects. If an
attacker can manipulate data in the database (via means like SQL injection),
then it may be possible for the attacker to escalate to an RCE.
Impacted Active Record models will look something like this:
```ruby
class User < ApplicationRecord
serialize :options # Vulnerable: Uses YAML for serialization
serialize :values, Array # Vulnerable: Uses YAML for serialization
serialize :values, JSON # Not vulnerable
end
```
All users running an affected release should either upgrade or use one of the
workarounds immediately.
Releases
--------
The FIXED releases are available at the normal locations.
The released versions change the default YAML deserializer to use
`YAML.safe_load`, which prevents deserialization of possibly dangerous
objects. This may introduce backwards compatibility issues with existing
data.
In order to cope with that situation, the released version also contains two
new Active Record configuration options. The configuration options are as
follows:
* `config.active_record.use_yaml_unsafe_load`
When set to true, this configuration option tells Rails to use the old
"unsafe" YAML loading strategy, maintaining the existing behavior but leaving
the possible escalation vulnerability in place. Setting this option to true
is *not* recommended, but can aid in upgrading.
* `config.active_record.yaml_column_permitted_classes`
The "safe YAML" loading method does not allow all classes to be deserialized
by default. This option allows you to specify classes deemed "safe" in your
application. For example, if your application uses Symbol and Time in
serialized data, you can add Symbol and Time to the allowed list as follows:
```
config.active_record.yaml_column_permitted_classes = [Symbol, Date, Time]
```
Workarounds
-----------
There are no feasible workarounds for this issue, but other coders (such as
JSON) are not impacted.
cvss_v3: 9.8
patched_versions:
- "~> 5.2.8, >= 5.2.8.1"
- "~> 6.0.5, >= 6.0.5.1"
- "~> 6.1.6, >= 6.1.6.1"
- ">= 7.0.3.1"