Skip to content
KitploitKITPLOIT
ToolsBlog
Submit
ToolsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

··Feeds·Contact·Privacy·© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
CVE-2026-33331 — Local lab reproducing stored XSS in oRPC's OpenAPI docs generation (CVE-2026-33331), with vulnerable and patched versions for comparison and a standalone PoC. | Kitploit
Tools/GitHubGitHub/abhayclasher/cve-2026-33331
Vulnerability AnalysisExploitationWeb Application ExploitationWeb SecurityLearning & EducationLabs & Practice
GitHubabhayclasher/cve-2026-33331

CVE-2026-33331

Local lab reproducing stored XSS in oRPC's OpenAPI docs generation (CVE-2026-33331), with vulnerable and patched versions for comparison and a standalone PoC.

View Repository
25 months agoNot yet reviewed

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share

CVE-2026-33331 — Stored XSS in oRPC OpenAPI Reference Plugin

CVE GHSA CWE-79 Patched

Proof-of-concept lab for stored XSS in orpc's OpenAPI documentation generation


Purpose

oRPC builds API docs pages from an OpenAPI spec. Before v1.13.9 it dumped the spec directly into a <script> tag using JSON.stringify() with no HTML encoding. Any field an attacker controlled, like , could close that tag early and run script.

info.description

This repo gives you a local lab to reproduce the bug, plus a patched version to compare against.

Quick facts

FieldValue
CVE IDCVE-2026-33331
GHSAGHSA-7f6v-3gx7-27q8
CWECWE-79 (Improper Neutralization of Input During Web Page Generation)
Productmiddleapi/orpc
AffectedAll versions below v1.13.9
Patchedv1.13.9
DiscoveryAbhay Kumar (@abhayclasher)

Vulnerability details

The vulnerable code in packages/openapi/src/plugins/openapi-reference.ts renders the spec like this:

root@kitploit:~
<script id="spec" type="application/json">${JSON.stringify(spec)}</script>

JSON.stringify() produces valid JSON, but it does not escape < or >. The browser still treats </script> as an HTML closing tag, even inside a <script type="application/json">.

A payload in info.description that triggers execution:

root@kitploit:~
"</script><script>alert('XSS')</script>"

The browser sees:

root@kitploit:~
<script id="spec" type="application/json">{"info":{"description":"
</script><script>alert('XSS')</script>"}}
</script>

The first </script> closes the block. Everything after it runs as inline JavaScript.

Impact

  • Session hijacking via cookie or token theft
  • Arbitrary API calls made on behalf of the victim viewing the docs
  • Phishing overlays rendered within the trusted docs domain

This applies when an application builds OpenAPI specs from user-controlled input, which is the exact case oRPC enables through its router definitions.

System requirements

  • Node.js 18 or later
  • Docker (optional, for containerized lab)
  • 500 MB free disk space

Setup

Option 1: Run directly

root@kitploit:~
git clone https://github.com/abhayclasher/CVE-2026-33331.git
cd CVE-2026-33331/app
npm install
node server.js

Option 2: Run with Docker

root@kitploit:~
git clone https://github.com/abhayclasher/CVE-2026-33331.git
cd CVE-2026-33331
docker compose up -d

Usage

After the server starts, visit these URLs:

URLDescription
http://localhost:3000/docsVulnerable docs page — XSS payload executes on load
http://localhost:3000/docs/safeSame page with the v1.13.9 patch applied
http://localhost:3000/spec.jsonRaw OpenAPI spec JSON

The vulnerable version will fire an alert() on page load, confirming script execution. The patched version renders the same malicious spec safely — the payload displays as plain text.

You can also run the standalone PoC:

root@kitploit:~
cd poc
node exploit.js

This spins up a minimal server on port 3000 that demonstrates the same bug without the full application context.

How it works

Detection flow

root@kitploit:~
1. Attacker controls a field in the OpenAPI spec (e.g. description)
2. oRPC generates the docs HTML with JSON.stringify(spec)
3. The </script> in the payload closes the <script> tag early
4. Browser executes whatever follows as inline JavaScript

The attack chain

root@kitploit:~
┌─────────────────────────────────────────────────────┐
│  1. Malicious spec crafted:                          │
│                                                       │
│     info.description =                                │
│       "</script><script>alert('XSS')</script>"        │
│                                                       │
│  2. orpc embeds spec into HTML:                       │
│                                                       │
│     <script id="spec" type="application/json">        │
│     {"info":{"description":"</script>    <-- tag      │
│       <script>alert('XSS')</script>      <-- payload  │
│       "}}                                             │
│     </script>                                         │
│                                                       │
│  3. Browser executes alert('XSS')                     │
└─────────────────────────────────────────────────────┘

The fix

Version 1.13.9 introduces escapeJsonForHtml(), which replaces HTML-sensitive characters with Unicode escapes before embedding JSON in the script tag:

root@kitploit:~
const escapeJsonForHtml = (obj) => JSON.stringify(obj)
  .replace(/&/g, '\\u0026')
  .replace(/'/g, '\\u0027')
  .replace(/</g, '\\u003C')
  .replace(/>/g, '\\u003E')
  .replace(/\//g, '\\u002F');

Unicode escapes work because they stay valid JSON — JSON.parse() reconstructs the original string — but they never look like HTML to the browser's parser.

The patch also moved from reading JSON out of a DOM dataset.config attribute (which broke when values contained parentheses) to assigning the escaped JSON directly to an inline variable.

View the full commit: 4f0efa8

Project structure

root@kitploit:~
CVE-2026-33331/
├── README.md               # This file
├── docker-compose.yml      # Docker lab configuration
├── app/
│   ├── Dockerfile          # Container build configuration
│   ├── package.json        # Node.js dependencies
│   └── server.js           # Vulnerable + patched docs renderer
└── poc/
    └── exploit.js          # Standalone minimal proof-of-concept

References

  • NVD — CVE-2026-33331
  • GitHub Security Advisory
  • Patch Commit
  • Release v1.13.9
  • CWE-79

Reported by Abhay Kumar. This repository is intended for local educational use only. Do not deploy the vulnerable server on a public network.

Educational purposes only — use in isolated environments

Download Tool