mal-2026-6718
Vulnerability from ossf_malicious_packages
Published
2026-07-01 20:47
Modified
2026-07-01 21:06
Summary
Malicious code in test-pkg-yarn (npm)
Details

-= Per source details. Do not edit below this line.=-

Source: amazon-inspector (40b74339843ee482f3f135dd43e855f1f30758e20857333e0e6153748888769a)

package.json declares bin: { "node": "./shim.js" }, causing npm/yarn to symlink node in node_modules/.bin (and in a system bin dir on global install) to a package-controlled script. Subsequent invocations of node resolved through that PATH entry execute shim.js instead of the real Node.js runtime, redirecting any tooling that expects node to attacker-controlled code. In addition, scripts.postinstall runs bun shim.js || node shim.js, and shim.js unconditionally invokes OS commands at install time via child_process.execSync — spawning a GUI calculator (calc on Windows, gnome-calculator on Linux, open -a Calculator on macOS), opening a URL in the user's browser, and writing a marker file to /tmp/.bun-npm-pwned. The package self-identifies as 'BunnyHijack PoC - yarn variant' with the console message '[!] PATH POISONED - test-pkg-yarn just hijacked your node command.' Although framed as a proof-of-concept and not currently exfiltrating data, the behavior is real install-time code execution against any developer who installs the package and a persistent hijack of the node command in PATH.

CWE
  • CWE-506 - The product contains code that appears to be malicious in nature.
  • CWE-506 - The product contains code that appears to be malicious in nature.
  • CWE-506 - The product contains code that appears to be malicious in nature.
Credits

{
  "affected": [
    {
      "database_specific": {
        "cwes": [
          {
            "cweId": "CWE-506",
            "description": "The product contains code that appears to be malicious in nature.",
            "name": "Embedded Malicious Code"
          },
          {
            "cweId": "CWE-506",
            "description": "The product contains code that appears to be malicious in nature.",
            "name": "Embedded Malicious Code"
          },
          {
            "cweId": "CWE-506",
            "description": "The product contains code that appears to be malicious in nature.",
            "name": "Embedded Malicious Code"
          }
        ],
        "indicators": {
          "evidence_files": [
            {
              "path": "package.json",
              "sha256": "0a5b47939c9280af09b961619c386fea57ca3b197dd5003b41ceca244e89bbc7",
              "tlsh": "dbd02b1088b1577325cd38905d6da403673c4b4780043c2c53d7119cab4a7bb08b9255"
            },
            {
              "path": "shim.js",
              "sha256": "3a0197615cc4fd1bbea22a9355a5d69fdbfe7a23f2a21c5a5afc17b4e6b5f6fa",
              "tlsh": "3f316062c2e193b16ef619c2568b443175abdaa37240ffa4f29ec2225f4901203f74b8"
            }
          ],
          "package_integrity": [
            {
              "filename": "test-pkg-yarn-1.0.2.tgz",
              "hashes": {
                "sha1": "932e1e7951721bf60858bb5db11e58073c676b1e",
                "sha512_sri": "sha512-ZsZYjMO1aXwPqfM07+ryLjfRDcXPnQ/ZvvfsZrSpGi4Kixj+NU6EfcJfwRhtJUK0wdmmiIdHUoPx26tMDvYMCg=="
              }
            }
          ]
        }
      },
      "package": {
        "ecosystem": "npm",
        "name": "test-pkg-yarn"
      },
      "versions": [
        "1.0.2",
        "1.0.1",
        "1.0.0"
      ]
    }
  ],
  "credits": [
    {
      "contact": [
        "inspector-research@amazon.com"
      ],
      "name": "Amazon Inspector",
      "type": "FINDER"
    }
  ],
  "database_specific": {
    "malicious-packages-origins": [
      {
        "id": "IN-MAL-2026-007897",
        "import_time": "2026-07-01T21:04:20.755909312Z",
        "modified_time": "2026-07-01T20:47:51Z",
        "sha256": "11e7c03fcf57c76835129d9a0c35cc8b0ad262e164929fed2b0452f2d83eb44f",
        "source": "amazon-inspector",
        "versions": [
          "1.0.2"
        ]
      },
      {
        "id": "IN-MAL-2026-007899",
        "import_time": "2026-07-01T21:04:20.868827675Z",
        "modified_time": "2026-07-01T20:48:08Z",
        "sha256": "40b74339843ee482f3f135dd43e855f1f30758e20857333e0e6153748888769a",
        "source": "amazon-inspector",
        "versions": [
          "1.0.1"
        ]
      },
      {
        "id": "IN-MAL-2026-007898",
        "import_time": "2026-07-01T21:04:20.787779869Z",
        "modified_time": "2026-07-01T20:47:57Z",
        "sha256": "c94364f82778798bd6d381c0359adb0f0eb92676036c117640d0370810b7ab2e",
        "source": "amazon-inspector",
        "versions": [
          "1.0.0"
        ]
      }
    ]
  },
  "details": "\n---\n_-= Per source details. Do not edit below this line.=-_\n\n## Source: amazon-inspector (40b74339843ee482f3f135dd43e855f1f30758e20857333e0e6153748888769a)\npackage.json declares `bin: { \"node\": \"./shim.js\" }`, causing `npm`/`yarn` to symlink `node` in `node_modules/.bin` (and in a system bin dir on global install) to a package-controlled script. Subsequent invocations of `node` resolved through that PATH entry execute shim.js instead of the real Node.js runtime, redirecting any tooling that expects `node` to attacker-controlled code. In addition, `scripts.postinstall` runs `bun shim.js || node shim.js`, and shim.js unconditionally invokes OS commands at install time via `child_process.execSync` \u2014 spawning a GUI calculator (`calc` on Windows, `gnome-calculator` on Linux, `open -a Calculator` on macOS), opening a URL in the user\u0027s browser, and writing a marker file to `/tmp/.bun-npm-pwned`. The package self-identifies as \u0027BunnyHijack PoC - yarn variant\u0027 with the console message \u0027[!] PATH POISONED - test-pkg-yarn just hijacked your node command.\u0027 Although framed as a proof-of-concept and not currently exfiltrating data, the behavior is real install-time code execution against any developer who installs the package and a persistent hijack of the `node` command in PATH.\n",
  "id": "MAL-2026-6718",
  "modified": "2026-07-01T21:06:12Z",
  "published": "2026-07-01T20:47:51Z",
  "references": [
    {
      "type": "PACKAGE",
      "url": "https://www.npmjs.com/package/test-pkg-yarn/v/1.0.2"
    },
    {
      "type": "PACKAGE",
      "url": "https://www.npmjs.com/package/test-pkg-yarn/v/1.0.1"
    },
    {
      "type": "PACKAGE",
      "url": "https://www.npmjs.com/package/test-pkg-yarn/v/1.0.0"
    }
  ],
  "schema_version": "1.7.4",
  "summary": "Malicious code in test-pkg-yarn (npm)"
}


Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Sightings

Author Source Type Date

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.


Loading…

Detection rules are retrieved from Rulezet.

Loading…

Loading…