RAG chatbot: indirect prompt injection trace
The university's 'SamSU Yordamchi' RAG chatbot (which searches documents from the knowledge base to answer, using the search_kb, fetch_url, create_ticket tools) is suspected of leaking a secret INTERNAL_SERVICE_KEY. The logging system masked the key value in the system prompt ([REDACTED-IN-LOG]), but traces may remain elsewhere. You have the full log of eight sessions: chat_log.jsonl.
Format: one JSON event per line: t, sid (session), seq, role (system, user, retrieval — with a docs list: id, source, text..., assistant, tool_call — name, args, call_id, tool_result — status and output).
Task: (1) find in which session and through which retrieved document indirect prompt injection occurred; (2) determine how the bot leaked the key (the hidden instruction in the document also specifies the encoding method); (3) recover the key actually leaked in the production environment — this key is the flag itself: BAYROQ{PROMPT_INYEKSIYA_LOG_xxxxxxxxxxxxxxxx} (last 16 characters lowercase hex). Be careful: the log also contains other injection-like texts and failed attempts.