CVE-2020-7637: Prototype Pollution in class-transformer

class-transformer Updated 02 Oct 2025

Summary

07/04/2020
Yes i
Moderate
5.3

CVE-2020-7637: Prototype pollution in class-transformer. Affects class-transformer versions < 0.3.1. Fixed in 0.3.1. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

class-transformer is an npm package that provides decorators and functions for transforming plain objects to class instances and vice versa. It is commonly used in JavaScript and TypeScript projects to simplify object manipulation and serialization. Unfortunately, versions up to 0.2.3 of class-transformer are vulnerable to Prototype Pollution.

Vulnerability Detail

The vulnerability in class-transformer arises from the 'classToPlainFromExist' function, which can be tricked into adding or modifying properties of 'Object.prototype' using a 'proto' payload. This allows an attacker to pollute the prototype of all objects in the application, potentially leading to unexpected behavior or security issues.

How To Fix

Minimum fixed version

0.3.1

This is the first release that contains the fix.

npm install class-transformer@0.3.1

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If you are unable to update to the latest version of class-transformer, a possible workaround is to avoid using the 'classToPlainFromExist' function. Instead, consider using alternative methods provided by the package or implementing custom serialization logic.

Conclusion

In conclusion, class-transformer versions up to 0.2.3 are vulnerable to Prototype Pollution. It is crucial to update to version 0.3.1 or later to fix this issue. If updating is not possible, consider using alternative methods or implementing custom serialization logic. For further assistance or support in vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for class-transformer →

Share this vulnerability

FAQ

Prototype Pollution is a vulnerability that occurs when an attacker can modify the prototype of an object, allowing them to add or modify properties that affect all instances of that object.

'classToPlainFromExist' is a function provided by class-transformer that converts a class instance to a plain object, while also preserving existing properties of the target object.

'proto' is a special property in JavaScript that allows direct manipulation of an object's prototype. By setting 'proto' to a malicious value, an attacker can pollute the prototype chain.

The consequences of this vulnerability depend on how the affected package is used in the application. It could lead to unexpected behavior, security vulnerabilities, or enable an attacker to execute arbitrary code.

At the time of this report, there are no known public exploits for this vulnerability. However, it is important to update to the latest version to mitigate any potential risks.

How To Fix

Minimum fixed version

0.3.1

This is the first release that contains the fix.

npm install class-transformer@0.3.1

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback