AI is changing application security by writing code, reviewing code and helping scanners find and fix flaws.
This guide is for developers, students and managers who want a plain picture of what AI changes in keeping software safe. You do not need to write code to be affected: if your organisation builds or buys apps, AI is likely already part of how that code is made and checked.
In short
- AI now helps write code, suggest fixes for security flaws and find bugs that people missed.
- Code written by AI can still contain security flaws, so it needs the same checks as any other code.
- AI can suggest software packages that do not exist, and attackers can register those names.
- Treat every AI suggestion as a draft: test it, scan it again and have a person approve it.
What you will learn
- Explain the three main ways AI is changing application security.
- Spot the common risks in code that AI has written or fixed.
- Check that a person still approves every change before it goes live.
- Ask your team the right questions about the AI tools it uses.
- Keeping software safe (application security)
- the work of protecting apps and websites from being misused.
- Automatic code checker (scanner)
- a tool that reads code and flags parts that look unsafe.
- Add-on code (package)
- a ready-made block of code that an app downloads and builds on.
What is AI in application security?
Think of a keen new apprentice in a workshop. They work fast and often get things right. But every piece they make is checked before it leaves the building.
AI tools are now that apprentice in software teams. They do three main jobs. They write code when a developer asks. They review code and suggest fixes for problems a scanner found. And they help testing tools find hidden bugs.
Most of these tools are built on a large language model. That is software that predicts likely words or code from patterns it has learned. That is why the output can look right and still be wrong.
Where the comparison stops working: an apprentice learns from each mistake and gets steadier over time. An AI tool can give a different answer to the same question each time, so its work needs checking every time, not just at first.
Why does it matter?
AI lets teams write and fix code much faster. If the checks do not keep up, unsafe code can reach customers faster too. In one test of more than 100 AI models, the code they wrote added a security flaw in 45 percent of tasks.[2]
If you are a developer
What could happen: you accept an AI fix that looks tidy but leaves the flaw in place, or adds a new one.
Check this: run the tests and the scanner again before you merge any AI change.
If you are a student or new to IT work
What could happen: you copy AI code into a project without knowing what each line does.
Check this: read every line, and look up any package name before you install it.
If you manage a software team
What could happen: the team ships more code each week while the number of careful reviews stays the same.
Check this: ask whether a person still approves every change, including changes the AI suggested.
Next: Application Security and AI-Generated Code Executive Briefing
What does it look like?
Here is a made-up note an AI review tool might leave on a proposed code change.
Example only. All values are made up.
AI review note on change #0000 (shop-app.example.com) Scanner alert: user input reaches a database query (1) Suggested fix: rewrite the query to use safe inputs (2) Also suggested: add package "fast-safe-query-EXAMPLE" (3) Status: ready to accept (4)
- The scanner found the problem, not the AI.
- The AI's draft fix. It may be right or wrong.
- A new add-on package. In a real message, this line would contain a package name. Check it before anyone installs it.
- "Ready" is the tool's view. It is not a person's approval.
Why this is risky: the fix looks finished. A busy developer may accept it without a test or a check.
The safer way: test the fix and run the scanner again. Check that the package is well known. Then a person approves the change.
How does it work?
- AI helps write code. A developer asks an AI coding assistant for code, and it suggests some. The code may work but still contain security flaws.[2]
- A scanner checks the code. A static scanner, a tool that reads code without running it, flags parts that look unsafe.
- AI suggests a fix. Some tools pass the scanner's alert and the nearby code to an AI model. The model drafts a fix and a plain explanation.[1]
- AI helps testing tools dig deeper. AI can write tests for fuzzing, which means feeding a program lots of odd inputs to see what breaks. In 2024, Google reported 26 new flaws found this way. One was in a widely used library and had likely been there for about two decades.[4]
- People check and approve. One vendor's documentation says you must always review its fix suggestions first. A fix may not solve the problem, or may add a new one.[1]

A newer risk comes from add-on packages. Researchers found that AI coding tools sometimes name packages that do not exist. They checked 576,000 code samples. On average, at least 5.2 percent of packages from paid models were made up. For open-source models it was 21.7 percent.[3] An attacker can register a made-up name and fill it with harmful code. This is called slopsquatting.
A worked example
Jonah Whitlock is a developer at a small online bookshop. His team has started using an AI coding assistant and an AI fix tool linked to their scanner.
One Monday, the scanner flags a search box on the shop's site. Text typed into the box could reach the database unchecked. The AI fix tool offers a neat rewrite within seconds. It also suggests adding a package Jonah has never heard of.
The fix looks fine, and Jonah is busy. But the team has a simple rule: every AI change is a draft. So he follows the steps.
First, he looks up the package on the official package site. He cannot find it there under that name. He removes that line and uses the library the shop already relies on.
Next, he runs the tests. One fails, because the AI fix changed how the search sorts results. He corrects it by hand.
Then he runs the scanner again. The alert has cleared. Finally, a colleague reviews the change and approves it before it goes live.
The whole check took Jonah about twenty minutes. The AI still saved him time. The difference is that a person, the tests and the scanner all agreed before customers saw the change.
Later, Jonah adds two lines to the team's guide: "Check every new package name" and "AI says ready is not an approval."
Myths and mistakes
| What people think | What is true |
|---|---|
| Code from a well-known AI model is safe. | Tests of more than 100 models found security flaws in 45 percent of tasks.[2] Check AI code like any other code. |
| If the AI says the flaw is fixed, it is fixed. | Run the scanner again. A fix counts only when the alert clears and the tests pass. |
| An AI review is the same as a human review. | An AI review is extra help. A named person should still approve each change. |
| Any package the AI suggests must exist. | AI tools sometimes invent package names.[3] Look each one up before installing it. |
| AI only helps attackers. | Defenders use it too, for example to find old bugs with smarter testing.[4] |
What can I do this week?
- List the AI tools your team uses to write, review or fix code.
- Agree one rule: every AI change is tested, scanned again and approved by a person.
- Check any new package name on the official package site before it is installed.
- Ask who can turn off an AI fix tool if it starts causing problems.
- Read your AI tool's own guidance on its limits.
Checklist
- We know which AI tools write, review or fix our code.
- Every AI-suggested change goes through the same tests as human code.
- The scanner runs again before an AI fix is accepted.
- A named person approves every change before it goes live.
- New package names are checked before they are installed.
- Someone owns each AI tool and can switch it off.
- We have read each tool's own notes on what it can get wrong.
Common questions
Is AI-written code less safe than human code?
It can be just as risky, and it arrives faster. One study found security flaws in 45 percent of AI coding tasks. The safest approach is to treat AI code exactly like code from a new team member: test it, scan it and have someone review it.
Can AI find security flaws on its own?
It can help. Google reported that AI-written fuzz tests found 26 new flaws in open-source projects. But AI findings and fixes still need checking, because AI tools can be wrong and can sound sure of themselves when they are wrong.
What is slopsquatting?
Slopsquatting is when an attacker registers a package name that AI tools tend to invent. A developer who installs the suggested name gets the attacker's code. Checking each new package on its official site before installing it reduces this risk.
Do we still need security experts if we use AI tools?
Yes. AI tools speed up writing, scanning and fixing, but people still decide what is safe enough to ship. Experts set the rules, check the tricky cases and notice when an AI tool is getting things wrong.
Should we ban AI coding tools?
Usually not. A ban often pushes people to use tools quietly. It tends to work better to approve a few tools and set clear review rules. A person should still approve every change.
Where next?
Ready for the detail? Read the practitioner guide: AI-Assisted Code Review and AI SAST Guide. It goes further into how AI fix tools build their suggestions, how to measure them and how to roll them out in stages.
Also useful:
- Application Security for Beginners
- AI Coding Assistants for Beginners
- Vibe Coding for Beginners
- Slopsquatting and Package Hallucination Guide
Related NHI Mgmt Group resources: AI-Generated Code Review Guide, SAST, DAST and IAST for Beginners and Secure Code Review Guide.
Key terms
- Application security
- The work of protecting software, from the code to the running app, against misuse.
- Large language model
- An AI system trained on lots of text that predicts likely words or code.
- SAST
- A scanner that reads code before it runs to look for security weaknesses.
- Fuzzing
- Testing a program by feeding it lots of unusual inputs to see what breaks.
- Code review
- A person checking a proposed code change before it is added.
- Hallucinated package name
- A package name an AI tool suggests that does not exist in the real package store.
- Slopsquatting
- An attack where someone registers a package name that AI tools invent, so people install harmful code.
Sources and further reading
- GitHub, "Responsible use of Copilot Autofix for code scanning", GitHub Docs. https://docs.github.com/en/code-security/responsible-use/responsible-use-autofix-code-scanning (accessed 2 Dec 2026).
- Veracode, "AI-Generated Code Poses Major Security Risks in Nearly Half of All Development Tasks, Veracode Research Reveals", press release, 30 July 2025. https://www.veracode.com/press-release/ai-generated-code-poses-major-security-risks-in-nearly-half-of-all-development-tasks-veracode-research-reveals/ (accessed 2 Dec 2026).
- Spracklen et al., "We Have a Package for You! A Comprehensive Analysis of Package Hallucinations by Code Generating LLMs", USENIX Security Symposium 2025. https://www.usenix.org/conference/usenixsecurity25/presentation/spracklen (accessed 2 Dec 2026).
- Oliver Chang, Dongge Liu and Jonathan Metzman, "Leveling Up Fuzzing: Finding more vulnerabilities with AI", Google Security Blog, 20 November 2024. https://security.googleblog.com/2024/11/leveling-up-fuzzing-finding-more.html (accessed 2 Dec 2026).