azure@2.2.1-preview

Microsoft Azure Client Library for node.
Vulnerabilities 8 via 87 paths
Dependencies 266
Source npm

Snyk continuously finds and fixes vulnerabilities in your dependencies.

Filter by issue type
  • 4
  • 4
Filter by issue policy
  • 0
  • 0
medium severity

Buffer Overflow

  • Vulnerable module: validator
  • Introduced through: azure-common@0.9.18, azure-asm-website@0.10.6 and others

Detailed paths

  • Introduced through: azure@2.2.1-preview azure-common@0.9.18 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-asm-website@0.10.6 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-monitoring@0.10.5 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-scheduler@0.10.3 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-storage@1.3.0 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-sb@0.10.5 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-arm-hdinsight@0.2.2 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-asm-compute@0.18.0 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-asm-hdinsight@0.10.3 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-asm-mgmt@0.10.2 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-asm-network@0.13.1 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-asm-scheduler@0.10.2 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-asm-sql@0.10.3 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-asm-storage@0.12.1 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-asm-store@0.10.2 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-asm-trafficmanager@0.10.4 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-asm-sb@0.10.2 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-asm-subscription@0.10.2 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-extra@0.2.14 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-gallery@2.0.0-pre.20 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-storage-legacy@0.10.2 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-arm-hdinsight-jobs@0.1.1 azure-common@0.9.19 validator@3.22.2

Overview

validator is a library of string validators and sanitizers.

Affected versions of this package are vulnerable to Buffer Overflow. It used a regular expression (/^(?:[A-Z0-9+\/]{4})*(?:[A-Z0-9+\/]{2}==|[A-Z0-9+\/]{3}=|[A-Z0-9+\/]{4})$/i) in order to validate Base64 strings.

Remediation

Upgrade validator to version 5.0.0 or higher.

References

medium severity

Cross-site Scripting (XSS)

  • Vulnerable module: validator
  • Introduced through: azure-common@0.9.18, azure-asm-website@0.10.6 and others

Detailed paths

  • Introduced through: azure@2.2.1-preview azure-common@0.9.18 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-asm-website@0.10.6 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-monitoring@0.10.5 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-scheduler@0.10.3 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-storage@1.3.0 validator@3.22.2
    Remediation: Upgrade to azure-storage@2.2.0.
  • Introduced through: azure@2.2.1-preview azure-sb@0.10.5 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-arm-hdinsight@0.2.2 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-asm-compute@0.18.0 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-asm-hdinsight@0.10.3 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-asm-mgmt@0.10.2 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-asm-network@0.13.1 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-asm-scheduler@0.10.2 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-asm-sql@0.10.3 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-asm-storage@0.12.1 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-asm-store@0.10.2 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-asm-trafficmanager@0.10.4 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-asm-sb@0.10.2 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-asm-subscription@0.10.2 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-extra@0.2.14 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-gallery@2.0.0-pre.20 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-storage-legacy@0.10.2 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-arm-hdinsight-jobs@0.1.1 azure-common@0.9.19 validator@3.22.2

Overview

validator is a library of string validators and sanitizers.

Affected versions of this package are vulnerable to Cross-site Scripting (XSS) in IE9 due to unescaped backticks.

Details

Cross-Site Scripting (XSS) attacks occur when an attacker tricks a user’s browser to execute malicious JavaScript code in the context of a victim’s domain. Such scripts can steal the user’s session cookies for the domain, scrape or modify its content, and perform or modify actions on the user’s behalf, actions typically blocked by the browser’s Same Origin Policy.

These attacks are possible by escaping the context of the web application and injecting malicious scripts in an otherwise trusted website. These scripts can introduce additional attributes (say, a "new" option in a dropdown list or a new link to a malicious site) and can potentially execute code on the clients side, unbeknown to the victim. This occurs when characters like \< > \" \' are not escaped properly.

There are a few types of XSS:

  • Persistent XSS is an attack in which the malicious code persists into the web app’s database.
  • Reflected XSS is an which the website echoes back a portion of the request. The attacker needs to trick the user into clicking a malicious link (for instance through a phishing email or malicious JS on another page), which triggers the XSS attack.
  • DOM-based XSS is an that occurs purely in the browser when client-side JavaScript echoes back a portion of the URL onto the page. DOM-Based XSS is notoriously hard to detect, as the server never gets a chance to see the attack taking place.

Remediation

Upgrade validator to version 3.35.0 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: moment
  • Introduced through: azure-monitoring@0.10.5 and azure-scheduler@0.10.3

Detailed paths

  • Introduced through: azure@2.2.1-preview azure-monitoring@0.10.5 moment@2.14.1
    Remediation: Run snyk wizard to patch moment@2.14.1.
  • Introduced through: azure@2.2.1-preview azure-scheduler@0.10.3 moment@2.14.1
    Remediation: Run snyk wizard to patch moment@2.14.1.

Overview

moment is a lightweight JavaScript date library for parsing, validating, manipulating, and formatting dates.

Affected versions of the package are vulnerable to Regular Expression Denial of Service (ReDoS) attacks for any locale that has separate format and standalone options and format input can be controlled by the user.

An attacker can provide a specially crafted input to the format function, which nearly matches the pattern being matched. This will cause the regular expression matching to take a long time, all the while occupying the event loop and preventing it from processing other requests and making the server unavailable (a Denial of Service attack).

Disclosure Timeline

  • October 19th, 2016 - Reported the issue to package owner.
  • October 19th, 2016 - Issue acknowledged by package owner.
  • October 24th, 2016 - Issue fixed and version 2.15.2 released.

References

medium severity

Uninitialized Memory Exposure

  • Vulnerable module: tunnel-agent
  • Introduced through: azure-common@0.9.18 and azure-storage@1.3.0

Detailed paths

  • Introduced through: azure@2.2.1-preview azure-common@0.9.18 request@2.74.0 tunnel-agent@0.4.3
    Remediation: Upgrade to azure-common@0.9.19.
  • Introduced through: azure@2.2.1-preview azure-storage@1.3.0 request@2.74.0 tunnel-agent@0.4.3
    Remediation: Upgrade to azure-storage@2.3.0.

Overview

tunnel-agent is HTTP proxy tunneling agent. Affected versions of the package are vulnerable to Uninitialized Memory Exposure.

A possible memory disclosure vulnerability exists when a value of type number is used to set the proxy.auth option of a request request and results in a possible uninitialized memory exposures in the request body.

This is a result of unobstructed use of the Buffer constructor, whose insecure default constructor increases the odds of memory leakage.

Details

Constructing a Buffer class with integer N creates a Buffer of length N with raw (not "zero-ed") memory.

In the following example, the first call would allocate 100 bytes of memory, while the second example will allocate the memory needed for the string "100":

// uninitialized Buffer of length 100
        x = new Buffer(100);
        // initialized Buffer with value of '100'
        x = new Buffer('100');
        

tunnel-agent's request construction uses the default Buffer constructor as-is, making it easy to append uninitialized memory to an existing list. If the value of the buffer list is exposed to users, it may expose raw server side memory, potentially holding secrets, private data and code. This is a similar vulnerability to the infamous Heartbleed flaw in OpenSSL.

Proof of concept by ChALkeR

require('request')({
          method: 'GET',
          uri: 'http://www.example.com',
          tunnel: true,
          proxy:{
              protocol: 'http:',
              host:"127.0.0.1",
              port:8080,
              auth:80
          }
        });
        

You can read more about the insecure Buffer behavior on our blog.

Similar vulnerabilities were discovered in request, mongoose, ws and sequelize.

Remediation

Upgrade tunnel-agent to version 0.6.0 or higher.

References

low severity

Prototype Pollution

  • Vulnerable module: hoek
  • Introduced through: azure-common@0.9.18 and azure-storage@1.3.0

Detailed paths

  • Introduced through: azure@2.2.1-preview azure-common@0.9.18 request@2.74.0 hawk@3.1.3 hoek@2.16.3
    Remediation: Upgrade to azure-common@0.9.19.
  • Introduced through: azure@2.2.1-preview azure-storage@1.3.0 request@2.74.0 hawk@3.1.3 hoek@2.16.3
  • Introduced through: azure@2.2.1-preview azure-common@0.9.18 request@2.74.0 hawk@3.1.3 boom@2.10.1 hoek@2.16.3
    Remediation: Upgrade to azure-common@0.9.19.
  • Introduced through: azure@2.2.1-preview azure-storage@1.3.0 request@2.74.0 hawk@3.1.3 boom@2.10.1 hoek@2.16.3
  • Introduced through: azure@2.2.1-preview azure-common@0.9.18 request@2.74.0 hawk@3.1.3 cryptiles@2.0.5 boom@2.10.1 hoek@2.16.3
    Remediation: Upgrade to azure-common@0.9.19.
  • Introduced through: azure@2.2.1-preview azure-storage@1.3.0 request@2.74.0 hawk@3.1.3 cryptiles@2.0.5 boom@2.10.1 hoek@2.16.3
  • Introduced through: azure@2.2.1-preview azure-common@0.9.18 request@2.74.0 hawk@3.1.3 sntp@1.0.9 hoek@2.16.3
    Remediation: Upgrade to azure-common@0.9.19.
  • Introduced through: azure@2.2.1-preview azure-storage@1.3.0 request@2.74.0 hawk@3.1.3 sntp@1.0.9 hoek@2.16.3

Overview

hoek is a Utility methods for the hapi ecosystem.

Affected versions of this package are vulnerable to Prototype Pollution. The utilities function allow modification of the Object prototype. If an attacker can control part of the structure passed to this function, they could add or modify an existing property.

PoC by Olivier Arteau (HoLyVieR)

var Hoek = require('hoek');
        var malicious_payload = '{"__proto__":{"oops":"It works !"}}';
        
        var a = {};
        console.log("Before : " + a.oops);
        Hoek.merge({}, JSON.parse(malicious_payload));
        console.log("After : " + a.oops);
        
        

Remediation

Upgrade hoek to versions 4.2.1, 5.0.3 or higher.

References

low severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: mime
  • Introduced through: mime@1.2.11 and azure-storage-legacy@0.10.2

Detailed paths

  • Introduced through: azure@2.2.1-preview mime@1.2.11
    Remediation: Upgrade to mime@1.4.1.
  • Introduced through: azure@2.2.1-preview azure-storage-legacy@0.10.2 mime@1.2.11

Overview

mime is a comprehensive, compact MIME type module.

Affected versions of this package are vulnerable to Regular expression Denial of Service (ReDoS). It uses regex the following regex /.*[\.\/\\]/ in its lookup, which can cause a slowdown of 2 seconds for 50k characters.

The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Many Regular Expression implementations may reach extreme situations that cause them to work very slowly (exponentially related to input size), allowing an attacker to exploit this and can cause the program to enter these extreme situations by using a specially crafted input and cause the service to excessively consume CPU, resulting in a Denial of Service.

You can read more about Regular Expression Denial of Service (ReDoS) on our blog.

Remediation

Upgrade mime to versions 1.4.1, 2.0.3 or higher.

References

low severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: moment
  • Introduced through: moment@2.18.1, azure-arm-monitor@1.0.1-preview and others

Detailed paths

  • Introduced through: azure@2.2.1-preview moment@2.18.1
    Remediation: Upgrade to moment@2.19.3.
  • Introduced through: azure@2.2.1-preview azure-arm-monitor@1.0.1-preview moment@2.18.1
    Remediation: Run snyk wizard to patch moment@2.18.1.
  • Introduced through: azure@2.2.1-preview azure-batch@3.0.0 moment@2.18.1
    Remediation: Run snyk wizard to patch moment@2.18.1.
  • Introduced through: azure@2.2.1-preview azure-asm-website@0.10.6 moment@2.18.1
    Remediation: Run snyk wizard to patch moment@2.18.1.
  • Introduced through: azure@2.2.1-preview azure-monitor@1.0.1-preview moment@2.18.1
    Remediation: Run snyk wizard to patch moment@2.18.1.
  • Introduced through: azure@2.2.1-preview azure-monitoring@0.10.5 moment@2.14.1
  • Introduced through: azure@2.2.1-preview azure-scheduler@0.10.3 moment@2.14.1

Overview

moment is a lightweight JavaScript date library for parsing, validating, manipulating, and formatting dates.

Affected versions of this package are vulnerable to Regular expression Denial of Service (ReDoS) attacks. It used a regular expression (/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i) in order to parse dates specified as strings. This can cause a very low impact of about 2 seconds matching time for data 50k characters long.

Details

The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Many Regular Expression implementations may reach extreme situations that cause them to work very slowly (exponentially related to input size), allowing an attacker to exploit this and can cause the program to enter these extreme situations by using a specially crafted input and cause the service to excessively consume CPU, resulting in a Denial of Service.

You can read more about Regular Expression Denial of Service (ReDoS) on our blog.

Remediation

Upgrade moment to version 2.19.3 or higher.

References

low severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: validator
  • Introduced through: azure-common@0.9.18, azure-asm-website@0.10.6 and others

Detailed paths

  • Introduced through: azure@2.2.1-preview azure-common@0.9.18 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-asm-website@0.10.6 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-monitoring@0.10.5 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-scheduler@0.10.3 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-storage@1.3.0 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-sb@0.10.5 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-arm-hdinsight@0.2.2 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-asm-compute@0.18.0 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-asm-hdinsight@0.10.3 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-asm-mgmt@0.10.2 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-asm-network@0.13.1 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-asm-scheduler@0.10.2 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-asm-sql@0.10.3 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-asm-storage@0.12.1 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-asm-store@0.10.2 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-asm-trafficmanager@0.10.4 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-asm-sb@0.10.2 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-asm-subscription@0.10.2 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-extra@0.2.14 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-gallery@2.0.0-pre.20 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-storage-legacy@0.10.2 azure-common@0.9.19 validator@3.22.2
  • Introduced through: azure@2.2.1-preview azure-arm-hdinsight-jobs@0.1.1 azure-common@0.9.19 validator@3.22.2

Overview

validator is a library of string validators and sanitizers.

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) attacks. It used a regular expression (^\s*data:([a-z]+\/[a-z0-9\-\+]+(;[a-z\-]+=[a-z0-9\-]+)?)?(;base64)?,[a-z0-9!\$&',\(\)\*\+,;=\-\._~:@\/\?%\s]*\s*$) in order to validate Data URIs. This can cause an impact of about 10 seconds matching time for data 70K characters long.

Disclosure Timeline

  • Feb 15th, 2018 - Initial Disclosure to package owner
  • Feb 16th, 2018 - Initial Response from package owner
  • Feb 18th, 2018 - Fix issued
  • Feb 18th, 2018 - Vulnerability published

Details

Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.

The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.

Let’s take the following regular expression as an example:

regex = /A(B|C+)+D/
        

This regular expression accomplishes the following:

  • A The string must start with the letter 'A'
  • (B|C+)+ The string must then follow the letter A with either the letter 'B' or some number of occurrences of the letter 'C' (the + matches one or more times). The + at the end of this section states that we can look for one or more matches of this section.
  • D Finally, we ensure this section of the string ends with a 'D'

The expression would match inputs such as ABBD, ABCCCCD, ABCBCCCD and ACCCCCD

It most cases, it doesn't take very long for a regex engine to find a match:

$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCD")'
        0.04s user 0.01s system 95% cpu 0.052 total
        
        $ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCX")'
        1.79s user 0.02s system 99% cpu 1.812 total
        

The entire process of testing it against a 30 characters long string takes around ~52ms. But when given an invalid string, it takes nearly two seconds to complete the test, over ten times as long as it took to test a valid string. The dramatic difference is due to the way regular expressions get evaluated.

Most Regex engines will work very similarly (with minor differences). The engine will match the first possible way to accept the current character and proceed to the next one. If it then fails to match the next one, it will backtrack and see if there was another way to digest the previous character. If it goes too far down the rabbit hole only to find out the string doesn’t match in the end, and if many characters have multiple valid regex paths, the number of backtracking steps can become very large, resulting in what is known as catastrophic backtracking.

Let's look at how our expression runs into this problem, using a shorter string: "ACCCX". While it seems fairly straightforward, there are still four different ways that the engine could match those three C's:

  1. CCC
  2. CC+C
  3. C+CC
  4. C+C+C.

The engine has to try each of those combinations to see if any of them potentially match against the expression. When you combine that with the other steps the engine must take, we can use RegEx 101 debugger to see the engine has to take a total of 38 steps before it can determine the string doesn't match.

From there, the number of steps the engine must use to validate a string just continues to grow.

String Number of C's Number of steps
ACCCX 3 38
ACCCCX 4 71
ACCCCCX 5 136
ACCCCCCCCCCCCCCX 14 65,553

By the time the string includes 14 C's, the engine has to take over 65,000 steps just to see if the string is valid. These extreme situations can cause them to work very slowly (exponentially related to input size, as shown above), allowing an attacker to exploit this and can cause the service to excessively consume CPU, resulting in a Denial of Service.

Remediation

Upgrade validator to version 9.4.1 or higher.

References