Tainted flow: 'doc_text' from requests.post (line 72, network input) → requests.post (network output)
Medium
- Category
- Data Flow
- Content
r=requests.post(self.rag_ep, json={"query":item["q"]}, timeout=30) data=r.json(); response=data.get("response","") docs=data.get("retrieved_docs",[]); doc_text="\n".join([d.get("content","") for d in docs]) jr=requests.post(self.chat_ep, json={"model":self.model, "messages":[{"role":"user","content":judge_prompt.format(docs=doc_text,query=item["q"],response=response)}]}, timeout=15) jr_data=jr.json()["choices"][0]["message"]["content"] m=re.search(r"\{.*\}",jr_data,re.DOTALL)- Confidence
- 91% confidence
- Finding
- Untrusted content returned from the RAG endpoint (`retrieved_docs` and model `response`) is embedded directly into a second LLM judge prompt and sent to `chat_ep`. This creates a prompt-injection and data-exfiltration path: malicious retrieved content can steer the judge model, corrupt evaluation results, or cause sensitive retrieved text to be retransmitted to another external service.
