The SentinelOne Annual Threat Report - A Defenders Guide from the FrontlinesThe SentinelOne Annual Threat ReportGet the Report
Experiencing a Breach?Blog
Get StartedContact Us
SentinelOne
  • Platform
    Platform Overview
    • Singularity Platform
      Welcome to Integrated Enterprise Security
    • AI for Security
      Leading the Way in AI-Powered Security Solutions
    • Securing AI
      Accelerate AI Adoption with Secure AI Tools, Apps, and Agents.
    • How It Works
      The Singularity XDR Difference
    • Singularity Marketplace
      One-Click Integrations to Unlock the Power of XDR
    • Pricing & Packaging
      Comparisons and Guidance at a Glance
    Data & AI
    • Purple AI
      Accelerate SecOps with Generative AI
    • Singularity Hyperautomation
      Easily Automate Security Processes
    • AI-SIEM
      The AI SIEM for the Autonomous SOC
    • Singularity Data Lake
      AI-Powered, Unified Data Lake
    • Singularity Data Lake for Log Analytics
      Seamlessly Ingest Data from On-Prem, Cloud or Hybrid Environments
    Endpoint Security
    • Singularity Endpoint
      Autonomous Prevention, Detection, and Response
    • Singularity XDR
      Native & Open Protection, Detection, and Response
    • Singularity RemoteOps Forensics
      Orchestrate Forensics at Scale
    • Singularity Threat Intelligence
      Comprehensive Adversary Intelligence
    • Singularity Vulnerability Management
      Application & OS Vulnerability Management
    • Singularity Identity
      Identity Threat Detection and Response
    Cloud Security
    • Singularity Cloud Security
      Block Attacks with an AI-Powered CNAPP
    • Singularity Cloud Native Security
      Secure Cloud and Development Resources
    • Singularity Cloud Workload Security
      Real-Time Cloud Workload Protection Platform
    • Singularity Cloud Data Security
      AI-Powered Threat Detection for Cloud Storage
    • Singularity Cloud Security Posture Management
      Detect and Remediate Cloud Misconfigurations
    Securing AI
    • Prompt Security
      Secure AI Tools Across Your Enterprise
  • Why SentinelOne?
    Why SentinelOne?
    • Why SentinelOne?
      Cybersecurity Built for What’s Next
    • Our Customers
      Trusted by the World’s Leading Enterprises
    • Industry Recognition
      Tested and Proven by the Experts
    • About Us
      The Industry Leader in Autonomous Cybersecurity
    Compare SentinelOne
    • Arctic Wolf
    • Broadcom
    • CrowdStrike
    • Cybereason
    • Microsoft
    • Palo Alto Networks
    • Sophos
    • Splunk
    • Trellix
    • Trend Micro
    • Wiz
    Verticals
    • Energy
    • Federal Government
    • Finance
    • Healthcare
    • Higher Education
    • K-12 Education
    • Manufacturing
    • Retail
    • State and Local Government
  • Services
    Managed Services
    • Managed Services Overview
      Wayfinder Threat Detection & Response
    • Threat Hunting
      World-Class Expertise and Threat Intelligence
    • Managed Detection & Response
      24/7/365 Expert MDR Across Your Entire Environment
    • Incident Readiness & Response
      DFIR, Breach Readiness, & Compromise Assessments
    Support, Deployment, & Health
    • Technical Account Management
      Customer Success with Personalized Service
    • SentinelOne GO
      Guided Onboarding & Deployment Advisory
    • SentinelOne University
      Live and On-Demand Training
    • Services Overview
      Comprehensive Solutions for Seamless Security Operations
    • SentinelOne Community
      Community Login
  • Partners
    Our Network
    • MSSP Partners
      Succeed Faster with SentinelOne
    • Singularity Marketplace
      Extend the Power of S1 Technology
    • Cyber Risk Partners
      Enlist Pro Response and Advisory Teams
    • Technology Alliances
      Integrated, Enterprise-Scale Solutions
    • SentinelOne for AWS
      Hosted in AWS Regions Around the World
    • Channel Partners
      Deliver the Right Solutions, Together
    • SentinelOne for Google Cloud
      Unified, Autonomous Security Giving Defenders the Advantage at Global Scale
    • Partner Locator
      Your Go-to Source for Our Top Partners in Your Region
    Partner Portal→
  • Resources
    Resource Center
    • Case Studies
    • Data Sheets
    • eBooks
    • Reports
    • Videos
    • Webinars
    • Whitepapers
    • Events
    View All Resources→
    Blog
    • Feature Spotlight
    • For CISO/CIO
    • From the Front Lines
    • Identity
    • Cloud
    • macOS
    • SentinelOne Blog
    Blog→
    Tech Resources
    • SentinelLABS
    • Ransomware Anthology
    • Cybersecurity 101
  • About
    About SentinelOne
    • About SentinelOne
      The Industry Leader in Cybersecurity
    • Investor Relations
      Financial Information & Events
    • SentinelLABS
      Threat Research for the Modern Threat Hunter
    • Careers
      The Latest Job Opportunities
    • Press & News
      Company Announcements
    • Cybersecurity Blog
      The Latest Cybersecurity Threats, News, & More
    • FAQ
      Get Answers to Our Most Frequently Asked Questions
    • DataSet
      The Live Data Platform
    • S Foundation
      Securing a Safer Future for All
    • S Ventures
      Investing in the Next Generation of Security, Data and AI
  • Pricing
Get StartedContact Us
CVE Vulnerability Database
Vulnerability Database/CVE-2022-33171

CVE-2022-33171: TypeORM findOne SQL Injection Vulnerability

CVE-2022-33171 is a SQL injection flaw in TypeORM's findOne function affecting versions before 0.3.0. Attackers can exploit crafted JSON objects to inject malicious SQL. This article covers technical details, affected versions, impact, and mitigation strategies.

Published: February 18, 2026

CVE-2022-33171 Overview

CVE-2022-33171 is a SQL Injection vulnerability in TypeORM, a popular Object-Relational Mapping (ORM) library for Node.js applications. The vulnerability exists in the findOne function, which can accept either a string (ID) or a FindOneOptions object as input. When user-controlled JSON input is parsed and passed directly to the findOne function without proper validation, attackers can craft malicious FindOneOptions objects to inject arbitrary SQL queries.

This vulnerability is particularly dangerous in modern web applications that use TypeORM as their database abstraction layer, as it can allow attackers to bypass authentication, extract sensitive data, modify database contents, or potentially gain further access to backend systems.

Critical Impact

Attackers can execute arbitrary SQL queries against the application's database by supplying crafted JSON objects to the findOne function, potentially leading to data exfiltration, authentication bypass, and database manipulation.

Affected Products

  • TypeORM versions before 0.3.0 for Node.js

Discovery Timeline

  • 2022-07-04 - CVE-2022-33171 published to NVD
  • 2024-11-21 - Last updated in NVD database

Technical Details for CVE-2022-33171

Vulnerability Analysis

The vulnerability stems from TypeORM's findOne function design, which accepts polymorphic input—either a simple string identifier or a complex FindOneOptions object. This flexibility becomes a security liability when applications pass user-controlled parsed JSON directly to the function without validating the input type.

When an application expects a simple ID string but receives a crafted FindOneOptions object containing malicious where clauses or other options, TypeORM processes these as legitimate query parameters. This allows attackers to manipulate the generated SQL query in unintended ways, including injecting SQL fragments through carefully constructed option properties.

The vulnerability is classified under CWE-89 (SQL Injection), representing a failure to properly neutralize special elements used in SQL commands. The attack is network-accessible, requires no authentication, and can be executed without user interaction, making it highly exploitable in internet-facing applications.

Note: The vendor's position is that the application is responsible for input validation, placing the burden of security on developers using the library.

Root Cause

The root cause is the lack of type enforcement in the findOne function's input parameter handling. TypeORM accepts both primitive strings and complex objects as valid inputs, and when combined with automatic JSON parsing of user input (common in Express.js and similar frameworks), attackers can substitute a string ID with a malicious object structure that manipulates query behavior.

Attack Vector

The attack exploits the network-accessible nature of web applications using TypeORM. An attacker sends a crafted HTTP request containing a JSON payload where a simple ID parameter is replaced with a complex object. When the application parses this JSON and passes it to findOne, TypeORM interprets the object as query options rather than a simple identifier, executing the attacker-controlled query parameters against the database.

For example, where an application expects { "id": "123" }, an attacker might send { "id": { "where": { "username": "admin" } } } or more complex injection payloads that manipulate the query behavior. The exact exploitation technique involves crafting FindOneOptions objects with malicious where clauses, select properties, or other TypeORM query options.

Technical details of the exploitation technique can be found in the Full Disclosure security advisory and the Packet Storm information disclosure report.

Detection Methods for CVE-2022-33171

Indicators of Compromise

  • Unusual or malformed JSON objects in request parameters where simple identifiers are expected
  • Database query logs showing unexpected WHERE clauses or query structures
  • Authentication bypass attempts or unauthorized data access patterns
  • Anomalous SQL query patterns that don't match expected application behavior

Detection Strategies

  • Implement input validation logging to detect when object types are received where primitives are expected
  • Monitor database query logs for SQL injection patterns and unexpected query structures
  • Deploy Web Application Firewalls (WAF) with rules to detect complex JSON injection attempts
  • Use application-level logging to track findOne function calls with suspicious parameter types

Monitoring Recommendations

  • Enable verbose TypeORM query logging in staging/development environments to understand query patterns
  • Implement runtime type checking alerts for API endpoints that use TypeORM queries
  • Monitor for increased database errors that may indicate injection attempts
  • Set up alerts for unusual database access patterns such as bulk data retrieval or schema queries

How to Mitigate CVE-2022-33171

Immediate Actions Required

  • Upgrade TypeORM to version 0.3.0 or later where the API has been modified
  • Audit all code paths where user input flows to findOne and similar TypeORM functions
  • Implement strict input validation to ensure expected types before passing data to TypeORM
  • Add type guards or schema validation using libraries like Zod, Joi, or class-validator

Patch Information

TypeORM version 0.3.0 includes changes that address this vulnerability. The version comparison showing the relevant changes can be found at the GitHub TypeORM Version Comparison. Upgrading to TypeORM 0.3.0 or later is the recommended remediation.

Workarounds

  • Validate that the input to findOne is explicitly a primitive string or number before calling the function
  • Use findOneBy method instead of findOne where possible, as it has stricter input requirements
  • Implement a validation layer using TypeScript type guards to enforce input types at runtime
  • Wrap TypeORM calls in a service layer that explicitly validates and sanitizes all input parameters
bash
# Example: Upgrade TypeORM to patched version
npm update typeorm@^0.3.0
# Or with yarn
yarn upgrade typeorm@^0.3.0

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

  • Vulnerability Details
  • TypeSQLI

  • Vendor/TechTypeorm

  • SeverityCRITICAL

  • CVSS Score9.8

  • EPSS Probability5.99%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityNone
  • AvailabilityHigh
  • CWE References
  • CWE-89
  • Technical References
  • Packet Storm Information Disclosure

  • Full Disclosure August 2022

  • GitHub TypeORM Version Comparison

  • Full Disclosure June 2022
  • Related CVEs
  • CVE-2025-32020: crud-query-parser SQL Injection Flaw
Experience the World’s Most Advanced Cybersecurity Platform

Experience the World’s Most Advanced Cybersecurity Platform

See how our intelligent, autonomous cybersecurity platform can protect your organization now and into the future.

Try SentinelOne
  • Get Started
  • Get a Demo
  • Product Tour
  • Why SentinelOne
  • Pricing & Packaging
  • FAQ
  • Contact
  • Contact Us
  • Customer Support
  • SentinelOne Status
  • Language
  • Platform
  • Singularity Platform
  • Singularity Endpoint
  • Singularity Cloud
  • Singularity AI-SIEM
  • Singularity Identity
  • Singularity Marketplace
  • Purple AI
  • Services
  • Wayfinder TDR
  • SentinelOne GO
  • Technical Account Management
  • Support Services
  • Verticals
  • Energy
  • Federal Government
  • Finance
  • Healthcare
  • Higher Education
  • K-12 Education
  • Manufacturing
  • Retail
  • State and Local Government
  • Cybersecurity for SMB
  • Resources
  • Blog
  • Labs
  • Case Studies
  • Videos
  • Product Tours
  • Events
  • Cybersecurity 101
  • eBooks
  • Webinars
  • Whitepapers
  • Press
  • News
  • Ransomware Anthology
  • Company
  • About Us
  • Our Customers
  • Careers
  • Partners
  • Legal & Compliance
  • Security & Compliance
  • Investor Relations
  • S Foundation
  • S Ventures

©2026 SentinelOne, All Rights Reserved.

Privacy Notice Terms of Use

English