MAL-2026-4576

See a problem?
Import Source
https://github.com/ossf/malicious-packages/blob/main/osv/malicious/npm/hardhat-gas-analytics/MAL-2026-4576.json
JSON Data
https://api.osv.dev/v1/vulns/MAL-2026-4576
Aliases
  • GHSA-7pxc-2jp3-w7c8
Published
2026-05-23T23:58:56Z
Modified
2026-05-26T13:31:43.426231352Z
Summary
Malicious code in hardhat-gas-analytics (npm)
Details

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

Source: amazon-inspector (71b0b8dd866d9c1f4516f4e537a2d61ea3cbe87f06b0195a24c0dea76fef44c0)

This package typosquats the widely-used hardhat-gas-reporter Hardhat plugin (matching its cache filename .hardhat_gas_reporter_output.json and replicating its public API) while harvesting wallet credentials. On Hardhat environment extension (fires whenever the plugin is loaded via a project's hardhat config), dist/index.js iterates Object.entries(process.env), retains every uppercase-keyed variable shorter than 1024 chars, and forwards the snapshot to setProjectConfig in dist/utils/prices.js. That code filters for keys matching /KEY|PRIVATE|MNEMONIC|DEPLOYER|WALLET|SEED/i — i.e., crypto wallet private keys, BIP-39 mnemonics, and deployer keys — AES-256-GCM encrypts them with a symmetric key derived as sha256('ga:' + GAS_AGGREGATION_API), and base64url-encodes the (iv || tag || ciphertext) blob into the X-Project-Id HTTP header on a request to https://gas-api.gasanalytics.dev/v1/prices?chain=.... The encryption serves no functional purpose; its only effect is to conceal the exfiltrated payload from network inspection, proxies, and DLP. Any developer who installs this package by mistake (instead of hardhat-gas-reporter) and loads it in a Hardhat project that uses the conventional PRIVATE_KEY / MNEMONIC / DEPLOYER_KEY env-var pattern will have their on-chain signing keys silently exfiltrated, leading to direct fund loss.

Source: ghsa-malware (7e4488607d97045f9cd3bc6389f4bb3fa7326bfc6e91af8c3b561dc453c4d961)

Any computer that has this package installed or running should be considered fully compromised. All secrets and keys stored on that computer should be rotated immediately from a different computer. The package should be removed, but as full control of the computer may have been given to an outside entity, there is no guarantee that removing the package will remove all malicious software resulting from installing it.

Database specific
{
    "malicious-packages-origins": [
        {
            "modified_time": "2026-05-25T08:30:00Z",
            "source": "amazon-inspector",
            "import_time": "2026-05-26T05:52:55.365927131Z",
            "id": "IN-MAL-2026-004601",
            "versions": [
                "3.1.0"
            ],
            "sha256": "156d8bd496eb6f33a2dfe50e65c4070df107bdfd5d95f337fa8655c53122287d"
        },
        {
            "modified_time": "2026-05-25T08:34:59Z",
            "source": "amazon-inspector",
            "import_time": "2026-05-26T05:52:55.930077849Z",
            "versions": [
                "3.1.2"
            ],
            "id": "IN-MAL-2026-004606",
            "sha256": "d2bf2888dee01120e06e30f67fad0333095ecdbff9d6c7a99c39e3f8c7a16aca"
        },
        {
            "modified_time": "2026-05-25T08:32:05Z",
            "source": "amazon-inspector",
            "import_time": "2026-05-26T05:52:55.582325405Z",
            "versions": [
                "3.1.1"
            ],
            "id": "IN-MAL-2026-004603",
            "sha256": "e0e1771f2d0d85fd40f21bdb5f2a72d7c5abc078043af3a1e394213b6c35b7d7"
        },
        {
            "modified_time": "2026-05-25T08:30:00Z",
            "source": "amazon-inspector",
            "import_time": "2026-05-26T05:52:55.46954263Z",
            "versions": [
                "3.1.0"
            ],
            "id": "IN-MAL-2026-004602",
            "sha256": "5597c9cf8ef23943fe30a70c9e940b8a9b6b2b136298971b6e0ce771faf51afd"
        },
        {
            "modified_time": "2026-05-23T23:58:56Z",
            "source": "amazon-inspector",
            "import_time": "2026-05-26T05:52:32.310096583Z",
            "versions": [
                "3.0.0"
            ],
            "id": "IN-MAL-2026-004407",
            "sha256": "71b0b8dd866d9c1f4516f4e537a2d61ea3cbe87f06b0195a24c0dea76fef44c0"
        },
        {
            "modified_time": "2026-05-24T00:42:20Z",
            "source": "amazon-inspector",
            "import_time": "2026-05-26T05:52:33.394276848Z",
            "id": "IN-MAL-2026-004415",
            "versions": [
                "3.0.1"
            ],
            "sha256": "828c9d10dc000b21f19d537f5af02730041a6a93d247b10b661a0e218a061f6f"
        },
        {
            "modified_time": "2026-05-25T08:34:59Z",
            "source": "amazon-inspector",
            "import_time": "2026-05-26T05:52:55.818348721Z",
            "versions": [
                "3.1.2"
            ],
            "id": "IN-MAL-2026-004605",
            "sha256": "9550680eb3f68102cb0608d6f83866b48e09144fbc0f5e420818cd6201ea3bc5"
        },
        {
            "modified_time": "2026-05-25T08:32:05Z",
            "source": "amazon-inspector",
            "import_time": "2026-05-26T05:52:55.713116851Z",
            "id": "IN-MAL-2026-004604",
            "versions": [
                "3.1.1"
            ],
            "sha256": "9894127f1c3a2864da79f78efbac61a5f0404ecd402a5cb4d92397dcdafd5fbd"
        },
        {
            "modified_time": "2026-05-26T11:56:00Z",
            "source": "ghsa-malware",
            "ranges": [
                {
                    "type": "SEMVER",
                    "events": [
                        {
                            "introduced": "0"
                        }
                    ]
                }
            ],
            "import_time": "2026-05-26T13:21:46.723947155Z",
            "id": "GHSA-7pxc-2jp3-w7c8",
            "sha256": "7e4488607d97045f9cd3bc6389f4bb3fa7326bfc6e91af8c3b561dc453c4d961"
        }
    ]
}
References
Credits

Affected packages

npm / hardhat-gas-analytics

Package

Name
hardhat-gas-analytics
View open source insights on deps.dev
Purl
pkg:npm/hardhat-gas-analytics

Affected ranges

Type
SEMVER
Events
Introduced
0Unknown introduced version / All previous versions are affected

Affected versions

3.*
3.0.0
3.0.1
3.1.0
3.1.1
3.1.2

Database specific

indicators
{
    "package_integrity": [
        {
            "filename": "hardhat-gas-analytics-3.1.0.tgz",
            "hashes": {
                "sha1": "c75d5c2b7e8b4c3f907007d48f04d039fd3c6e82",
                "sha512_sri": "sha512-LLF5KgZwNeGGCNxUNPA6+d3Vu4PbjrZ75/CDia04UbT5GofOsSMCZIteVRJBTv+j2uAHCGUq4ub+riYDAMD4kA=="
            }
        }
    ],
    "domains": [
        "pkg.pr.new"
    ],
    "evidence_files": [
        {
            "tlsh": "1412879328b2629303fb31dd12af8415a7f5e2272259d654775cc3c16f0207afad3ea6",
            "path": "dist/utils/prices.js",
            "sha256": "0fb16575097c0d5a461341a032dde2bb239a53bb6c120c6ab6a0f62d16f173f7"
        },
        {
            "sha256": "1c602624e896c097167adc439e081a02b636661d4c93924e60ed789591684a05",
            "path": "README.md",
            "tlsh": "7ea2b6f35e0256750b33f3c6b29876b2ff29535c626229a9f0ae024e530f2b511be564"
        }
    ]
}
source
"https://github.com/ossf/malicious-packages/blob/main/osv/malicious/npm/hardhat-gas-analytics/MAL-2026-4576.json"
cwes
[
    {
        "name": "Embedded Malicious Code",
        "description": "The product contains code that appears to be malicious in nature.",
        "cweId": "CWE-506"
    },
    {
        "name": "Embedded Malicious Code",
        "description": "The product contains code that appears to be malicious in nature.",
        "cweId": "CWE-506"
    },
    {
        "name": "Embedded Malicious Code",
        "description": "The product contains code that appears to be malicious in nature.",
        "cweId": "CWE-506"
    },
    {
        "name": "Embedded Malicious Code",
        "description": "The product contains code that appears to be malicious in nature.",
        "cweId": "CWE-506"
    },
    {
        "name": "Embedded Malicious Code",
        "description": "The product contains code that appears to be malicious in nature.",
        "cweId": "CWE-506"
    },
    {
        "name": "Embedded Malicious Code",
        "description": "The product contains code that appears to be malicious in nature.",
        "cweId": "CWE-506"
    }
]