{
  "schema_version": "1.4.0",
  "id": "GHSA-mxjr-xmcg-fg7w",
  "modified": "2021-08-17T15:41:58Z",
  "published": "2019-06-27T17:25:21Z",
  "aliases": [],
  "summary": "Arbitrary Code Injection in mobile-icon-resizer",
  "details": "mobile-icon-resizer resizes large images for use as icons for iOS and Android.\n\nmobile-icon-resizer has a code execution vulnerability in versions before 0.4.3.\n\nmobile-icon-resizer takes an options object as an argument to define the resulting icons as such:\n```\nvar options = {\n  config: './config.js'\n}\nresize(options, function(err){});\n```\nconfig.js would need to be a file on the filesystem and look something like:\n```\nvar config = {\n  iOS: {\n    \"images\": [\n     /* iOS image definitions are not vulnerable */\n    ]\n  },\n  android: {\n    \"images\" : [\n      {\n        \"baseRatio\" : \"console.log('Executing script as baseRatio property')\",\n        \"folder\" : \"drawable-ldpi\"\n      },\n      {\n        \"ratio\" : \"console.log('Executing script as ratio property')\",\n        \"folder\" : \"drawable-mdpi\"\n      },\n    /* other android image defintiions ... */\n    ]\n  }\n};\n\nexports = module.exports = config;\n```\nThe parameters `ratio` and `baseRatio` are passed directly to `eval()`, thus allowing dynamic javascript payloads to be executed.\n\n\n## Recommendation\n\nUpdate to version 0.4.3 or later.",
  "severity": [
    {
      "type": "CVSS_V3",
      "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N"
    }
  ],
  "affected": [
    {
      "package": {
        "ecosystem": "npm",
        "name": "mobile-icon-resizer"
      },
      "ranges": [
        {
          "type": "ECOSYSTEM",
          "events": [
            {
              "introduced": "0.2.0"
            },
            {
              "fixed": "0.4.3"
            }
          ]
        }
      ]
    }
  ],
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/muzzley/mobile-icon-resizer/issues/8"
    },
    {
      "type": "WEB",
      "url": "https://github.com/muzzley/mobile-icon-resizer/commit/a6c50f884bd282d74ab77e1fce6317d5d0dd2f0f"
    },
    {
      "type": "WEB",
      "url": "https://snyk.io/vuln/npm:mobile-icon-resizer:20160408"
    },
    {
      "type": "WEB",
      "url": "https://www.npmjs.com/advisories/317"
    }
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "severity": "MODERATE",
    "github_reviewed": true,
    "github_reviewed_at": "2019-06-27T15:58:50Z",
    "nvd_published_at": null
  }
}