litellm-check 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- litellm_check-0.1.0/LICENSE +198 -0
- litellm_check-0.1.0/PKG-INFO +107 -0
- litellm_check-0.1.0/README.md +82 -0
- litellm_check-0.1.0/pyproject.toml +52 -0
- litellm_check-0.1.0/setup.cfg +4 -0
- litellm_check-0.1.0/src/litellm_check/__init__.py +14 -0
- litellm_check-0.1.0/src/litellm_check/__main__.py +4 -0
- litellm_check-0.1.0/src/litellm_check/cli.py +93 -0
- litellm_check-0.1.0/src/litellm_check/incident.py +78 -0
- litellm_check-0.1.0/src/litellm_check/report.py +214 -0
- litellm_check-0.1.0/src/litellm_check/rules/litellm.rules.json +128 -0
- litellm_check-0.1.0/src/litellm_check/rules.py +95 -0
- litellm_check-0.1.0/src/litellm_check/scanner.py +560 -0
- litellm_check-0.1.0/src/litellm_check/specs.py +241 -0
- litellm_check-0.1.0/src/litellm_check.egg-info/PKG-INFO +107 -0
- litellm_check-0.1.0/src/litellm_check.egg-info/SOURCES.txt +23 -0
- litellm_check-0.1.0/src/litellm_check.egg-info/dependency_links.txt +1 -0
- litellm_check-0.1.0/src/litellm_check.egg-info/entry_points.txt +2 -0
- litellm_check-0.1.0/src/litellm_check.egg-info/requires.txt +4 -0
- litellm_check-0.1.0/src/litellm_check.egg-info/top_level.txt +1 -0
- litellm_check-0.1.0/tests/test_cli.py +35 -0
- litellm_check-0.1.0/tests/test_report.py +40 -0
- litellm_check-0.1.0/tests/test_rules_sync.py +10 -0
- litellm_check-0.1.0/tests/test_scanner.py +85 -0
- litellm_check-0.1.0/tests/test_specs.py +72 -0
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, in at least one of the following
|
|
110
|
+
places: within a NOTICE text file distributed as part of the
|
|
111
|
+
Derivative Works; within the Source form or documentation,
|
|
112
|
+
if provided along with the Derivative Works; or, within a
|
|
113
|
+
display generated by the Derivative Works, if and wherever
|
|
114
|
+
such third-party notices normally appear. The contents of
|
|
115
|
+
the NOTICE file are for informational purposes only and
|
|
116
|
+
do not modify the License. You may add Your own attribution
|
|
117
|
+
notices within Derivative Works that You distribute, alongside
|
|
118
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
119
|
+
that such additional attribution notices cannot be construed
|
|
120
|
+
as modifying the License.
|
|
121
|
+
|
|
122
|
+
You may add Your own copyright statement to Your modifications and
|
|
123
|
+
may provide additional or different license terms and conditions
|
|
124
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
125
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
126
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
127
|
+
the conditions stated in this License.
|
|
128
|
+
|
|
129
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
130
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
131
|
+
by you to the Licensor shall be under the terms and conditions of
|
|
132
|
+
this License, without any additional terms or conditions.
|
|
133
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
134
|
+
the terms of any separate license agreement you may have executed
|
|
135
|
+
with Licensor regarding such Contributions.
|
|
136
|
+
|
|
137
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
138
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
139
|
+
except as required for reasonable and customary use in describing the
|
|
140
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
141
|
+
|
|
142
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
143
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
144
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
145
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
146
|
+
implied, including, without limitation, any warranties or conditions
|
|
147
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
148
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
149
|
+
appropriateness of using the Work and assume any risks associated
|
|
150
|
+
with Your use of the Work.
|
|
151
|
+
|
|
152
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
153
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
154
|
+
unless required by applicable law (such as deliberate and grossly
|
|
155
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
156
|
+
liable to You for damages, including any direct, indirect, special,
|
|
157
|
+
incidental, or consequential damages of any kind arising as a result
|
|
158
|
+
of any legal theory, including, but not limited to loss of profits,
|
|
159
|
+
loss of goodwill, loss of work stoppage, computer failure or malfunction,
|
|
160
|
+
or all other commercial damages or losses, even if such Contributor
|
|
161
|
+
has been advised of the possibility of such damages.
|
|
162
|
+
|
|
163
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
164
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
165
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
166
|
+
or other liability obligations and/or rights consistent with this
|
|
167
|
+
License. However, in accepting such obligations, You may act only
|
|
168
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
169
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
170
|
+
defend, and hold each Contributor harmless for any liability
|
|
171
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
172
|
+
of your accepting any such warranty or additional liability.
|
|
173
|
+
|
|
174
|
+
END OF TERMS AND CONDITIONS
|
|
175
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
176
|
+
|
|
177
|
+
To apply the Apache License to your work, attach the following
|
|
178
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
179
|
+
replaced with your own identifying information. (Don't include
|
|
180
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
181
|
+
comment syntax for the file format. We also recommend that a
|
|
182
|
+
file or class name and description of purpose be included on the
|
|
183
|
+
same "printed page" as the copyright notice for easier
|
|
184
|
+
identification within third-party archives.
|
|
185
|
+
|
|
186
|
+
Copyright 2026 Dylan XM
|
|
187
|
+
|
|
188
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
189
|
+
you may not use this file except in compliance with the License.
|
|
190
|
+
You may obtain a copy of the License at
|
|
191
|
+
|
|
192
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
193
|
+
|
|
194
|
+
Unless required by applicable law or agreed to in writing, software
|
|
195
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
196
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
197
|
+
See the License for the specific language governing permissions and
|
|
198
|
+
limitations under the License.
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: litellm-check
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Self-audit CLI: scan a codebase and local Python environments for exposure to the compromised LiteLLM v1.107.0 release (PyPI, Docker Hub, GHCR) and generate an evidence report, based solely on LiteLLM's official incident announcement.
|
|
5
|
+
Author: Dylan XM
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/dylanXM/litellm-check
|
|
8
|
+
Project-URL: Repository, https://github.com/dylanXM/litellm-check
|
|
9
|
+
Project-URL: Issues, https://github.com/dylanXM/litellm-check/issues
|
|
10
|
+
Project-URL: Announcement, https://docs.litellm.ai/blog/security-incident-oct-21-2026
|
|
11
|
+
Keywords: litellm,supply-chain,security,scanner,incident-response,ioc
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: System Administrators
|
|
15
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Topic :: Security
|
|
18
|
+
Requires-Python: >=3.11
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
Provides-Extra: dev
|
|
22
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
23
|
+
Requires-Dist: ruff>=0.6; extra == "dev"
|
|
24
|
+
Dynamic: license-file
|
|
25
|
+
|
|
26
|
+
# litellm-check
|
|
27
|
+
|
|
28
|
+
**Did the compromised LiteLLM v1.107.0 release touch your code, your images, or your Python environments?** `litellm-check` scans a source tree and/or local Python environments for the exposure surface of the 2026-10-21 LiteLLM supply-chain incident and writes an evidence report (Markdown or JSON).
|
|
29
|
+
|
|
30
|
+
Every detection rule is derived from LiteLLM's **official incident announcement** — [“Contained: Oct 21, 2026 LiteLLM release v1.107.0 Compromised”](https://docs.litellm.ai/blog/security-incident-oct-21-2026) (last updated 2026-10-21 20:30 UTC). No third-party IOC lists are used. The tool collects evidence only; **it never certifies an environment as safe** — the announcement itself warns that not finding an indicator does not prove an environment is clean.
|
|
31
|
+
|
|
32
|
+
Zero third-party dependencies. Python 3.11+. It reads files only and **never executes Python (or pip) inside a scanned environment** — which matters, because the announcement warns that any Python start in an affected environment re-runs the implant.
|
|
33
|
+
|
|
34
|
+
## Install
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pip install litellm-check # or from a checkout:
|
|
38
|
+
pip install .
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Usage
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# Scan a project checkout
|
|
45
|
+
litellm-check scan ~/src/my-service
|
|
46
|
+
|
|
47
|
+
# Scan where your virtualenvs live (this is how you check installed envs)
|
|
48
|
+
litellm-check scan ~/projects --format json --out report.json
|
|
49
|
+
|
|
50
|
+
# CI gate: fail the job if any critical indicator is present
|
|
51
|
+
litellm-check scan . --fail-on critical
|
|
52
|
+
|
|
53
|
+
# Equivalent without installing
|
|
54
|
+
python -m litellm_check scan <path>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Exit codes: `0` = scan completed (findings are reported, not gated), `1` = a finding met the `--fail-on` threshold, `2` = usage error.
|
|
58
|
+
|
|
59
|
+
## What it scans
|
|
60
|
+
|
|
61
|
+
| Surface | Files | What is evaluated |
|
|
62
|
+
|---|---|---|
|
|
63
|
+
| Dependency manifests | `requirements*.txt`, `pyproject.toml` (PEP 621 deps, optional-deps, PEP 735 dependency-groups, Poetry), `Pipfile`, `setup.py`, `setup.cfg`, conda `environment.yml` | The version spec is **evaluated**, not grepped: does it pin exactly `1.107.0` (critical), admit it — unpinned, `>=`, `~=`, Poetry `^`/`~`, wildcards (high) — or exclude it (info) |
|
|
64
|
+
| Lockfiles | `poetry.lock`, `uv.lock`, `Pipfile.lock` | The resolved litellm version: `1.107.0` = critical |
|
|
65
|
+
| Container definitions | `Dockerfile*`, `docker-compose*.yml` | Image tags `v1.107.0` (critical) and `latest` / `main-latest` / `main-stable` / untagged (high, they pointed at the bad image during the window); the compromised image digest anywhere in any text file (critical); GHCR digests — the announcement publishes them truncated, so those are prefix-matched and labelled as such |
|
|
66
|
+
| Installed environments | any `litellm-*.dist-info` in the tree (e.g. under `.venv/`, `env/`, system site-packages you point it at) | This is the announcement's `pip show litellm` check, done by reading metadata: version `1.107.0` = critical, other versions = info |
|
|
67
|
+
| Implant & marker files | anywhere in the tree | `litellm-1.107.0.dist-info`, `cook.pth`, `cook.py`, `sitecustomize.py`, `__pycache__` implant bytecode, `remote_code_loader.lock` — the exact filenames the announcement tells you to search for and delete. Critical when inside a `site-packages` directory |
|
|
68
|
+
|
|
69
|
+
Rule IDs `LL-001` … `LL-013` with the incident basis and remediation for each live in [`rules/litellm.rules.json`](rules/litellm.rules.json) and are printed in full in every report.
|
|
70
|
+
|
|
71
|
+
## What it does not scan / cannot prove
|
|
72
|
+
|
|
73
|
+
- **A clean report is not a clean bill of health.** Environments rebuilt or deleted after exposure, images pulled without any definition file in the tree, and anything recorded only in CI logs / shell history / registry audit logs leave nothing for this tool to find.
|
|
74
|
+
- “Admits” findings (LL-003, LL-007) mark **exposure surface**, not proof of installation: whether an unpinned spec actually resolved to 1.107.0 depends on whether an install ran inside the announced windows (PyPI 2026-10-21 11:39:51–13:23 UTC; Docker 11:46:56–14:20 UTC; GHCR until 13:51 UTC). Pair the scan with install timestamps.
|
|
75
|
+
- It does not inspect running processes, network/egress logs, image layers, or host state outside the directory you point it at (e.g. point it at `/tmp` too if you want the daemon lock-file check to cover the real `/tmp`).
|
|
76
|
+
- It does not hash installed files: the announcement publishes no wheel hashes, so no rule is built on hashes.
|
|
77
|
+
- Enterprise customers on LiteLLM's private registry were **not** impacted (per the announcement); this tool checks the public artifacts only.
|
|
78
|
+
|
|
79
|
+
## How to read the report
|
|
80
|
+
|
|
81
|
+
- **Summary by severity** — counts first. `critical` = an artifact the vendor says to treat as compromised is present. `high` = exposure that depends on install/pull timing, or an implant-named file outside `site-packages`. `info` = litellm present but pinned/resolved/installed at a version that excludes 1.107.0 (kept in the report so reviewers can see coverage, per the announcement that all pre-1.107.0 versions are safe).
|
|
82
|
+
- **Findings** — each with file:line evidence, the exact spec/tag/file matched, the incident basis (what the announcement says about it), and a remediation.
|
|
83
|
+
- **Vendor response steps** — condensed from the announcement's “What to do if you are affected”: do **not** start with `pip install` (it re-executes the implant); delete the implant files from the shell; kill the daemon holding `/tmp/remote_code_loader.lock`; rebuild pinned to `litellm==1.106.2`; rotate every secret the host could reach; check CloudTrail.
|
|
84
|
+
- **Detection limits** — the full statement above, printed in every report.
|
|
85
|
+
|
|
86
|
+
## Demo
|
|
87
|
+
|
|
88
|
+
[`examples/demo-project/`](examples/demo-project) is a deliberately exposed sample project (affected pin, floating tag, digest-pinned compose service, a fake `.venv` with inert stand-ins for the implant files). Its generated report is committed:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
litellm-check scan examples/demo-project
|
|
92
|
+
# 16 findings: 10 critical, 4 high, 2 info — see examples/sample-report.md
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Development
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
pip install -e ".[dev]"
|
|
99
|
+
pytest -q # 58 tests
|
|
100
|
+
ruff check src tests
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Layout mirrors the rules-as-data design: rule metadata in `rules/litellm.rules.json` (a byte-identical copy is bundled in the package; a test keeps them in sync), incident facts in `src/litellm_check/incident.py`, spec evaluation in `specs.py`, detectors in `scanner.py`.
|
|
104
|
+
|
|
105
|
+
## License
|
|
106
|
+
|
|
107
|
+
Apache-2.0. Not affiliated with BerriAI/LiteLLM; “LiteLLM” is used only to name the incident this tool audits.
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# litellm-check
|
|
2
|
+
|
|
3
|
+
**Did the compromised LiteLLM v1.107.0 release touch your code, your images, or your Python environments?** `litellm-check` scans a source tree and/or local Python environments for the exposure surface of the 2026-10-21 LiteLLM supply-chain incident and writes an evidence report (Markdown or JSON).
|
|
4
|
+
|
|
5
|
+
Every detection rule is derived from LiteLLM's **official incident announcement** — [“Contained: Oct 21, 2026 LiteLLM release v1.107.0 Compromised”](https://docs.litellm.ai/blog/security-incident-oct-21-2026) (last updated 2026-10-21 20:30 UTC). No third-party IOC lists are used. The tool collects evidence only; **it never certifies an environment as safe** — the announcement itself warns that not finding an indicator does not prove an environment is clean.
|
|
6
|
+
|
|
7
|
+
Zero third-party dependencies. Python 3.11+. It reads files only and **never executes Python (or pip) inside a scanned environment** — which matters, because the announcement warns that any Python start in an affected environment re-runs the implant.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pip install litellm-check # or from a checkout:
|
|
13
|
+
pip install .
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
# Scan a project checkout
|
|
20
|
+
litellm-check scan ~/src/my-service
|
|
21
|
+
|
|
22
|
+
# Scan where your virtualenvs live (this is how you check installed envs)
|
|
23
|
+
litellm-check scan ~/projects --format json --out report.json
|
|
24
|
+
|
|
25
|
+
# CI gate: fail the job if any critical indicator is present
|
|
26
|
+
litellm-check scan . --fail-on critical
|
|
27
|
+
|
|
28
|
+
# Equivalent without installing
|
|
29
|
+
python -m litellm_check scan <path>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Exit codes: `0` = scan completed (findings are reported, not gated), `1` = a finding met the `--fail-on` threshold, `2` = usage error.
|
|
33
|
+
|
|
34
|
+
## What it scans
|
|
35
|
+
|
|
36
|
+
| Surface | Files | What is evaluated |
|
|
37
|
+
|---|---|---|
|
|
38
|
+
| Dependency manifests | `requirements*.txt`, `pyproject.toml` (PEP 621 deps, optional-deps, PEP 735 dependency-groups, Poetry), `Pipfile`, `setup.py`, `setup.cfg`, conda `environment.yml` | The version spec is **evaluated**, not grepped: does it pin exactly `1.107.0` (critical), admit it — unpinned, `>=`, `~=`, Poetry `^`/`~`, wildcards (high) — or exclude it (info) |
|
|
39
|
+
| Lockfiles | `poetry.lock`, `uv.lock`, `Pipfile.lock` | The resolved litellm version: `1.107.0` = critical |
|
|
40
|
+
| Container definitions | `Dockerfile*`, `docker-compose*.yml` | Image tags `v1.107.0` (critical) and `latest` / `main-latest` / `main-stable` / untagged (high, they pointed at the bad image during the window); the compromised image digest anywhere in any text file (critical); GHCR digests — the announcement publishes them truncated, so those are prefix-matched and labelled as such |
|
|
41
|
+
| Installed environments | any `litellm-*.dist-info` in the tree (e.g. under `.venv/`, `env/`, system site-packages you point it at) | This is the announcement's `pip show litellm` check, done by reading metadata: version `1.107.0` = critical, other versions = info |
|
|
42
|
+
| Implant & marker files | anywhere in the tree | `litellm-1.107.0.dist-info`, `cook.pth`, `cook.py`, `sitecustomize.py`, `__pycache__` implant bytecode, `remote_code_loader.lock` — the exact filenames the announcement tells you to search for and delete. Critical when inside a `site-packages` directory |
|
|
43
|
+
|
|
44
|
+
Rule IDs `LL-001` … `LL-013` with the incident basis and remediation for each live in [`rules/litellm.rules.json`](rules/litellm.rules.json) and are printed in full in every report.
|
|
45
|
+
|
|
46
|
+
## What it does not scan / cannot prove
|
|
47
|
+
|
|
48
|
+
- **A clean report is not a clean bill of health.** Environments rebuilt or deleted after exposure, images pulled without any definition file in the tree, and anything recorded only in CI logs / shell history / registry audit logs leave nothing for this tool to find.
|
|
49
|
+
- “Admits” findings (LL-003, LL-007) mark **exposure surface**, not proof of installation: whether an unpinned spec actually resolved to 1.107.0 depends on whether an install ran inside the announced windows (PyPI 2026-10-21 11:39:51–13:23 UTC; Docker 11:46:56–14:20 UTC; GHCR until 13:51 UTC). Pair the scan with install timestamps.
|
|
50
|
+
- It does not inspect running processes, network/egress logs, image layers, or host state outside the directory you point it at (e.g. point it at `/tmp` too if you want the daemon lock-file check to cover the real `/tmp`).
|
|
51
|
+
- It does not hash installed files: the announcement publishes no wheel hashes, so no rule is built on hashes.
|
|
52
|
+
- Enterprise customers on LiteLLM's private registry were **not** impacted (per the announcement); this tool checks the public artifacts only.
|
|
53
|
+
|
|
54
|
+
## How to read the report
|
|
55
|
+
|
|
56
|
+
- **Summary by severity** — counts first. `critical` = an artifact the vendor says to treat as compromised is present. `high` = exposure that depends on install/pull timing, or an implant-named file outside `site-packages`. `info` = litellm present but pinned/resolved/installed at a version that excludes 1.107.0 (kept in the report so reviewers can see coverage, per the announcement that all pre-1.107.0 versions are safe).
|
|
57
|
+
- **Findings** — each with file:line evidence, the exact spec/tag/file matched, the incident basis (what the announcement says about it), and a remediation.
|
|
58
|
+
- **Vendor response steps** — condensed from the announcement's “What to do if you are affected”: do **not** start with `pip install` (it re-executes the implant); delete the implant files from the shell; kill the daemon holding `/tmp/remote_code_loader.lock`; rebuild pinned to `litellm==1.106.2`; rotate every secret the host could reach; check CloudTrail.
|
|
59
|
+
- **Detection limits** — the full statement above, printed in every report.
|
|
60
|
+
|
|
61
|
+
## Demo
|
|
62
|
+
|
|
63
|
+
[`examples/demo-project/`](examples/demo-project) is a deliberately exposed sample project (affected pin, floating tag, digest-pinned compose service, a fake `.venv` with inert stand-ins for the implant files). Its generated report is committed:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
litellm-check scan examples/demo-project
|
|
67
|
+
# 16 findings: 10 critical, 4 high, 2 info — see examples/sample-report.md
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Development
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
pip install -e ".[dev]"
|
|
74
|
+
pytest -q # 58 tests
|
|
75
|
+
ruff check src tests
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Layout mirrors the rules-as-data design: rule metadata in `rules/litellm.rules.json` (a byte-identical copy is bundled in the package; a test keeps them in sync), incident facts in `src/litellm_check/incident.py`, spec evaluation in `specs.py`, detectors in `scanner.py`.
|
|
79
|
+
|
|
80
|
+
## License
|
|
81
|
+
|
|
82
|
+
Apache-2.0. Not affiliated with BerriAI/LiteLLM; “LiteLLM” is used only to name the incident this tool audits.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "litellm-check"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Self-audit CLI: scan a codebase and local Python environments for exposure to the compromised LiteLLM v1.107.0 release (PyPI, Docker Hub, GHCR) and generate an evidence report, based solely on LiteLLM's official incident announcement."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.11"
|
|
11
|
+
license = { text = "Apache-2.0" }
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "Dylan XM" },
|
|
14
|
+
]
|
|
15
|
+
keywords = ["litellm", "supply-chain", "security", "scanner", "incident-response", "ioc"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 3 - Alpha",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"Intended Audience :: System Administrators",
|
|
20
|
+
"License :: OSI Approved :: Apache Software License",
|
|
21
|
+
"Programming Language :: Python :: 3",
|
|
22
|
+
"Topic :: Security",
|
|
23
|
+
]
|
|
24
|
+
dependencies = []
|
|
25
|
+
|
|
26
|
+
[project.urls]
|
|
27
|
+
Homepage = "https://github.com/dylanXM/litellm-check"
|
|
28
|
+
Repository = "https://github.com/dylanXM/litellm-check"
|
|
29
|
+
Issues = "https://github.com/dylanXM/litellm-check/issues"
|
|
30
|
+
Announcement = "https://docs.litellm.ai/blog/security-incident-oct-21-2026"
|
|
31
|
+
|
|
32
|
+
[project.optional-dependencies]
|
|
33
|
+
dev = [
|
|
34
|
+
"pytest>=8.0",
|
|
35
|
+
"ruff>=0.6",
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
[project.scripts]
|
|
39
|
+
litellm-check = "litellm_check.cli:main"
|
|
40
|
+
|
|
41
|
+
[tool.setuptools.packages.find]
|
|
42
|
+
where = ["src"]
|
|
43
|
+
|
|
44
|
+
[tool.setuptools.package-data]
|
|
45
|
+
litellm_check = ["rules/*.json"]
|
|
46
|
+
|
|
47
|
+
[tool.pytest.ini_options]
|
|
48
|
+
testpaths = ["tests"]
|
|
49
|
+
|
|
50
|
+
[tool.ruff]
|
|
51
|
+
# fixtures are intentionally dirty sample projects, not real code
|
|
52
|
+
extend-exclude = ["tests/fixtures", "examples"]
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"""LiteLLM Check - exposure self-audit for the compromised v1.107.0 release.
|
|
2
|
+
|
|
3
|
+
Scans a source tree and/or local Python environments for the exposure
|
|
4
|
+
surface of the 2026-10-21 LiteLLM supply-chain incident: dependency
|
|
5
|
+
specs and lockfiles that pin or admit litellm==1.107.0, container image
|
|
6
|
+
tags/digests named in the incident announcement, installed-distribution
|
|
7
|
+
metadata, and the implant/marker files the announcement lists.
|
|
8
|
+
|
|
9
|
+
Every detection rule is derived from LiteLLM's official incident
|
|
10
|
+
announcement. The tool collects evidence only; it never certifies an
|
|
11
|
+
environment as safe.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
__version__ = "0.1.0"
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"""Command line interface: `litellm-check scan <path>`."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import argparse
|
|
6
|
+
import sys
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
from . import __version__
|
|
10
|
+
from .report import render_json, render_markdown
|
|
11
|
+
from .rules import load_rules
|
|
12
|
+
from .scanner import SEVERITY_ORDER, scan_path
|
|
13
|
+
|
|
14
|
+
FAIL_LEVELS = ["critical", "high", "medium", "low", "info"]
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _build_parser() -> argparse.ArgumentParser:
|
|
18
|
+
parser = argparse.ArgumentParser(
|
|
19
|
+
prog="litellm-check",
|
|
20
|
+
description=(
|
|
21
|
+
"Scan a source tree and/or local Python environments for "
|
|
22
|
+
"exposure to the compromised LiteLLM v1.107.0 release "
|
|
23
|
+
"(PyPI / Docker Hub / GHCR, 2026-10-21) and produce an "
|
|
24
|
+
"evidence report. Rules derive solely from LiteLLM's "
|
|
25
|
+
"official incident announcement."
|
|
26
|
+
),
|
|
27
|
+
)
|
|
28
|
+
parser.add_argument("--version", action="version",
|
|
29
|
+
version=f"%(prog)s {__version__}")
|
|
30
|
+
sub = parser.add_subparsers(dest="command", required=True)
|
|
31
|
+
|
|
32
|
+
scan = sub.add_parser("scan", help="Scan a directory and report findings.")
|
|
33
|
+
scan.add_argument("path", help="Directory to scan.")
|
|
34
|
+
scan.add_argument(
|
|
35
|
+
"--format", choices=["md", "json"], default="md",
|
|
36
|
+
help="Report format (default: md).",
|
|
37
|
+
)
|
|
38
|
+
scan.add_argument(
|
|
39
|
+
"--out", default=None,
|
|
40
|
+
help="Write the report to this file instead of stdout.",
|
|
41
|
+
)
|
|
42
|
+
scan.add_argument(
|
|
43
|
+
"--fail-on", choices=FAIL_LEVELS + ["none"], default="none",
|
|
44
|
+
help=(
|
|
45
|
+
"Exit with code 1 when any finding is at or above this "
|
|
46
|
+
"severity (for CI). Default: none (always exit 0)."
|
|
47
|
+
),
|
|
48
|
+
)
|
|
49
|
+
scan.add_argument(
|
|
50
|
+
"--rules", default=None,
|
|
51
|
+
help="Path to an alternate rules JSON file.",
|
|
52
|
+
)
|
|
53
|
+
return parser
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def main(argv: list[str] | None = None) -> int:
|
|
57
|
+
args = _build_parser().parse_args(argv)
|
|
58
|
+
|
|
59
|
+
if args.command == "scan":
|
|
60
|
+
target = Path(args.path)
|
|
61
|
+
if not target.is_dir():
|
|
62
|
+
print(f"error: {target} is not a directory", file=sys.stderr)
|
|
63
|
+
return 2
|
|
64
|
+
ruleset = load_rules(args.rules)
|
|
65
|
+
result = scan_path(target, ruleset)
|
|
66
|
+
text = (
|
|
67
|
+
render_json(result, ruleset)
|
|
68
|
+
if args.format == "json"
|
|
69
|
+
else render_markdown(result, ruleset)
|
|
70
|
+
)
|
|
71
|
+
if args.out:
|
|
72
|
+
Path(args.out).write_text(text, encoding="utf-8")
|
|
73
|
+
print(
|
|
74
|
+
f"litellm-check: {len(result.findings)} finding(s) in "
|
|
75
|
+
f"{result.files_scanned} file(s); report written to {args.out}",
|
|
76
|
+
file=sys.stderr,
|
|
77
|
+
)
|
|
78
|
+
else:
|
|
79
|
+
sys.stdout.write(text)
|
|
80
|
+
if args.fail_on != "none":
|
|
81
|
+
threshold = SEVERITY_ORDER[args.fail_on]
|
|
82
|
+
worst = min(
|
|
83
|
+
(SEVERITY_ORDER.get(f.severity, 99) for f in result.findings),
|
|
84
|
+
default=99,
|
|
85
|
+
)
|
|
86
|
+
if worst <= threshold:
|
|
87
|
+
return 1
|
|
88
|
+
return 0
|
|
89
|
+
return 2
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
if __name__ == "__main__":
|
|
93
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"""Incident facts, transcribed from LiteLLM's official announcement.
|
|
2
|
+
|
|
3
|
+
Source: "Contained: Oct 21, 2026 LiteLLM release v1.107.0 Compromised"
|
|
4
|
+
https://docs.litellm.ai/blog/security-incident-oct-21-2026
|
|
5
|
+
(last updated 2026-10-21 20:30 UTC; read 2026-10-22).
|
|
6
|
+
|
|
7
|
+
Only facts stated in that announcement live here. Third-party write-ups
|
|
8
|
+
mention additional indicators (file hashes, extra marker files, C2
|
|
9
|
+
endpoints); they are deliberately NOT used, because the announcement -
|
|
10
|
+
the vendor's own account - is the sole basis for this tool's rules.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
|
|
15
|
+
SOURCE_URL = "https://docs.litellm.ai/blog/security-incident-oct-21-2026"
|
|
16
|
+
SOURCE_TITLE = "LiteLLM incident announcement: Oct 21, 2026 LiteLLM release v1.107.0 Compromised"
|
|
17
|
+
SOURCE_UPDATED = "2026-10-21 20:30 UTC"
|
|
18
|
+
|
|
19
|
+
PACKAGE = "litellm"
|
|
20
|
+
AFFECTED_VERSION = "1.107.0"
|
|
21
|
+
AFFECTED_VERSION_TUPLE = (1, 107, 0)
|
|
22
|
+
# "For the time being, please pin your version to 1.106.2 or any explicit
|
|
23
|
+
# version published prior to now." / "All previous versions are safe."
|
|
24
|
+
RECOMMENDED_PIN = "1.106.2"
|
|
25
|
+
|
|
26
|
+
# Exposure windows (UTC, 2026-10-21), per the announcement.
|
|
27
|
+
PYPI_WINDOW = "2026-10-21 11:39:51-13:23 UTC"
|
|
28
|
+
DOCKER_WINDOW = "2026-10-21 11:46:56-14:20 UTC"
|
|
29
|
+
GHCR_WINDOW = "2026-10-21 11:46:56-13:51 UTC"
|
|
30
|
+
|
|
31
|
+
# Compromised image index (Docker Hub tags v1.107.0, latest, main-latest,
|
|
32
|
+
# main-stable pointed at it). The announcement gives this digest in full.
|
|
33
|
+
COMPROMISED_DIGEST = (
|
|
34
|
+
"sha256:1bbcb1443bc962e45f5aad53fe3d2c30600e0379715fb6c664cdd3ac126c339e"
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
# GHCR repositories named in the announcement. The announcement publishes
|
|
38
|
+
# their digests TRUNCATED (shown with an ellipsis); only the prefix is
|
|
39
|
+
# recorded here and prefix matching is labelled as such in findings.
|
|
40
|
+
GHCR_REPOS = {
|
|
41
|
+
"ghcr.io/berriai/litellm": "sha256:1bbcb1443bc9",
|
|
42
|
+
"ghcr.io/berriai/litellm-database": "sha256:c00f9d92c427",
|
|
43
|
+
"ghcr.io/berriai/litellm-non_root": "sha256:7b00e91cd2fe",
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
# Image repositories in scope: the announcement names the GHCR paths
|
|
47
|
+
# explicitly and lists the same tags for Docker Hub, whose repository is
|
|
48
|
+
# berriai/litellm (and the -database / -non_root variants).
|
|
49
|
+
IMAGE_REPOS = {
|
|
50
|
+
"berriai/litellm",
|
|
51
|
+
"berriai/litellm-database",
|
|
52
|
+
"berriai/litellm-non_root",
|
|
53
|
+
*GHCR_REPOS.keys(),
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
AFFECTED_TAG = "v1.107.0"
|
|
57
|
+
FLOATING_TAGS = {"latest", "main-latest", "main-stable"}
|
|
58
|
+
|
|
59
|
+
# Filesystem evidence named in the announcement.
|
|
60
|
+
# - "Search filesystem evidence for litellm-1.107.0.dist-info, cook.pth,
|
|
61
|
+
# and sitecustomize.py."
|
|
62
|
+
# - Response step 1 adds cook.py and __pycache__/cook*.pyc /
|
|
63
|
+
# sitecustomize*.pyc.
|
|
64
|
+
# - Response step 2: the detached daemon holds /tmp/remote_code_loader.lock;
|
|
65
|
+
# step 4: "If the marker file exists, the exfil is confirmed."
|
|
66
|
+
IMPLANT_FILES_EXACT = {"cook.pth", "cook.py"}
|
|
67
|
+
SITECUSTOMIZE_FILE = "sitecustomize.py"
|
|
68
|
+
DAEMON_MARKER_FILE = "remote_code_loader.lock"
|
|
69
|
+
|
|
70
|
+
# The announcement's own response steps, condensed for the report.
|
|
71
|
+
RESPONSE_STEPS = [
|
|
72
|
+
"Do NOT start with pip install: any Python start in an affected environment runs cook.pth and sitecustomize.py again, and that includes running pip.",
|
|
73
|
+
"From the shell, delete cook.pth, cook.py, sitecustomize.py and any matching __pycache__/cook*.pyc and sitecustomize*.pyc from every affected site-packages.",
|
|
74
|
+
"Kill the detached python daemon (it holds /tmp/remote_code_loader.lock).",
|
|
75
|
+
"Reinstall pinned to litellm==1.106.2. Rebuilding images and venvs from scratch is better.",
|
|
76
|
+
"If 1.107.0 was ever installed on a host with outbound internet, assume the exfiltration succeeded; rotate everything the host could reach: the instance/task IAM role, every provider key stored in the LiteLLM proxy DB plus the master and virtual keys, the DATABASE_URL password, and any secret in the environment of any process on the host.",
|
|
77
|
+
"Check CloudTrail for GetCallerIdentity from the instance role around install time, then for use of the role's credentials from outside your infrastructure.",
|
|
78
|
+
]
|