AI Won't Help You Here
This talk explores the limitations of generative AI in software engineering and security, specifically highlighting its tendency to hallucinate and provide non-deterministic, incorrect code. The speaker demonstrates how relying on LLMs for complex tasks like vulnerability remediation can lead to insecure or non-functional implementations. The key takeaway is that generative AI is a force multiplier for productivity but requires rigorous human validation and domain-specific knowledge to ensure security and correctness. The presentation emphasizes that AI cannot replace the need for fundamental security practices and manual code review.
Why Your LLM-Powered Coding Assistant Is A Security Liability
TLDR: Generative AI tools like ChatGPT and GitHub Copilot are being used to generate and remediate code, but they frequently hallucinate insecure patterns and non-existent libraries. Relying on these models for security-sensitive tasks without rigorous manual validation introduces critical vulnerabilities into your codebase. Pentesters should specifically target AI-generated code blocks during assessments, as they often contain predictable, high-impact flaws that developers assume are secure.
Developers are rushing to integrate generative AI into their workflows, treating LLMs as a panacea for technical debt and security remediation. The reality is far more dangerous. When you ask an LLM to write a function or fix a vulnerability, you are not interacting with a security expert. You are interacting with a statistical model that predicts the next likely token based on a massive, noisy dataset of public code. That dataset includes every insecure Stack Overflow snippet, every deprecated library, and every poorly implemented security control ever pushed to a public repository.
The Hallucination Problem in Security Contexts
The core issue with using LLMs for security is their lack of deterministic reasoning. When you prompt an LLM to "fix this vulnerability," it does not perform a static analysis of your data flow. It performs a pattern match against similar-looking code it has seen before. If the most common pattern in its training data is insecure, the model will suggest that insecure pattern as the solution.
During a recent demonstration, an LLM was tasked with generating code to handle sensitive data. The model produced a skeleton that looked syntactically correct but was functionally hollow, inserting placeholders like "code here" or "complete this" instead of implementing actual logic. This is not just a nuisance. It is a fundamental failure of the model to understand the security requirements of the task. When a developer is under pressure to ship, they often copy-paste these suggestions without verifying the underlying logic, effectively introducing OWASP A06:2021-Vulnerable and Outdated Components or OWASP A03:2021-Injection flaws directly into the production environment.
When AI Becomes a Social Engineering Target
One of the most fascinating aspects of LLM interaction is how developers attempt to "prompt engineer" their way out of laziness. We have seen instances where developers, frustrated by the model's refusal to generate complex code or its tendency to provide incomplete snippets, resort to social engineering the model. They use prompts that mimic human emotional states, claiming they have "no hands" or that their "career depends on it," to force the model to bypass its safety filters or provide more comprehensive code.
This behavior is a massive red flag. If you have to convince a model to do its job, you have already lost control of the security of your output. Furthermore, these prompts are often stored in version control systems, leaking the developer's intent and the model's vulnerabilities to anyone with access to the repo.
Practical Implications for Pentesters
For those of us on the offensive side, this shift in development culture is a goldmine. During a red team engagement or a penetration test, you should be looking for signs of AI-assisted code. AI-generated code often exhibits specific, recognizable traits:
- Over-reliance on standard libraries for complex tasks where a custom, more secure implementation is required.
- Inconsistent error handling that follows a "happy path" but fails to account for edge cases.
- The presence of "boilerplate" comments that don't actually explain the logic of the code.
When you identify a block of code that looks like it was generated by an LLM, treat it as a high-priority target. These blocks are frequently where developers have offloaded their cognitive load, and they are the most likely places to find T1190: Exploit Public-Facing Application vectors. If the developer didn't understand the code well enough to write it, they certainly didn't understand it well enough to secure it.
The Defensive Reality
Defenders must treat AI-generated code with the same skepticism they apply to third-party dependencies. You cannot simply "scan" your way out of this problem. Automated tools are getting better at detecting known vulnerabilities, but they struggle with the logic-based flaws that LLMs are prone to creating.
The only effective defense is a return to basics. Every line of code, whether written by a human or an AI, must undergo a rigorous, manual security review. If your team is using GitHub Copilot or similar tools, ensure that your CI/CD pipeline includes mandatory human sign-off for any code that touches authentication, authorization, or data sanitization.
Generative AI is a powerful tool for productivity, but it is not a substitute for security engineering. It is a force multiplier for your developers, but it is also a force multiplier for your technical debt and your attack surface. Stop treating the output of an LLM as a finished product. Start treating it as a draft that requires the same level of scrutiny as a pull request from an untrusted contributor. If you aren't verifying the code, you are effectively letting a black box define your security posture.
Vulnerability Classes
Tools Used
Target Technologies
Attack Techniques
OWASP Categories
All Tags
Up Next From This Conference
Similar Talks

Counter Deception: Defending Yourself in a World Full of Lies

Exploiting Shadow Data in AI Models and Embeddings




