CVE-2026-54916: NetBox Device Type Library: Module Shadowing Bypass of prior pickle fix - RCE via missing `tests/__init__.py` + SSRF via unfixed `NETBOX_DT_LIBRARY_URL` → Cloud Metadata credential theft
NetBox Device Type Library is a collection of community-sourced device type definitions for import into NetBox. The absence of tests/init.py and the lack of --import-mode=importlib cause pytest prepend import mode to place the tests directory at the front of sys.path during collection. An unauthenticated contributor can add a module such as tests/git.py that shadows GitPython when tests/definitionstest.py executes from git import Git, Repo, or add tests/conftest.py for automatic collection-time execution. Python imports and runs the pull-request module before any test function, allowing arbitrary code execution on the GitHub Actions runner, test-result tampering, and access to tokens or network resources exposed to the workflow. This module-shadowing path is independent of the earlier pickle deserialization flaw and the separately tracked NETBOXDTLIBRARYURL issue. This vulnerability is fixed by commit b0d9a3dadd0a0a9d3c93b0b2777559fd4bad1037.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
NetBox Device Type Library / NetBox tests module-shadowing fixto a version that resolves this vulnerability.Patch b0d9a3dadd0a0a9d3c93b0b2777559fd4bad1037 - Configuration
Run pytest with --import-mode=importlib so pytest does not prepend the tests directory to sys.path during collection (prevents module shadowing).
pytest import-mode = importlib - Configuration
Ensure tests/__init__.py exists so the tests directory is treated as a package and cannot be used for import-time module shadowing during pytest collection.
tests package tests/__init__.py presence = present - Compensating control
Mitigate SSRF/credential theft risk by addressing the unfixed NETBOX_DT_LIBRARY_URL setting (the material states it leads to Cloud Metadata credential theft).
Event History
Frequently Asked Questions
Who is exposed to this issue?
GitHub Actions workflows that run the affected pytest configuration on untrusted pull requests are exposed. An unauthenticated contributor can supply a pull-request module that is imported during test collection and executes on the runner.
What does an attacker need to exploit it?
The attacker needs the ability to contribute a pull request containing a shadowing module such as tests/git.py, or a tests/conftest.py file. No credentials are required, and execution occurs before test functions run.
What could an attacker do after successful exploitation?
They can execute arbitrary code on the GitHub Actions runner, tamper with test results, and access workflow-exposed tokens or reachable network resources. The described impact includes theft of cloud metadata credentials where the runner can access metadata services.
How can this be remediated?
Apply the fix in commit b0d9a3dadd0a0a9d3c93b0b2777559fd4bad1037. The issue is associated with pytest prepend import mode and the missing tests/__init__.py.
Is this the same issue as the prior pickle flaw or NETBOX_DT_LIBRARY_URL issue?
No. The module-shadowing execution path is independent of the earlier pickle deserialization flaw and of the separately tracked NETBOX_DT_LIBRARY_URL issue.