CY0-001 practice question 14 of 35
Security logs from a Python-based Jupyter environment indicate that a generative AI assistant used by developers is generating code snippets that…
Full set: 484 questionsThe described attack is a form of Cross-Site Scripting (XSS), where the LLM is the delivery vector for the malicious script. The vulnerability lies in the web-based IDE trusting the LLM's output and rendering it without proper validation. The most effective compensating control is to apply context-aware output encoding on the application (IDE) side before rendering the content. This process converts potentially executable characters (e.g., , ") into their HTML entity equivalents (e.g., <, >, "), ensuring the browser treats the LLM's output as plain text to be displayed, not as code to be executed.
A. Input sanitization targets the prompt sent to the model. While important for preventing prompt injection, it does not fix the unsafe handling of the model's output.
C. Adjusting model temperature affects the randomness of the output but is not a security control and does not prevent the generation of malicious code.
D. A vector database is used for grounding responses via RAG, not for sanitizing arbitrary generative output to prevent XSS.
1. OWASP Foundation. (2023). Cross Site Scripting (XSS) Prevention Cheat Sheet. Retrieved from https://cheatsheetseries.owasp.org/cheatsheets/CrossSiteScriptingPreventionCheatSheet.html. Rule #1 is "Encode Data on Output," which is the principle of context-aware output encoding and the primary defense against XSS.
2. OWASP Foundation. (2023). OWASP Top 10 for Large Language Model Applications. (Version 1.1). The mitigation strategies for "LLM02: Insecure Output Handling" recommend treating model output as untrusted user input and applying robust sanitization and encoding, which directly supports option B.
3. Bates, D., et al. (2024). Security Best Practices for Building Applications with Large Language Models. Stanford University HAI (Human-Centered Artificial Intelligence). This paper emphasizes in its "Secure Output Handling" section that all LLM outputs should be sanitized and encoded before being used in downstream functions, especially in web contexts.
Keep practicing
Take the free CY0-001 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other CY0-001 practice questions
- Question 1Social media backlash occurs after a customer-facing LLM produces biased medical advice, …
- Question 2Integrating Generative AI (GenAI) and LLMs into high-interaction Honeypots allows securit…
- Question 3Evaluating the core tenets of Responsible AI requires a clear understanding of the compon…
- Question 4Establishing a robust security baseline for the MLOps pipeline involves several cross- fu…
- Question 5Evaluate the following statements regarding the MITRE ATLAS (Adversarial Threat Landscape…
- Question 6Implementing AI-powered security plugins into a developer's IDE (Integrated Development E…
