Summary
Microsoft Dynamics 365 Customer Engagement (on‑premises) allows privileged users to upload custom RDL (Report Definition Language) files that can embed raw SQL queries, which are then executed by SQL Server Reporting Services (SSRS).
If an attacker can upload or otherwise cause execution of a malicious RDL, they can run arbitrary SQL commands against the Dynamics database, and potentially access linked servers or execute OS commands depending on the SSRS service account privileges.
Affected context
The issue occurs in on‑premises deployments of Microsoft Dynamics 365 Customer Engagement where:
- SQL Server Reporting Services (SSRS) is used to process user‑supplied RDL reports.
- Users or integrations have the Add Reporting Services Reports privilege, or can otherwise execute already‑uploaded RDLs.
- The reporting infrastructure allows reports that contain raw SQL queries against the Dynamics database or other accessible data sources.
In such environments, the RDL upload and execution pipeline acts as a data access layer that may not sufficiently restrict or sanitize embedded SQL, making the reporting surface an extension of the database attack surface.
Exploit preconditions
- Attack surface: The Dynamics 365 on‑premises reporting feature and its integration with SSRS.
- Required access:
- An authenticated account with the Add Reporting Services Reports privilege to upload a malicious RDL; or
- Any user who can trigger execution of a previously uploaded malicious RDL report.
- Trigger point: Generation or viewing of the malicious report through Dynamics 365 or directly via SSRS, causing SSRS to execute the embedded SQL.
- Why exploitation is possible: The reporting pipeline allows RDL files to specify raw SQL queries that SSRS executes under the security context of its service account, without enforcing strict query whitelisting, parameterization, or confinement to safe, predefined data sets.
Why this happens
This vulnerability stems from allowing user‑controlled report definitions (RDL files) to contain raw SQL statements that are executed directly by SSRS. Rather than constraining reports to predefined, parameterized queries or vetted data sets, the system accepts arbitrary SQL embedded in RDL, effectively treating user‑supplied configuration as trusted executable database logic.
This design aligns with CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), in which an attacker can influence the structure or intent of SQL commands. Here, the injection vector is not a single text field but an entire report definition file, whose contents can define or alter database queries executed with the privileges of the SSRS service account.
Potential impact
- Reading sensitive business data from the Dynamics 365 database that the attacker's own user account might not be allowed to access.
- Modifying, inserting, or deleting records in the Dynamics database, potentially leading to data corruption, fraud, or loss of integrity.
- Leveraging elevated privileges of the SSRS service account to:
- Access linked servers and remote databases.
- Execute stored procedures or extended procedures that can affect system configuration or security posture.
- Potential execution of operating system commands via the database engine (e.g., through unsafe extended stored procedures or integrations) if permitted by the SQL Server configuration and service account rights.
- Establishing a persistent foothold in the environment by creating backdoor accounts, scheduled jobs, or malicious procedures at the database level.
General mitigation guidance
Effective mitigation focuses on tightening how reports are defined, uploaded, and executed, and on reducing the power of the execution context:
- Constrain report capabilities:
- Prefer report designs that use predefined, parameterized datasets or stored procedures instead of allowing arbitrary SQL in RDL files.
- Introduce validation policies or approval workflows for new or modified RDLs, ensuring reports are reviewed before being made broadly executable.
- Harden privileges and boundaries:
- Configure the SSRS service account with the least database and operating system privileges required for reporting.
- Restrict access to linked servers and high‑risk extended procedures from the SSRS context.
- Segment reporting data sources so that SSRS connects to controlled views or reporting schemas rather than directly to the full application database when possible.
- Reduce trust in uploaded artifacts:
- Treat RDL files as untrusted input and enforce controls such as:
- Allow‑listing of allowed query patterns or data sources.
- Disallowing dangerous commands (e.g., data definition/manipulation outside reporting needs) at the database policy level.
- Limit which roles can upload or manage reports, and separate the roles that upload reports from those that approve or publish them to production.
- Operational safeguards:
- Monitor and log report executions, especially those that access sensitive tables or run unusually long or complex queries.
- Regularly review the set of deployed reports and retire or sandbox those that are no longer needed or appear risky.
How teams detect issues like this
Organizations can detect and monitor this class of issue via a combination of code/configuration review and runtime monitoring:
- Static and configuration analysis:
- Scan RDL files for:
- Direct inclusion of raw SQL text rather than references to predefined datasets.
- Use of privileged operations such as DDL, DML, or access to high‑sensitivity tables.
- Apply rules in configuration scanning tools or code review checklists that flag:
- Reports not based on stored procedures or restricted views.
- RDLs referencing non‑approved data sources or linked servers.
- Database‑level monitoring:
- Enable query auditing to detect SQL statements originating from the SSRS service account that:
- Perform non‑reporting operations (INSERT, UPDATE, DELETE, ALTER, EXEC on sensitive procedures).
- Access atypical schemas or linked servers.
- Create alerts for anomalous behavior such as unusual report‑driven access patterns or spikes in report‑related database activity.
- Policy enforcement and CI integration:
- Integrate automated checks into report deployment pipelines to enforce policies (e.g., no ad‑hoc SQL, only approved datasets).
- Periodically review privileges associated with reporting roles and the SSRS service account to ensure they comply with least‑privilege policies.
Automated configuration and static analysis tools can assist by routinely scanning RDL repositories and deployment packages for disallowed patterns or unsafe report definitions.

