Vulnerable Regular Expression · Issue #501 · debug-js/debug · GitHub
Skip to content

Vulnerable Regular Expression #501

Closed
koajs/static-cache
#73

Description

@cristianstaicu

The following regular expression used in the "o" formatter is vulnerable to ReDoS:

/\s*\n\s*/

The slowdown is moderately low: for 50.000 characters around 2 seconds matching time. However, I would still suggest one of the following:

  • remove the regex,
  • anchor the regex,
  • limit the number of characters that can be matched by the repetition,
  • limit the input size.

If needed, I can provide an actual example showing the slowdown.

Activity

  1. TooTallNate commented on Sep 13, 2017

    @TooTallNate
    Contributor

    Thanks for the report. Patch welcome! The %o formatter by design needs to remove the newlines but any performance optimizations are ❤️ 👍

  2. fadookie commented on Sep 26, 2017

    @fadookie

    @TooTallNate As far as I can tell no security patch for this issue has yet been released for 3.x, is this in the works? Thanks!

  3. TooTallNate commented on Sep 26, 2017

    @TooTallNate
    Contributor

    @fadookie Yes correct, thanks for the nudge. v3.1.0 has now been published.

  4. added a commit that references this issue on Oct 28, 2017
  5. added a commit that references this issue on Dec 18, 2017
  6. added a commit that references this issue on Dec 19, 2017
  7. Yaniv-git commented on Sep 14, 2020

    @Yaniv-git

    Hello,
    My name is Yaniv Nizry I’m an Application Security Researcher from CxSCA group at Checkmarx,
    after looking into this issue we noticed that it might not have been resolved.
    For more information please contact us at:
    ScaAppSec@checkmarx.com

    Thanks,
    Yaniv

  8. Qix- commented on Sep 14, 2020

    @Qix-
    Member

    @yaniv-checkmarx Hi. Feel free to submit a report to me at josh.junon@protonmail.com if you think you've found a security issue with debug. Please be sure to specify exactly which versions and/or version ranges you think the vulnerability pertains to.

    Thanks.

  9. Yaniv-git commented on Oct 1, 2020

    @Yaniv-git

    @Qix- Hi, I sent you on September 14th the email, don't know if you got it.
    Are there any updates?

  10. Qix- commented on Oct 1, 2020

    @Qix-
    Member

    Hi @yaniv-checkmarx, I've been focused on other things the last few weeks. Apologies. I'll take a look within the next week to see if I can validate.

  11. Yaniv-git commented on Nov 19, 2020

    @Yaniv-git

    @Qix- pinging you on this issue :)

  12. Qix- commented on Nov 19, 2020

    @Qix-
    Member

    Confirmed, regressed in 6ab9525c9841b656d996e521cf86192d5647483a a long while ago.

    Will push a fix, thank you for the report @yaniv-checkmarx @Eden-checkmarx. Apologies for the delay until now.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions