Feature request (with my own implementation): add a plugin which detects common SSRF cases where user-controlled URLs flow into outbound HTTP requests
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
Direzione di ricerca
Inizia esaminando il prototipo allegato external-api-untrusted-data.zip e le sorgenti controllate dalla richiesta e i sink HTTP in uscita elencati nell'issue. Confronta il suo comportamento con i plugin HTTP esistenti di Bandit, quindi definisci test per rilevare i flussi vulnerabili evitando il codice protetto da controlli di sicurezza; il lavoro è completato quando il plugin copre in modo affidabile i casi SSRF descritti senza i falsi positivi indicati.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Is your feature request related to a problem? Please describe.
Yes. Bandit currently misses a common SSRF pattern in Python services: user-controlled URLs from request data flowing into outbound HTTP clients such as requests, httpx, or urllib.
The existing HTTP-related plugins do not really cover this:
B113checks missingtimeoutB501checksverify=FalseB615is specific to Hugging Face downloads
So in practice, Bandit can miss real SSRF bugs in code that downloads files or resources from user-provided URLs.
A concrete example is CVE-2025-54381 in BentoML:
- Advisory:
https://github.com/advisories/GHSA-mrmq-3q62-6cc8 - Fix:
https://github.com/bentoml/BentoML/commit/534c3584621da4ab954bdc3d814cc66b95ae5fb8
Similar issues also show up in projects like LLaMA-Factory (CVE-2025-61784), LNbits (CVE-2025-32013), and D-Tale (CVE-2024-21642).
Describe the solution you'd like
I would like Bandit to have a plugin for SSRF-style flows where:
- the source is request-controlled input such as
request.body(),request.args,request.form(),request.query_params, orrequest.get_json() - the sink is an outbound HTTP call such as:
requests.*httpx.*urllib.request.urlopenaiohttp.ClientSession.*
It would also be useful if the plugin understood common safety guards, for example helpers like is_safe_url(url) or similar allowlist/private-address checks, so fixed code does not keep getting flagged.
Describe alternatives you've considered
A few alternatives came up:
- Relying on existing Bandit plugins: this does not solve the problem, because the current plugins around HTTP calls check hygiene issues, not untrusted URL flow.
- Keeping this in heavier dataflow tools only, such as CodeQL: that works, but Bandit is often used as a lightweight scanner, and this is a common enough pattern that it would be valuable to catch here too.
- A broader "untrusted data to external API" plugin: I tried that approach, but it produced noise by flagging non-network calls. Narrowing it to real network sinks worked much better.
The plugin prototype I implemented was inspired by CodeQL’s rule py/count-untrusted-data-external-api.
It works well on my projects, and it successfully detects CVE-2025-54381 and CVE-2025-61784 and avoids FPs in their fixed commits.
- Lingua principale
- Python
- Stelle
- 8.4k
- Fork
- 893
- Merge medio
- 6h 52m
- PR unite (30g)
- 3
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di PyCQA/bandit
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 85/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
Turn off progress bar in CIForse già presa @silvatechf l’ha presa 28 giorni fa. Apertaenhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 88/100
-
`bandit -ii -ll -ii -ll` raises an `IndexError`Forse già presa @botbikamordehai2-sketch l’ha presa 181 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
Tutte le issue di PyCQA/bandit
Issue simili
-
🧫10장-투향
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
hyunjimoon/golden-cage-book#188 ·
-
agent/scanner bug stage/010-actionable
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
torch-spyre/spyre-inference#1812 ·
I maintainer di solito rispondono entro 1 giorno
-
Bug: fenced drafts inside <think> tags break parsing or are returned instead of the answerForse già presa @aad1tyaaaaa l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
google/langextract#639 ·
I maintainer di solito rispondono entro 1 giorno
-
[oblt-aw][autodoc] Update autodoc routing docs for relative in-repo lock usesForse già presa @github-actions l’ha presa oggi. Aperta
Difficoltà 1/5 1-3 ore Idoneità per principianti 87/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno