Navigating the Cyber Security Labyrinth: Choose Your Own Security Adventure
This talk explores the challenges of application security, emphasizing the need for developers and security professionals to collaborate effectively. It highlights the risks of relying on automated tools and the importance of human-centric security practices. The speaker discusses the impact of burnout on security teams and advocates for building stronger relationships between security and development teams. The presentation also touches on the limitations of AI in security and the necessity of understanding the systems being protected.
Why Your AI-Generated Code Is Just Another Injection Vector
TLDR: Relying on LLMs to generate database-interfacing code often results in insecure patterns that mirror classic OWASP A03:2021-Injection vulnerabilities. While these models might suggest parameterized queries, they frequently fail to handle input sanitization or error handling in a way that prevents data exfiltration. Pentesters should specifically target AI-generated code blocks in code reviews and bug bounty programs, as they often contain "hallucinated" security controls that look correct but fail under pressure.
Security researchers and developers are currently obsessed with the speed of AI-assisted coding. We see the pull requests flying in, filled with code generated by LLMs, and the promise is always the same: faster delivery, fewer bugs, and "secure by design" outputs. But as we saw in recent research presented at DEF CON 2024, the reality is that we are simply automating the creation of legacy vulnerabilities. When you ask an LLM to write a database interaction layer, you aren't getting a security expert; you are getting a statistical model that has ingested millions of lines of insecure, legacy PHP and SQL code from the public internet.
The Illusion of Secure Code
The core issue is that LLMs prioritize syntax that works over security posture. During a live demonstration, the speaker prompted an LLM to generate a PHP form that collects user data and stores it in a database. The model produced code that, on the surface, appeared to use parameterized queries. However, the implementation was fundamentally flawed. It lacked robust input validation and, more importantly, it handled database errors in a way that could easily leak sensitive information or provide an attacker with the structure of the backend schema.
If you are a pentester, this is your new favorite hunting ground. When you encounter an application that has clearly been "modernized" or built using AI-assisted tooling, stop looking for the complex, zero-day chains and start looking for the basics. The AI is likely generating the same SQL injection patterns we have been fighting for two decades, just wrapped in a more modern, cleaner-looking package.
Consider this common pattern generated by LLMs when asked to handle user input:
// AI-generated snippet often seen in rapid prototyping
$stmt = $pdo->prepare('INSERT INTO users (name, email) VALUES (?, ?)');
$stmt->execute([$_POST['name'], $_POST['email']]);
While this uses prepared statements, it fails to account for the context of the data. If the application logic later uses these fields in a dynamic query or a poorly sanitized output, the "security" provided by the prepared statement is rendered moot. The model assumes the developer knows how to handle the data downstream, but the developer assumes the model handled it upstream. This gap is where the vulnerability lives.
Why We Are Failing the Human Element
The technical failure is only half the story. The real danger is the cultural shift in how we view security. We are trading human oversight for the convenience of a chatbot. When a junior developer uses an LLM to write a function, they are often unable to audit the security implications of the output. They see code that runs, they see a green checkmark from their linter, and they push to production.
This is a systemic risk. We are building a massive, interconnected web of software that is increasingly generated by models that do not understand the concept of a threat model. As pentesters, we need to shift our focus. We need to start auditing the process of code generation. If a company is using AI to accelerate their development, they are likely accumulating technical debt at a rate that far outpaces their ability to patch it.
The Path Forward for Researchers
We need to stop treating AI-generated code as a black box. If you are performing a code review or a white-box assessment, ask the client if they are using AI tools to generate their backend logic. If they are, you have a clear roadmap. Start by fuzzing the inputs that the AI generated. Look for the places where the model "guessed" the database schema.
The National Vulnerability Database is already struggling to keep up with the sheer volume of vulnerabilities being reported. We cannot afford to add a layer of AI-generated, easily exploitable code on top of that. The next time you are on an engagement, don't just look for the low-hanging fruit. Look for the code that looks too perfect, too clean, and too generic. That is where the AI has been working, and that is where you will find your next critical finding.
Security is not a feature you can prompt for. It is a discipline that requires understanding the underlying mechanics of the system. If you don't understand how the data flows from the user input to the database, no amount of AI-generated code will keep your application safe. Keep pushing the boundaries, keep questioning the tools, and most importantly, keep looking for the human error hidden behind the machine-generated facade.
Vulnerability Classes
Tools Used
OWASP Categories
Up Next From This Conference

Breaking Secure Web Gateways for Fun and Profit

Listen to the Whispers: Web Timing Attacks That Actually Work

Abusing Windows Hello Without a Severed Hand
Similar Talks

Counter Deception: Defending Yourself in a World Full of Lies

Exploiting Shadow Data in AI Models and Embeddings

