# CVE-2022-32224: Active Record RCE bug with Serialized Columns

> Attackers with database write access can achieve remote code execution via unsafe YAML deserialization in Active Record columns.

- **Severity:** Critical 9.8 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 5 Dec 2022
- **Updated:** 11 May 2026
- **Also known as:** DEBIAN-CVE-2022-32224, GHSA-3hhc-qp5v-9p2j, UBUNTU-CVE-2022-32224, openSUSE-SU-2023:0009-1, openSUSE-SU-2024:12244-1, openSUSE-SU-2024:12879-1

## What is CVE-2022-32224?

CVE-2022-32224 is a critical unsafe deserialization vulnerability in https://github.com/rails/rails, published on 5 Dec 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

A possible escalation to RCE vulnerability exists when using YAML serialized columns in Active Record < 7.0.3.1, <6.1.6.1, <6.0.5.1 and <5.2.8.1 which could allow an attacker, that can manipulate data in the database (via means like SQL injection), the ability to escalate to an RCE.

Weakness: CWE-502 (Deserialization of Untrusted Data)

## Which versions are affected by CVE-2022-32224?

8 open source packages ship an affected version, including activerecord. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `activerecord` | RubyGems | All versions | 5.2.8.1 |
| `activerecord` | RubyGems | All versions | 5.2.8.1 |
| `activerecord` | RubyGems | From 6.0.0 | 6.0.5.1 |
| `activerecord` | RubyGems | From 6.0.0 | 6.0.5.1 |
| `activerecord` | RubyGems | From 6.1.0 | 6.1.6.1 |
| `activerecord` | RubyGems | From 6.1.0 | 6.1.6.1 |
| `activerecord` | RubyGems | From 7.0.0 | 7.0.3.1 |
| `activerecord` | RubyGems | From 7.0.0 | 7.0.3.1 |
| `rubygem-activerecord-5.2` | SUSE:Package Hub 15 SP4 | All versions | 5.2.3-bp154.2.3.1 |
| `rubygem-activerecord-5.2` | openSUSE:Leap 15.4 | All versions | 5.2.3-bp154.2.3.1 |
| `ruby3.2-rubygem-activerecord-7.0` | openSUSE:Tumbleweed | All versions | 7.0.4.3-1.1 |
| `rubygem-activerecord-7.0` | openSUSE:Tumbleweed | All versions | 7.0.3.1-1.1 |

Products: Activerecord Project Activerecord.

## How do I fix CVE-2022-32224?

Upgrade activerecord to a fixed version for your release line: 5.2.8.1, 6.0.5.1, 6.1.6.1 or 7.0.3.1.

## Is CVE-2022-32224 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2022-32224 exists.

Public exploit code:

- https://github.com/ooooooo-q/cve-2022-32224-rails (github_poc): https://github.com/ooooooo-q/cve-2022-32224-rails

## Other vulnerabilities in https://github.com/rails/rails

- [CVE-2023-22794](https://insights.sbomify.com/CVE-2023-22794/): SQL Injection Vulnerability via ActiveRecord comments (high 8.8)
- [CVE-2022-44566](https://insights.sbomify.com/CVE-2022-44566/): Denial of Service Vulnerability in ActiveRecord's PostgreSQL adapter (high 7.5)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2022-32224 and fix it if it is affected.

What it is: CVE-2022-32224 is a critical unsafe deserialization vulnerability in https://github.com/rails/rails, published on 5 Dec 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2022-32224 exists.

Affected packages and fixed versions:
- activerecord (RubyGems): affected all versions; fixed in 5.2.8.1
- activerecord (RubyGems): affected all versions; fixed in 5.2.8.1
- activerecord (RubyGems): affected from 6.0.0; fixed in 6.0.5.1
- activerecord (RubyGems): affected from 6.0.0; fixed in 6.0.5.1
- activerecord (RubyGems): affected from 6.1.0; fixed in 6.1.6.1
- activerecord (RubyGems): affected from 6.1.0; fixed in 6.1.6.1
- activerecord (RubyGems): affected from 7.0.0; fixed in 7.0.3.1
- activerecord (RubyGems): affected from 7.0.0; fixed in 7.0.3.1

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2022-32224/ (Markdown: https://insights.sbomify.com/CVE-2022-32224/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2022-32224
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2022-32224
- OSV: https://osv.dev/vulnerability/CVE-2022-32224

---
From sbomify Insights: https://insights.sbomify.com/CVE-2022-32224/
Summaries are generated and may contain mistakes; the official description above is the record.
