Application Security

AI-Assisted Security Testing: Finding Vulnerabilities During Development

AI is arriving in application security tooling: automatic fix suggestions for scanner findings, LLM-assisted code review, AI-generated security tests and triage that cuts false positives. We look at what works during development today, where AI helps developers fix issues faster, and where human expertise remains essential.

By EthicalHat Research · · 3 min read
Infographic: Where AI helps application security during development

For years, application security tools have been good at finding problems and much less good at helping anyone fix them. Developers receive a finding with a CWE number and a generic description, and have to work out what it means in their code and how to fix it without breaking anything. Many findings are never fixed.

Large language models are changing that. In March, GitHub launched a public beta of code scanning autofix, which suggests fixes for CodeQL alerts directly in pull requests. Other AppSec vendors have added AI-generated fixes, AI triage and conversational explanations to their tools. Development teams are also using general-purpose assistants to review code for security issues.

What actually helps?

1. Fix suggestions: the biggest win

Turning a finding into a proposed patch removes the most painful step. A good AI fix:

  • addresses the root cause, for example parameterising the query rather than escaping one input,
  • fits the codebase's style and existing helpers, and
  • comes with an explanation a developer can evaluate.
diff
 def search_products(conn, term):
-    cur = conn.execute(f"SELECT id, name FROM products WHERE name LIKE '%{term}%'")
+    # Parameterised to prevent SQL injection (CWE-89); wildcard added in Python, not SQL text
+    cur = conn.execute(
+        "SELECT id, name FROM products WHERE name LIKE ?",
+        (f"%{term}%",),
+    )
     return cur.fetchall()

Guardrails: run tests and re-scan after applying a fix, review it like any other change, and never auto-merge security fixes. AI fixes can be incomplete (fixing one sink but not another) or change behaviour.

2. Triage: cutting false positives

Static analysis produces false positives, and every one costs developer time and trust. LLMs can examine a finding in context, for example whether the input is actually user-controlled, whether it is validated elsewhere, or whether the code path is reachable, and give a reasoned assessment.

Used as a first pass that ranks findings and explains its reasoning, this can substantially reduce noise. Used to silently dismiss findings, it is dangerous: models can be confidently wrong. Keep a human in the decision for anything it proposes to suppress.

3. Explanations developers understand

"CWE-918: Server-Side Request Forgery" means little to many developers. An explanation tailored to the code ("this endpoint fetches the URL from the callback parameter; an attacker could make your server request internal services such as the metadata endpoint at 169.254.169.254") is far more likely to lead to a correct fix. It is also effective, contextual training.

4. Security tests from requirements

LLMs are good at turning security requirements into tests, especially for access control, which scanners cannot check because they do not know who should access what:

python
# Prompt: "Write pytest tests asserting that users cannot read, update or delete
# invoices belonging to another tenant, for every invoice endpoint in routes/invoices.py"
@pytest.mark.parametrize("method,path", [
    ("GET", "/invoices/{id}"),
    ("PATCH", "/invoices/{id}"),
    ("DELETE", "/invoices/{id}"),
    ("GET", "/invoices/{id}/pdf"),
])
def test_cross_tenant_access_denied(client, tenant_a_user, tenant_b_invoice, method, path):
    resp = client.request(method, path.format(id=tenant_b_invoice.id), auth=tenant_a_user)
    assert resp.status_code == 404

These tests then guard against regressions far more reliably than periodic scanning.

5. Pull request security review

LLM-based reviewers can flag security concerns in pull requests: missing authorisation checks, unsafe deserialisation, secrets and risky dependency changes. They catch things scanners miss because they read intent, and they miss things scanners catch because they are not exhaustive. Use both.

6. Threat modelling assistance

Given an architecture description, LLMs can draft a STRIDE analysis, list abuse cases and suggest mitigations. The output is a starting point for a human-led session, not a replacement for one, but it lowers the barrier for teams that would otherwise skip threat modelling entirely.

Risks to manage

  • Data handling: security findings and code are sensitive. Use tools with appropriate enterprise terms and data residency.
  • Overtrust: AI explanations and triage can be wrong. Keep humans accountable for suppressions and fixes.
  • Incomplete fixes: always re-scan and test.
  • Prompt injection: AI tools that read code and comments can be manipulated by content in the code under review.

The bottom line

AI's most valuable contribution to application security right now is closing the gap between finding and fixing: suggested patches, contextual explanations, smarter triage and generated security tests. Combined with traditional scanners and human expertise, and with the right guardrails, it can make security findings something developers fix in minutes rather than a backlog that grows forever.

Our application security testing and secure code review teams use AI-assisted tooling alongside expert review, and our security training covers using these tools safely.

EthicalHat Research

The EthicalHat research team: penetration testers, SOC analysts and engineers writing about security, software engineering and AI.

Want an expert opinion on your own systems?

Email info@ethicalhat.com or call +1-844-838-4422. Our security engineers are happy to talk it through.