# CVE-2013-0333: activesupport in Rails vulnerable to incorrect data conversion

> Remote attackers can execute arbitrary code, perform SQL injection, or bypass authentication in Ruby on Rails via unsafe YAML deserialization of JSON data.

- **Severity:** High 7.5 (`AV:N/AC:L/Au:N/C:P/I:P/A:P`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 30 Jan 2013
- **Updated:** 6 Aug 2024
- **Also known as:** DEBIAN-CVE-2013-0333, DSA-2613-1, GHSA-xgr2-v94m-rc9g, RHSA-2013:0202

## What is CVE-2013-0333?

CVE-2013-0333 is a high-severity unsafe deserialization vulnerability in Rubyonrails Rails, published on 30 Jan 2013. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

lib/active_support/json/backends/yaml.rb in Ruby on Rails 2.3.x before 2.3.16 and 3.0.x before 3.0.20 does not properly convert JSON data to YAML data for processing by a YAML parser, which allows remote attackers to execute arbitrary code, conduct SQL injection attacks, or bypass authentication via crafted data that triggers unsafe decoding, a different vulnerability than CVE-2013-0156.

## Which versions are affected by CVE-2013-0333?

4 open source packages ship an affected version, including activesupport. It affects 2 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `activesupport` | RubyGems | From 2.3.2 | 2.3.16 |
| `activesupport` | RubyGems | From 2.3.2 | 2.3.16 |
| `activesupport` | RubyGems | From 3.0.0 | 3.0.20 |
| `activesupport` | RubyGems | From 3.0.0 | 3.0.20 |
| `rubygem-activesupport` | Red Hat:openshift:1::el6 | All versions | 1:3.0.13-4.el6op |

Products: Rubyonrails Rails, Rubyonrails Ruby on Rails.

## How do I fix CVE-2013-0333?

Upgrade activesupport to a fixed version for your release line: 2.3.16 or 3.0.20.

## Is CVE-2013-0333 being exploited?

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

Public exploit code:

- https://github.com/heroku/heroku-CVE-2013-0333 (github_poc): https://github.com/heroku/heroku-CVE-2013-0333
- Ruby on Rails JSON Processor YAML Deserialization Code Execution (metasploit)
- Ruby on Rails - JSON Processor YAML Deserialization Code Execution (Metasploit) (exploitdb)
- Ruby on Rails JSON Processor YAML Deserialization Scanner (metasploit)

## Other vulnerabilities in Rubyonrails Rails

- [CVE-2013-0277](https://insights.sbomify.com/CVE-2013-0277/): Active Record contains deserialization of arbitrary YAML (critical 10.0)
- [CVE-2017-17916](https://insights.sbomify.com/CVE-2017-17916/): SQL injection in n/a (high 8.1)
- [CVE-2017-17917](https://insights.sbomify.com/CVE-2017-17917/): SQL injection in n/a (high 8.1)
- [CVE-2026-33195](https://insights.sbomify.com/CVE-2026-33195/): Rails Active Storage has possible Path Traversal in DiskService (high 8.0)
- [CVE-2024-26142](https://insights.sbomify.com/CVE-2024-26142/): Rails possible ReDoS vulnerability in Accept header parsing in Action Dispatch (high 7.5)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2013-0333 and fix it if it is affected.

What it is: CVE-2013-0333 is a high-severity unsafe deserialization vulnerability in Rubyonrails Rails, published on 30 Jan 2013. 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-2013-0333 exists.

Affected packages and fixed versions:
- activesupport (RubyGems): affected from 2.3.2; fixed in 2.3.16
- activesupport (RubyGems): affected from 2.3.2; fixed in 2.3.16
- activesupport (RubyGems): affected from 3.0.0; fixed in 3.0.20
- activesupport (RubyGems): affected from 3.0.0; fixed in 3.0.20

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-2013-0333/ (Markdown: https://insights.sbomify.com/CVE-2013-0333/index.md)
```

## Sources

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

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