GHSA-3h63-w8jq-rrf2 / CVE-2026-59975: SharpIppNext: Unbounded IPP Document Stream Buffering Leads to Denial of Service
- Source:
- GitHub Security Advisories
- Published:
- Fetched:
- Updated:
- Affects:
- SharpIppNext
https://github.com/advisories/GHSA-3h63-w8jq-rrf2 ↗
SharpIppNext: Unbounded IPP Document Stream Buffering Leads to Denial of Service ### 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 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 Affected packages: nuget:SharpIppNext Patched: SharpIppNext 4.1.0