Cyber Security News

Critical Salesforce Vulnerability Exposes Global Users to SOQL Injection Attacks

In June 2025, a security researcher uncovered a critical SOQL (Salesforce Object Query Language) injection vulnerability in a default Salesforce Aura controller, affecting potentially thousands of deployments and millions of user records.

The discovery highlights the risks of dynamic query construction and the importance of secure coding practices in enterprise cloud platforms.

Discovery and Exploitation

The researcher began by fuzzing Aura controllers—endpoints defined in Salesforce’s app.js file—using a custom parser and fuzzer to test various input mutations.

This approach quickly revealed a vulnerability in the built-in controller aura://CsvDataImportResourceFamilyController/ACTION$getCsvAutoMap.

This controller, present in all Salesforce deployments, accepted a contentDocumentId parameter that was unsafely embedded into a dynamic SOQL query, making it susceptible to injection attacks.

The vulnerability was spotted due to a specific error message:

json{
    "exceptionEvent": true,
    "useDefault": false,
    "event": {
        "descriptor": "markup://aura:serverActionError",
        "attributes": {
            "values": {
                "error": {
                    "message": "industries.impl.dataUtils.IndustriesDirectSoapUtil$DirectSoapException: MALFORMED_QUERY: \nContentVersion WHERE ContentDocumentId = '''\n                                          ^\nERROR at Row:1:Column:239\nunexpected token: '''",
                    "stackTrace": "",
                    "data": {
                        "message": "industries.impl.dataUtils.IndustriesDirectSoapUtil$DirectSoapException: MALFORMED_QUERY: \nContentVersion WHERE ContentDocumentId = '''\n                                          ^\nERROR at Row:1:Column:239\nunexpected token: '''",
                        "statusCode": 400,
                        "errorCode": "INTERNAL_ERROR"
                    },
                    "id": "-380442143"
                }
            }
        }
    }
}

This error indicated that user-supplied input was being directly inserted into a SOQL query, a classic sign of injection risk.

Bypassing SOQL Restrictions and Data Extraction

SOQL, while similar to SQL, imposes several limitations that make exploitation more challenging: no UNION-based attacks, limited subqueries, and strict constraints on joins and multi-query operations.

However, the researcher leveraged a response discrepancy technique—akin to error-based blind SQL injection—to infer data from the database.

For example, by sending a crafted contentDocumentId such as:

text069TP00000HbJbNYAV' AND OwnerId IN (SELECT Id FROM User WHERE Email LIKE 'a%25') AND ContentDocumentId != '

The researcher could determine whether a subquery matched by observing the response.

If the subquery was successful, a valid document was returned; otherwise, an error was generated.

This allowed for the systematic extraction of sensitive user and document information, even without direct access to other tables.

Additionally, by using scripts to generate valid contentDocumentId values—exploiting the predictable nature of Salesforce IDs—the researcher could brute-force and enumerate document details, including owner information, across the entire deployment.

Impact, Mitigation, and Key Takeaways

The vulnerability could have enabled attackers to extract sensitive data, such as user emails, names, addresses, and even password hashes, depending on the configuration.

The researcher reported the issue to Salesforce, which quietly patched the vulnerability without issuing an advisory or CVE, a practice sometimes adopted by large vendors to avoid drawing attention to security flaws.

To prevent SOQL injection, Salesforce and the broader Apex developer community recommend using static queries with binding variables instead of dynamic query construction.

For example, the following Apex code is vulnerable:

textString qryString = 'SELECT Id FROM Contact WHERE (IsDeleted = false and Name like \'%' + name + '%\')';
List<Contact> queryResult = Database.query(qryString);

Instead, developers should use:

textString qryString = 'SELECT Id FROM Contact WHERE IsDeleted = false and Name LIKE :name';
List<Contact> queryResult = Database.queryWithBinds(qryString, new Map<String,Object>{'name' => '%' + name + '%'});

This approach ensures that user input is not directly inserted into the query string, mitigating injection risks.

TechniqueDescriptionPrevention Method
Dynamic SOQLQuery built as string with user inputUse static queries with binds
Error-based InjectionExploit error messages to infer dataValidate and sanitize input
ID Brute-forcingGenerate predictable object IDs to access dataImplement rate limiting, logging

The incident underscores the importance of secure coding practices, input validation, and the need for ongoing security research in enterprise cloud environments.

Developers are urged to review their code for dynamic SOQL and adopt secure alternatives to protect sensitive data from exploitation.

To Upgrade Your Cybersecurity Skills, Take Diamond Membership With 150+ Practical Cybersecurity Courses Online – Enroll Here

Anupriya

Any Priya is a cybersecurity reporter at GBHackers On Security, specializing in cyber attacks, dark web monitoring, data breaches, vulnerabilities, and malware. She delivers in-depth analysis on emerging threats and digital security trends.

Recent Posts

Kali Linux 2025.2 Released: New Tools, Smartwatch and Car Hacking Added

Kali Linux, the preferred distribution for security professionals, has launched its second major release of…

6 hours ago

Arsen Launches AI-Powered Vishing Simulation to Help Organizations Combat Voice Phishing at Scale

Arsen, the cybersecurity startup known for defending organizations against social engineering threats, has announced the…

7 hours ago

NIST Releases New Guide – 19 Strategies for Building Zero Trust Architectures

The National Institute of Standards and Technology (NIST) has released groundbreaking guidance to help organizations…

8 hours ago

Spring Framework Flaw Enables Remote File Disclosure via “Content‑Disposition” Header

A medium-severity reflected file download (RFD) vulnerability (CVE-2025-41234) in VMware's Spring Framework has been patched,…

8 hours ago

Microsoft Defender Spoofing Flaw Enables Privilege Escalation and AD Access

A newly disclosed spoofing vulnerability (CVE-2025-26685) in Microsoft Defender for Identity (MDI) enables unauthenticated attackers…

9 hours ago

Amazon Cloud Cam Flaw Allows Attackers to Intercept and Modify Network Traffic

A critical vulnerability (CVE-2025-6031) has been identified in Amazon Cloud Cam devices, which reached end-of-life…

9 hours ago