Redocly / Redocly/redoc

HTML injection (Improper Sanitization of Script-Related HTML Tags in a Web Page, Basic XSS) CWE-80

Open
#2,257 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Type: Bug
Dominant language
TypeScript
Stars
25.9k
Forks
2.4k
Avg merge
13h 10m
Merged PRs (30d)
4

Description

Describe the bug
It is possible to insert html code and execute it
<style>body { background-color: blue }</style>
<iframe src="javascript:alert(0)"></iframe>

Expected behavior
Html chars escaped

Minimal reproducible OpenAPI snippet(if possible)

{
    "openapi": "3.0.0",
    "info": {
        "title": "title",
        "description": "description",
        "version": "0.0.1"
    },
    "paths": {
        "/path": {
            "get": {
                "operationId": "operationId",
                "summary": "summary",
                "description": "description <iframe src=\"javascript:alert(0)\"></iframe>",
                "parameters": [
                    {
                        "name": "X-NAME",
                        "in": "header",
                        "description": "Some description <style>body { background-color: blue }</style>",
                        "required": true,
                        "schema": {
                            "maxLength": 255,
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success <iframe src=\"javascript:alert(0)\"></iframe>"
                    }
                }
            }
        }
    }
}

Screenshots
screen

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by loading the supplied OpenAPI snippet in the Redoc UI and confirm how the description fields are rendered. Trace the rendering path for descriptions and verify that the style and javascript iframe payloads are displayed as text rather than executed; done means the reproduced XSS no longer runs.

Written by the indexing model from the issue text.

Assessment

Tech stack
html, javascript, openapi
Domain
documentation, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.