Exploit database

GH-62bce6cbafd667aad41f8428cda91b50

completetech-security/node2shell-check

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-111497

61 sources

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source

Repository files25
completetech-security/node2shell-checkRevision eb4e2b061269

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

test_build_context.py

Python · 2,451 bytes
from pathlib import Path
import importlib.util
import json
import tempfile
import unittest
spec=importlib.util.spec_from_file_location('context',Path(__file__).parent/'tools/inspect-node-build-context.py')
c=importlib.util.module_from_spec(spec);spec.loader.exec_module(c)


class BuildContextTests(unittest.TestCase):
    def test_engine_declarations_are_not_runtime_versions(self):
        with tempfile.TemporaryDirectory() as directory:
            path=Path(directory)/'metadata.json'
            for data in ({'engines':{'node':'>=22 <27'},'scripts':{'postinstall':'NEVER-EXECUTE'},'resolved':'https://SECRET.invalid'},
                         {'lockfileVersion':1,'dependencies':{'outer':{'engines':{'node':'>=22 <27'}}}},
                         {'lockfileVersion':2,'packages':{'node_modules/outer':{'engines':{'node':'>=22 <27'}}}},
                         {'lockfileVersion':3,'packages':{'node_modules/outer':{'engines':{'node':'>=22 <27'}}}}):
                path.write_text(json.dumps(data),encoding='utf-8');result=c.inspect(path)
                self.assertEqual('',result['runtime_version']);self.assertEqual('>=22 <27',result['observations'][0]['declared_node_range'])
                self.assertNotIn('SECRET',json.dumps(result));self.assertNotIn('NEVER-EXECUTE',json.dumps(result))
            path.write_text('{"engines":{"node":"https://SECRET.invalid"}}',encoding='utf-8')
            self.assertEqual('',c.inspect(path)['observations'][0]['declared_node_range'])

    def test_malformed_bounds_paths_and_absence(self):
        with tempfile.TemporaryDirectory() as directory:
            path=Path(directory)/'metadata.json'
            for text in ('{"engines":{},"engines":{}}','{"lockfileVersion":true}','{"lockfileVersion":3,"packages":{"../outside":{}}}','{"engines":[]}'):
                path.write_text(text,encoding='utf-8')
                with self.assertRaises(ValueError):c.inspect(path)
            for name in ('.','..','@scope/.','@scope/..'):
                path.write_text(json.dumps(dict(lockfileVersion=1,dependencies={name:dict(engines=dict(node='>=22'))})),encoding='utf-8')
                with self.assertRaises(ValueError):c.inspect(path)
            path.write_text('{}',encoding='utf-8');self.assertEqual([],c.inspect(path)['observations'])
            path.write_bytes(b' '*(4*1024**2+1))
            with self.assertRaises(ValueError):c.inspect(path)


if __name__=='__main__':unittest.main()