GHSA-mxjr-xmcg-fg7w

Suggest an improvement
Source
https://github.com/advisories/GHSA-mxjr-xmcg-fg7w
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2019/06/GHSA-mxjr-xmcg-fg7w/GHSA-mxjr-xmcg-fg7w.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-mxjr-xmcg-fg7w
Published
2019-06-27T17:25:21Z
Modified
2021-08-17T15:41:58Z
Severity
  • 6.5 (Medium) CVSS_V3 - CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N CVSS Calculator
Summary
Arbitrary Code Injection in mobile-icon-resizer
Details

mobile-icon-resizer resizes large images for use as icons for iOS and Android.

mobile-icon-resizer has a code execution vulnerability in versions before 0.4.3.

mobile-icon-resizer takes an options object as an argument to define the resulting icons as such:

var options = {
  config: './config.js'
}
resize(options, function(err){});

config.js would need to be a file on the filesystem and look something like:

var config = {
  iOS: {
    "images": [
     /* iOS image definitions are not vulnerable */
    ]
  },
  android: {
    "images" : [
      {
        "baseRatio" : "console.log('Executing script as baseRatio property')",
        "folder" : "drawable-ldpi"
      },
      {
        "ratio" : "console.log('Executing script as ratio property')",
        "folder" : "drawable-mdpi"
      },
    /* other android image defintiions ... */
    ]
  }
};

exports = module.exports = config;

The parameters ratio and baseRatio are passed directly to eval(), thus allowing dynamic javascript payloads to be executed.

Recommendation

Update to version 0.4.3 or later.

Database specific
{
    "cwe_ids":  [
        "CWE-94"
    ],
    "github_reviewed":  true,
    "github_reviewed_at":  "2019-06-27T15:58:50Z",
    "nvd_published_at":  null,
    "severity":  "MODERATE"
}
References

Affected packages

npm / mobile-icon-resizer

Package

Name
mobile-icon-resizer
View open source insights on deps.dev
Purl
pkg:npm/mobile-icon-resizer

Affected ranges

Type
SEMVER
Events
Introduced
0.2.0
Fixed
0.4.3

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2019/06/GHSA-mxjr-xmcg-fg7w/GHSA-mxjr-xmcg-fg7w.json"