SharePoint: Microsoft SharePoint code injection and privilege escalation (CVE-2025-49704) #shorts

Summary

Welcome to our security podcast. In this episode, we cover CVE-2025-49704, a recently disclosed code injection vulnerability in Microsoft SharePoint that allows an authenticated attacker to execute arbitrary code over the network and potentially escalate privileges.

Product details

This flaw affects on-premise installations of Microsoft SharePoint Enterprise Server 2016 (versions before 16.0.5508.1000) and SharePoint Server 2019 (versions before 16.0.10417.20027). These editions are commonly used in enterprise intranet and collaboration environments.

Vulnerability type summary

CVE-2025-49704 is classified under CWE-94: Improper Control of Generation of Code, also known as code injection. This vulnerability arises when unsanitized input influences internal code paths, enabling attackers to inject and execute malicious code.

Details of the vulnerability

An authorized user with valid SharePoint credentials can exploit the vulnerability by sending specially crafted requests that abuse the server’s code generation routines. The injection point resides in data fields not properly validated before being compiled or interpreted. Exploitation can lead to remote code execution, privilege escalation, data exfiltration, and full system compromise. Microsoft published a patch on July 8, 2025, with updates through early August. The US CISA has also highlighted this and related SharePoint flaws (CVE-2025-49706, CVE-2025-53770, CVE-2025-53771) as part of ongoing threat activity against enterprise collaboration platforms.

Conclusion

If you run SharePoint Enterprise Server 2016 or Server 2019 on-premise, apply Microsoft’s July 2025 security updates immediately to remediate CVE-2025-49704. Review administrator privileges, enforce least-privilege access, monitor logs for suspicious requests, and maintain a robust patch management process to guard against future code injection attacks.

Watch the full video on YouTube: CVE-2025-49704

Remediation and exploitation details

This chain involves the following actors

  • Authorized attacker: low-privilege user or compromised account
  • System administrator: infrastructure manager responsible for patching

This following systems are involved

  • SharePoint Enterprise Server 2016 (collaboration and document management): host for web parts, pages and file repositories
  • SharePoint Server 2019 (collaboration and document management): host for web parts, pages and file repositories

Attack entry point

  • code injection vector: improper filtering of user-supplied script or web part markup during page generation

Remediation actions

System administrator
apply Microsoft security update
SharePoint Enterprise Server 2016 (< 16.0.5508.1000)
System administrator
apply Microsoft security update
SharePoint Server 2019 (< 16.0.10417.20027)

Exploitation actions

upload injection payload via web interface or application programming interface

Authorized attacker
craft malicious web part or page template containing executable code
SharePoint Server
Examples:
  • Create a custom .aspx page that embeds PowerShell commands

access the crafted URL over HTTP to invoke server-side rendering

Authorized attacker
trigger the injected code by requesting the malicious page
SharePoint Server
Examples:
  • Navigate to https://victim/_layouts/15/malicious.aspx to execute the payload

use the injected script to open an outbound connection

Authorized attacker
establish a network callback to attacker infrastructure
SharePoint Server
Examples:
  • Invoke PowerShell Invoke-WebRequest to fetch a second-stage binary

abuse unpatched service configuration to run code as a higher-privilege account

Authorized attacker
escalate privileges on the host
SharePoint Server
Examples:
  • Hijack a Windows service to execute the payload as Local System

Related Content

NOTE: The following related content has not been vetted and may be unsafe.

CVE database technical details

CVE ID
CVE-2025-49704
Description
Improper control of generation of code ('code injection') in Microsoft Office SharePoint allows an authorized attacker to execute code over a network.
Provider
microsoft
CWE / problem types
CWE-94: Improper Control of Generation of Code ('Code Injection')
Affected Software Versions
Microsoft:Microsoft SharePoint Enterprise Server 2016:[{'version': '16.0.0', 'lessThan': '16.0.5508.1000', 'versionType': 'custom', 'status': 'affected'}],Microsoft:Microsoft SharePoint Server 2019:[{'version': '16.0.0', 'lessThan': '16.0.10417.20027', 'versionType': 'custom', 'status': 'affected'}]
Date Published
2025-07-08T16:58:05.908Z
Last Updated
2025-08-05T18:12:42.017Z