## Executive Summary

In this sharp, pragmatic, and humorous retrospective, **Barry Dorrans**, Microsoft's Principal Security PM for .NET and Aspire, walks through an extraordinarily turbulent year in .NET security. Propelled by security researchers equipping automated AI and LLM agents to comb through decades of unloved, legacy code (e.g. 15–20 year-old desktop and XML components), incoming Microsoft Security Response Center (MSRC) reports exploded from 84 in 2025 to **2,622 reports in 2026**. This resulted in **97 patched CVEs** (up from 12) and over **$1,012,500 in bug bounty payouts**.

Barry demystifies how developers should interpret **CVSS scores** versus practical application risk, explains why raw scores like 9.8 can be misleading depending on execution context, dissects high-profile out-of-band patches (Google Brotli and MsQuic), and analyzes real-world security vulnerabilities across XML recursion, certificate verification complexity, OpenSSL native interop crashes, XPS script injection, .NET SDK workload tampering, sockets header leaks, and ASP.NET Core DataProtection span misuse.

### Core Breakthroughs & Security Insights:
1. **The AI-Driven Vulnerability Surge:** External MSRC reports jumped **31x** (84 to 2,622). Patched CVEs rose from 12 to 97. Total bug bounties surpassed **$1.01 Million**. This surge reflects AI-assisted vulnerability discovery targeting legacy, unmaintained surface areas (like XPS/WPF) rather than modern coding degradation.
2. **The CVSS Scoring Trap:** Framework vulnerabilities are scored against the *worst possible scenario without mitigations*. A CVSS 9.8 in `MsQuic` represents critical kernel-mode code execution in Windows, but has a vastly lower practical blast radius in user-mode .NET servers.
3. **Vulnerability Distribution:**
   - **Denial of Service (DoS):** Overwhelming majority of all patched CVEs (infinite loops, memory over-allocation, recursion stack overflows).
   - **Remote Code Execution (RCE):** 19 CVEs (predominantly in legacy desktop/XPS parsers).
   - **Elevation of Privilege (EoP) & Info Disclosure:** 4 Critical severities, mostly Highs and Mediums.
4. **Out-of-Band Brotli Decompression:** Demonstrates the peril of embedded third-party native code. While RCE in Node.js/npm, it caused DoS in .NET; developers who couldn't immediately patch mitigated risk by opting out of Brotli in `HttpClientHandler.AutomaticDecompression`.
5. **Universal Recursion Guards:** Analysis of an XML `DecryptEncryptedKey` stack overflow vulnerability: a depth guard was implemented on multiple paths but omitted on a single clause. Barry’s rule: *Guard checks must be enforced universally across every recursion and collection path*.
6. **Algorithmic Complexity Attacks (DoS):** Malicious 108 KB payloads with duplicate embedded certificates forced quadratic reparsing and cryptographic signature checks without caching, stalling production web servers for seconds.
7. **Native Unmanaged Interop (OpenSSL):** Invalid inputs passed across the managed-unmanaged boundary caused native OpenSSL to crash the entire host process on Linux. Never trust external C libraries to validate inputs safely.
8. **Deprecate XPS:** Undocumented, obsolete Windows XPS file formats execute embedded XAML scripts. Barry explicitly urges developers to stop parsing untrusted XPS files and migrate to PDF.
9. **Span API Discrepancies:** Confusion in `ComputeHash` overloads—some return newly allocated byte arrays despite accepting `ReadOnlySpan<byte>`, leading developers to make incorrect memory safety assumptions.
10. **Retiring Simulated Windows Auth on Linux:** Simulating Active Directory Windows Authentication on Linux via Kerberos/LDAP is brittle and flawed. Teams should migrate to OAuth 2.0 / OpenID Connect.

---

## Detailed Section-by-Section Breakdown

### 1. Security Terminology & The CVSS Score Trap

**Presenter:** Barry Dorrans

Barry reviews the core vocabulary of modern security disclosure:
- **CVE (Common Vulnerabilities and Exposures):** Globally unique identifiers for tracking security defects.
- **CWE (Common Weakness Enumeration):** Formal taxonomy of hardware and software flaws maintained by MITRE.
- **CVSS (Common Vulnerability Scoring System):** Algorithmic severity score based on exploitability and impact.

![Title Slide: 2 Secure 2 Curmudgeonly](/dotnetconf2026/archive/12-2-secure-2-curmudgeonly/screenshots/01_title_2_secure_2_curmudgeonly.webp)
![Vulnerability Vocabulary: CVE, CVSS, and CWE](/dotnetconf2026/archive/12-2-secure-2-curmudgeonly/screenshots/02_vulnerability_vocabulary_cve_cvss_cwe.webp)

Barry cautions that CVSS is **not a direct proxy for risk**. Framework authors must calculate CVSS using the absolute worst-case scenario assuming zero operational mitigations. A vulnerability with a 9.9 score might require an application to deliberately opt into obscure, non-default middleware configurations.

---

### 2. The Year in Statistics: The AI-Assisted Influx

The arrival of automated AI security research tools created an unprecedented surge in vulnerability reports:
- **MSRC Cases:** Soared from **84 in 2025** to **2,622 in 2026**.
- **Shipped CVEs:** Rose from **12 to 97**.
- **Bounty Payouts:** Increased from **$635,500** to **$1,012,500**.

![Year in Vulnerabilities Surge Statistics](/dotnetconf2026/archive/12-2-secure-2-curmudgeonly/screenshots/03_year_in_vulnerabilities_surge_stats.webp)

Barry clarifies that this reflects researchers pointing AI tools at 15–20 year-old, previously unscrutinized codebases (such as WPF, XPS, and legacy cryptographic helpers) rather than a decline in modern engineering rigor.

---

### 3. Vulnerability Breakdown by Category & Severity

Denial of Service accounted for the vast majority of patched flaws:
- **Denial of Service (DoS):** Overwhelmingly the top category, triggered by unbounded recursion, regex catastrophism, unconstrained dictionary sizing, and algorithmic complexity.
- **Remote Code Execution (RCE):** 19 CVEs.
- **Severity Tiers:** 4 Criticals, with the bulk categorized as High or Medium.

![Vulnerabilities by Type and Severity](/dotnetconf2026/archive/12-2-secure-2-curmudgeonly/screenshots/04_vulnerabilities_by_type_and_severity.webp)

---

### 4. Case Study: Out-of-Band Brotli Decompression

A rare out-of-band security patch addressed Google's **Brotli** native compression library embedded in .NET:
- In Node.js/npm, memory corruption resulted in direct Remote Code Execution.
- In .NET, it manifested as a Denial of Service. However, because memory buffer out-of-bounds reads/writes theoretically permit RCE, Microsoft classified it under the highest possible severity.
- **Mitigation:** In .NET, `HttpClient` requires explicitly opting into response decompression. Teams unable to immediately deploy runtime patches mitigated exposure by disabling Brotli in configuration and falling back to GZip.

![Out-of-Band Brotli Decompression Patch](/dotnetconf2026/archive/12-2-secure-2-curmudgeonly/screenshots/05_brotli_out_of_band_patch.webp)

---

### 5. MsQuic & Scoring Disparities: Kernel vs. User Mode

The high-profile **MsQuic** vulnerability (CVE score **9.8**) illustrates why CVSS must be contextualized:
- Windows embeds MsQuic inside the OS kernel: an exploit yields full kernel-mode privilege escalation (a true 9.8 catastrophe).
- .NET embeds MsQuic inside user-mode application processes: an exploit yields user-space memory crashes or DoS.
- Barry notes that prioritizing patches based strictly on CVSS numbers wastes operational resources; public Kestrel edge servers must always take priority over internal backends.

![MsQuic CVSS Scoring Misconceptions](/dotnetconf2026/archive/12-2-secure-2-curmudgeonly/screenshots/06_msquic_cvss_scoring_misconceptions.webp)

---

### 6. Deep Dive: Encrypted XML Stack Overflow (DoS)

Inside `System.Security.Cryptography.Xml`, the `DecryptEncryptedKey` routine contained recursion depth guards across almost all code paths. However:
- A single recursive branch through nested key clauses omitted the depth check.
- Specially crafted XML inputs triggered unbounded recursion, leading to an immediate `StackOverflowException` that forcefully aborted the host process without catching.
- **Lesson:** *Defensive guards (depth counters, memory bounds, timeout cancellation) must be applied across 100% of execution paths*.

![Encrypted XML Stack Overflow Denial of Service](/dotnetconf2026/archive/12-2-secure-2-curmudgeonly/screenshots/07_encrypted_xml_stack_overflow_dos.webp)

---

### 7. Algorithmic Complexity: Certificate Verification Bombs

Similar to XML "Billion Laughs" entity expansion attacks, security researchers discovered an algorithmic complexity flaw in PKCS certificate verification:
- A tiny 108 KB payload containing duplicate embedded certificates caused the signature validation engine to re-parse and cryptographically verify each certificate once per signer with zero caching.
- This stalled web services for multiple seconds per request.
- **Lesson:** Ensure cryptographic routines operate in time strictly proportional to payload size and cache intermediate verification results.

![Certificate Verification Algorithmic Complexity](/dotnetconf2026/archive/12-2-secure-2-curmudgeonly/screenshots/08_certificate_verification_algorithmic_complexity.webp)

---

### 8. Legacy Format Dangers: WPF & XPS Remote Code Execution

Multiple RCE vulnerabilities stemmed from legacy Windows Presentation Foundation (WPF) document processing:
- **XML Paper Specification (XPS):** Like legacy PDFs, XPS allows embedded scripts and complex nested XAML trees. Researchers leveraged undocumented parser quirks to achieve remote code execution.
- Barry urges enterprise teams to **immediately discontinue parsing untrusted XPS files** and migrate to modern formats like PDF.
- If proprietary binary or document formats are maintained, developers must thoroughly document specifications and seed fuzzers with known edge-case inputs.

![WPF and XPS Remote Code Execution Vulnerabilities](/dotnetconf2026/archive/12-2-secure-2-curmudgeonly/screenshots/09_wpf_xps_remote_code_execution.webp)

---

### 9. API Traps: ASP.NET DataProtection and Spans

Even modern high-performance APIs present subtle security traps:
- In cryptographic hashing and message authentication code (MAC) routines, developers assumed that any overload accepting `ReadOnlySpan<byte>` wrote into pre-allocated memory buffers.
- Certain legacy `ComputeHash` overloads took a span but still returned a brand-new allocated `byte[]`, breaking assumptions around zero-allocation pooled memory and resulting in subtle security validation bypasses.
- **Lesson:** Audit memory pooling and span invocations thoroughly when dealing with cryptographic primitives.

![ASP.NET DataProtection and Span Misuse](/dotnetconf2026/archive/12-2-secure-2-curmudgeonly/screenshots/10_aspnet_data_protection_span_pitfalls.webp)

---

### 10. Curmudgeonly Advice for Secure Engineering

Barry wraps up with actionable takeaways:
1. **HTTP RFC Strictness:** RFCs are often leaky and ill-specified. It is completely acceptable (and often necessary) to reject bizarre or ambiguous HTTP framing to prevent HTTP Request Smuggling.
2. **Abandon Fake Windows Auth on Linux:** Stop using Kerberos/LDAP workarounds to mimic Windows NTLM/Kerberos identity on Linux containers; migrate decisively to OAuth 2.0 / OpenID Connect.
3. **Guidance for AI Researchers:** Do not report intentionally disabled security switches as vulnerabilities. Use Microsoft's AI grounding documentation for .NET threat models and submit verifiable PoCs through MSRC to claim bounties.
