Change a Workflow to a Shell: Flow2Shell SharePoint Pre-Auth RCE Chain
Chumy Tsai (Security Researcher · CyCraft Technology), Katherine Chen (Microsoft)
BlueHat Asia 2026 · Day 2 · Main Stage
Overview
This talk, "Change a Workflow to a Shell: Flow2Shell SharePoint Pre-Auth RCE Chain," presented by security researcher Chumy Tsai from CyCraft Technology and Katherine Chen from Microsoft's Security Response Center (MSRC), details a sophisticated, unauthenticated remote code execution (RCE) vulnerability chain discovered in SharePoint. The presentation dissects a multi-stage exploit that leverages a variant of a previously known JWT authentication bypass, combines it with an ingenious impersonation technique, and culminates in a complex series of bypasses against SharePoint's workflow engine mitigations to achieve arbitrary code execution as an unauthenticated attacker.

Key moments
- 0:00 Introduction to MSRC and talk overview
- 4:20 JWT authorization bypass vulnerability background
- 7:55 Achieving user impersonation via SS token
- 10:00 Introduction to SharePoint workflows and structure
- 13:10 Overview of four workflow mitigation checks
- 16:40 Bypassing rule validation: precompile vs. runtime
- 22:00 Live demo of SharePoint remote code execution
- 22:40 Pwn2Own rejection and MSRC bounty story
Change a Workflow to a Shell: Flow2Shell SharePoint Pre-Auth RCE Chain
Speakers: Chumy Tsai (Security Researcher, CyCraft Technology); Katherine Chen (Microsoft)
Conference: BlueHat Asia
YouTube: https://www.youtube.com/watch?v=hZYcAcodWGQ
Overview
This talk, "Change a Workflow to a Shell: Flow2Shell SharePoint Pre-Auth RCE Chain," presented by security researcher Chumy Tsai from CyCraft Technology and Katherine Chen from Microsoft's Security Response Center (MSRC), details a sophisticated, unauthenticated remote code execution (RCE) vulnerability chain discovered in SharePoint. The presentation dissects a multi-stage exploit that leverages a variant of a previously known JWT authentication bypass, combines it with an ingenious impersonation technique, and culminates in a complex series of bypasses against SharePoint's workflow engine mitigations to achieve arbitrary code execution as an unauthenticated attacker.
The significance of this research lies not only in the critical impact of unauthenticated RCE on a widely used enterprise platform like SharePoint but also in the intricate nature of the exploit chain. It demonstrates a deep understanding of SharePoint's internal mechanisms, from its authentication protocols to its workflow execution engine. Katherine Chen's opening remarks from MSRC highlight the rarity and immense value of such "full end-to-end exploits," which drastically accelerate the vulnerability assessment and patching process for Microsoft due to their comprehensive demonstration of impact.
Chumy Tsai's methodology, involving variant hunting on an older bug and meticulously dissecting multiple layers of defense, provides invaluable insights for both offensive and defensive security practitioners. The "Flow2Shell" chain is a testament to the persistent effort required to identify and exploit such complex vulnerabilities, ultimately leading to a critical security fix and a substantial bounty award, underscoring the importance of researcher contributions to global software security.
Background
▶ Watch: Introduction to MSRC and talk overview (0:00)
SharePoint, as a cornerstone of many enterprise environments, frequently processes sensitive data and manages critical business operations. Its extensive feature set, including document management, collaboration tools, and custom workflows, also presents a broad attack surface. Authentication and authorization mechanisms, particularly those involving JSON Web Tokens (JWTs), are critical components, and any bypasses in these areas can have severe consequences.
The genesis of this research traces back to a JWT authentication bypass vulnerability discovered by StarLab in 2023. This prior vulnerability exploited the fact that SharePoint, under certain configurations, did not strictly enforce signed tokens, allowing attackers to use the none algorithm to bypass signature validation. While this specific flaw was eventually mitigated, Chumy Tsai's work demonstrates that the underlying complexity of SharePoint's JWT processing continued to harbor related weaknesses. The challenge lay in finding a new path to bypass signature validation, especially after Microsoft had implemented what they believed to be a fix, albeit one that Chumy later discovered was itself flawed (an "invalid key bug" used to fix another bug).
Beyond authentication, SharePoint's workflow engine serves as a powerful automation tool, allowing users to define custom actions triggered by various events. These workflows, often expressed in XML-based formats like XAML and rule files, are essentially a form of deserialization, executing user-defined logic. Such systems are inherently prone to deserialization vulnerabilities if not rigorously secured. SharePoint's developers implemented a series of four layered mitigations—element/value validation, pre-compile rule validation, DLL type reference checking, and runtime rule validation—specifically designed to prevent malicious code execution through workflows. The existence of these multiple, independent checks highlights the perceived risk of the workflow engine and the significant effort put into securing it, making Chumy's successful bypass of all four layers a remarkable achievement.
From the perspective of the Microsoft Security Response Center (MSRC), as explained by Katherine Chen, most vulnerability submissions are "single bugs" (e.g., a use-after-free or out-of-bounds write). While valuable, these require MSRC's Vulnerabilities and Mitigations (VnM) team to conduct further research to understand the full exploitability and potential impact. In contrast, a full end-to-end exploit chain, like the one developed by Chumy, provides immediate clarity on the severity (often critical) and expedites the entire fix development and deployment process. The MSRC timeline for this case — escalating to critical within hours, finding variants the same day, and finalizing a fix within two days — underscores the immense efficiency gains provided by such detailed and complete submissions.
Key Findings
▶ Watch: Achieving user impersonation via SS token (7:55)
Chumy Tsai's research culminated in the discovery of Flow2Shell, an unauthenticated remote code execution (RCE) chain targeting SharePoint. This sophisticated exploit chain consists of two primary stages, each involving multiple, intricate bypasses of SharePoint's security mechanisms.
The first key finding was a novel authorization bypass vulnerability in SharePoint's JWT authentication, building upon and circumventing previous mitigations for a 2023 StarLab bug. Chumy discovered that by simply omitting the ver key from the JWT, SharePoint's signature validation logic could be bypassed entirely. Furthermore, a critical flaw was identified in how SharePoint validates actor tokens (JWTs nested within the main JWT). Instead of performing full signature validation on the inner token, SharePoint would find the correct certificate but then skip the signature validation step, proceeding directly to validate the issuer. This allowed an attacker to leak valid issuer and certificate information and then craft a malicious actor token that would be accepted. This led to an impersonation vulnerability where, by setting the name ID issuer to SS token and adding a name key to treat the JWT as an application token, an attacker could impersonate any user, including a site administrator.
The second key finding involved a series of four sequential bypasses against SharePoint's layered workflow validation mechanisms, transforming the ability to create a workflow into arbitrary code execution. These bypasses are:
- Value Validation Bypass: SharePoint's
GetTypefunction, used to validate types in XML elements, only recognizes assembly-qualified names. By providing only a simple type name (e.g.,System.String),GetTypereturnsnull, causing SharePoint to treat the value as an ordinary string and bypass the type check. - Pre-compile Rule Validation Bypass: SharePoint performs a validation check during the workflow's pre-compilation stage. Chumy exploited a logical flaw by using a
set variable activityto dynamically override arule condition reference. During pre-compile, theset variable activityis skipped, and a "safe rule" is checked. However, at runtime, theset variable activityexecutes first, replacing the reference with an "evil rule" before the actual execution. - Runtime Rule Validation Bypass: Despite the pre-compile bypass, SharePoint performs another rule validation at runtime. Chumy discovered that the runtime validation uses a different constructor for the rule, one where the
stated typeflag defaults tofalse. This effectively disabled the type validation function at runtime, allowing the "evil rule" to execute without checks. - DLL Type Reference Check Bypass: After compilation, SharePoint checks if the generated DLL references any unauthorized types. While malicious C# expressions would initially fail this check (due to reliance on
CodeExpressionwhich is not allowed), Chumy found that SharePoint still loads the DLL into the process before throwing the error. Consequently, if the same workflow is executed a second time, the assembly is already cached and loaded. SharePoint's workflow lifecycle then hits the cache, completely skipping the compilation and the DLL type reference check, and directly executes the malicious DLL.
The culmination of these findings is a complete, unauthenticated RCE chain, enabling an attacker to gain a reverse shell on the SharePoint server. This complex vulnerability was immediately escalated to critical by MSRC and led to a rapid fix, demonstrating the profound impact and ingenuity of the research.
Technical Deep Dive
▶ Watch: Overview of four workflow mitigation checks (13:10)
The Flow2Shell vulnerability chain is a masterclass in exploiting subtle logical flaws and interaction issues across multiple security layers within SharePoint. It begins with an unauthenticated authorization bypass and escalates to remote code execution via the workflow engine.
Stage 1: JWT Authorization Bypass and Impersonation
The initial vector targets SharePoint's JWT authentication mechanism. Chumy's investigation started by re-examining a 2023 StarLab vulnerability where SharePoint would accept JWTs signed with the none algorithm if required signed tokens was disabled. While this specific issue was patched, Chumy found that the fix itself introduced an "invalid key bug."
The first significant discovery was related to the ver key in the JWT. SharePoint's validation logic was found to perform signature validation only if the ver key was present. By simply omitting the ver key from the JWT, the entire signature validation step was bypassed, allowing an attacker to craft arbitrary, unsigned JWTs that SharePoint would accept as legitimate.
Next, Chumy focused on the actor token feature. A JWT can contain an actor token key, which holds another nested JWT. Under normal circumstances, SharePoint should validate the signature of this inner JWT. However, Chumy found a critical flaw: SharePoint would locate the correct certificate for the inner JWT but then skip the signature validation, proceeding directly to validate if the issuer matched. This meant that an attacker could leak a valid issuer and certificate (e.g., from a legitimate SharePoint token), and then craft an inner JWT with this valid issuer and an arbitrary name ID, which SharePoint would accept.
This led to the impersonation phase. SharePoint's user validation function maps JWT user information (like UPN or Windows SID) to user identities. However, when the name ID issuer in the JWT is set to SS token, SharePoint uses a different function that takes the name ID directly as the user identity. This would allow impersonation of any user. Initially, this was blocked because SS token is not a valid name ID issuer for cache lookups, causing a crash. The bypass for this involved adding a name key to the main JWT, which makes SharePoint treat it as an application token. Application tokens bypass the cached token step, allowing the SS token impersonation to proceed successfully. With this, an unauthenticated attacker could impersonate any user, including a site administrator, by simply supplying their username in the name ID field. After successful impersonation, standard SharePoint APIs could then be used to retrieve the actual site administrator's username if it wasn't already known.
Stage 2: Flow2Shell — Workflow Engine RCE
With administrator-level access (via impersonation), the next stage was to leverage SharePoint's workflow engine for remote code execution. SharePoint workflows are automation scripts defined by an XML file (XAML) and a rule file, which essentially contain C# statements. This process is akin to deserialization, a common source of RCE vulnerabilities. SharePoint had implemented four distinct mitigations to prevent malicious code execution through workflows:
- Element and Value Validation: Checks if types referenced in the XAML are allowed.
- Rule Validation (Pre-compile): Checks types and methods used in the rule file during compilation.
- DLL Type Reference Check: Inspects the compiled DLL for references to unauthorized types.
- Rule Validation (Runtime): Re-validates rules during actual execution.
Chumy systematically bypassed each of these mitigations:
Bypass 1: Value Validation
SharePoint uses GetType to determine the type of values in the XAML. If GetType returns null, the value is treated as an ordinary string, bypassing type validation. GetType only recognizes assembly-qualified names (e.g., System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089). By providing only a simple type name (e.g., System.String), GetType returns null, allowing an attacker to define variables with arbitrary, unvalidated type names. This was achieved using gadgets like workflow data file and set variable activity.
Bypass 2 & 4: Pre-compile and Runtime Rule Validation
These two validations operate on the rule file (.rules extension), which contains C# expressions. Chumy found a logic flaw leveraging the set variable activity and rule condition reference gadgets.
- Pre-compile Bypass: The XAML was crafted such that a
rule condition referenceinitially pointed to a "safe rule." However, aset variable activitywas placed before it to override this reference to an "evil rule." During the pre-compile stage, SharePoint does not actually execute workflow activities likeset variable activity. Therefore, only thesafe rulewas checked, passing validation. - Runtime Bypass: When the workflow actually executes, the
set variable activityruns first, successfully replacing the reference with theevil rule. While SharePoint performs another validation at runtime, Chumy discovered that the constructor used for this runtime validation leaves thestated typeparameter at its defaultfalsevalue. This effectively disables the type validation function at runtime, allowing theevil rule(containing malicious C# code) to execute unchecked.
Bypass 3: DLL Type Reference Check
After the XAML is converted to C# code and compiled into a DLL, SharePoint performs a DLL type reference check to ensure the compiled assembly does not reference any unauthorized types. The challenge was that common C# expression types (e.g., CodeExpression), crucial for RCE, are not on SharePoint's allowed list. This would cause the check to fail.
Chumy's ingenious bypass for this involved observing the workflow lifecycle:
- On the first execution, SharePoint converts XAML to C# and compiles it to a DLL.
- The DLL type reference check fails because of the unauthorized types.
- Crucially, SharePoint does not immediately throw an error. Instead, it first loads the malicious DLL into the process.
- After loading, it then checks for recorded errors and throws an exception.
- However, on the second execution of the same workflow, SharePoint's cache lookup mechanism kicks in. Since the assembly is already loaded into the process from the failed first attempt, the cache is hit. This causes SharePoint to skip the entire compilation path, including the DLL type reference check, and directly execute the already loaded (and malicious) DLL.
By combining these bypasses, Chumy was able to achieve arbitrary C# code execution, effectively turning a SharePoint workflow into a shell.
Demo / Proof of Concept
▶ Watch: Bypassing rule validation: precompile vs. runtime (16:40)
The talk included a live demonstration showcasing the full Flow2Shell RCE chain against a fully patched, latest version of SharePoint at the time of discovery. The demonstration highlighted the practical impact of the vulnerability.
The steps demonstrated were:
- A reverse shell server was set up by the attacker, listening for incoming connections.
- The custom exploit script was executed. This script handled the initial authorization bypass, the impersonation of a site administrator, and the crafting and uploading of the malicious workflow definition files (XAML and rules).
- The exploit first leaked necessary information for the JWT bypass, such as a valid issuer and certificate.
- It then proceeded to upload the specially crafted workflow that incorporated all the bypasses discussed in the technical deep dive.
- Finally, the exploit triggered the malicious workflow. This action initiated the workflow's execution, which, due to the sequential bypasses, led to arbitrary code execution on the SharePoint server.
- Upon successful execution, the attacker's reverse shell server received a callback, granting a shell on the SharePoint machine. The demonstration visually confirmed the RCE by changing the server's desktop background to a picture of Chumy's dog, "Hohua."
The demo clearly validated the critical impact of the unauthenticated RCE chain, proving that an attacker could gain full control over the SharePoint server without any prior credentials.
Defensive Implications
▶ Watch: Pwn2Own rejection and MSRC bounty story (22:40)
The Flow2Shell vulnerability chain presents several critical defensive implications for organizations deploying and managing SharePoint environments:
- Immediate Patching: Organizations must ensure their SharePoint installations are fully patched with the latest security updates provided by Microsoft. This specific vulnerability chain (CVE-2023-XXXX, though not explicitly mentioned in the transcript, it was a critical RCE) would have been addressed in a Patch Tuesday release. Prompt patching is the most direct and effective defense.
- Robust JWT Validation: This research underscores the persistent challenges in securing JWT-based authentication. Defenders should advocate for and implement robust JWT validation libraries and practices that strictly enforce:
- Signature validation: Never trust unsigned tokens or allow the
nonealgorithm unless explicitly required for specific, well-understood scenarios. - Issuer and audience validation: Ensure tokens are issued by expected authorities and intended for the correct service.
verkey enforcement: Implement checks to ensure all expected keys, likever, are present and correctly formatted.- Nested JWT (Actor Token) Deep Validation: Any nested tokens must undergo the same rigorous validation as the primary token, including full signature verification.
- Scrutiny of Deserialization-like Features: Features like SharePoint's workflow engine, which allow users to define and execute custom logic (often via XML or other structured data formats), are prime targets for RCE. Defenders should:
- Minimize surface area: Restrict who can create and modify workflows to trusted administrators.
- Monitor workflow creation: Implement logging and alerting for unusual or unauthorized creation or modification of workflow templates and definitions.
- Review custom code: If custom workflows are used, they should undergo security reviews similar to any other application code.
- Layered Defense Analysis: The successful bypass of four independent mitigations in the workflow engine highlights that even seemingly robust layered defenses can be circumvented if there are subtle logical flaws in their implementation or interaction. Defenders should consider:
- Redundant checks: Ensure that security checks are truly independent and not susceptible to the same bypass techniques.
- Execution flow analysis: Understand how different stages of a process (e.g., pre-compile vs. runtime, first execution vs. cached execution) interact with security controls.
- Deny-by-default: Whitelist allowed types and operations rather than blacklisting known malicious ones.
- Monitoring for Post-Exploitation Activity: Even with the best defenses, breaches can occur. Organizations should implement strong monitoring for indicators of compromise (IOCs) related to SharePoint RCE, such as:
- Unusual process creation originating from SharePoint service accounts.
- Network connections to external IPs from SharePoint servers.
- Changes to system configurations or files on SharePoint servers.
- Anomalous workflow execution patterns or errors suggesting failed exploit attempts.
- Principle of Least Privilege: Ensure SharePoint service accounts and application pools run with the absolute minimum necessary privileges to perform their functions. While this RCE grants system-level access, limiting the scope of what the compromised process can immediately affect can reduce the blast radius.
This research serves as a stark reminder that complex enterprise applications require continuous vigilance and deep technical understanding to secure effectively, emphasizing the value of external security research in identifying critical vulnerabilities.
Key Takeaways
- SharePoint's JWT authentication mechanisms are complex and prone to subtle bypasses. Even after previous fixes, flaws in signature validation logic (e.g.,
verkey omission, actor token validation skipping signature) can lead to critical authorization bypasses. - Layered security mitigations, while beneficial, can be systematically bypassed if underlying logical flaws exist. The Flow2Shell chain demonstrates how four distinct validation layers in SharePoint's workflow engine were circumvented sequentially.
- Caching mechanisms, designed for performance, can inadvertently introduce security vulnerabilities. The bypass of the DLL type reference check by leveraging the cache hit on a second execution highlights the need for security considerations across the entire execution lifecycle, including caching.
- Full end-to-end exploit chains are exceptionally valuable for vendors like MSRC. They provide immediate clarity on impact, severity, and expedite the patching process, as demonstrated by the rapid response to Chumy Tsai's detailed submission.
- Variant hunting on older, patched vulnerabilities can yield new critical findings. Chumy's success in finding Flow2Shell stemmed from a deep dive into the underlying issues of a previously patched JWT bypass.
- Detailed vulnerability reports are crucial for efficient remediation. The quality of Chumy's report enabled MSRC to quickly escalate the case, find additional variants, and finalize a fix within days.
About the Speaker(s)
Chumy Tsai (Chih-Yuan Tsai) is a security researcher from Taiwan, currently with CyCraft Technology. He is known for his deep technical expertise in vulnerability research and exploit development. Chumy has a notable track record, including participation in prestigious competitions like Pwn2Own, where he compromised targets in 2025 and in the 2026 automotive competition. His work on the Flow2Shell SharePoint RCE chain demonstrates his ability to uncover complex, multi-stage vulnerabilities in widely used enterprise software. His detailed submission and persistence with MSRC ultimately led to a significant bounty and the successful remediation of a critical flaw.
Katherine Chen works at Microsoft as part of the Microsoft Security Response Center (MSRC)'s Vulnerabilities and Mitigations (VnM) team. Her role involves triaging and assessing security cases submitted by researchers, determining their impact and severity, and coordinating with engineering teams to develop fixes. Katherine's insights into the MSRC process highlight the importance of detailed, end-to-end exploit submissions like Chumy's, which significantly streamline the vulnerability response lifecycle for Microsoft.
Reviews
Dr. Zero (Offensive Security Researcher) — MUST SEE
This is what real vulnerability research looks like. A clean, unauthenticated pre-auth RCE chain against SharePoint, with four layered mitigation bypasses that are each individually clever and together constitute genuinely novel work. Chumy did the work, showed the receipts, and Katherine from MSRC confirming they had a fix in two days tells you everything about the severity.
Heather Calloway (CISO) — STRONG ACCEPT
This is a consequential pre-auth RCE chain against SharePoint — one of the most deployed enterprise platforms in Fortune 500 environments. Any CISO with on-prem SharePoint infrastructure needs to understand this exists and verify their patching posture. The research quality is exceptional; the business exposure is real.