← All posts

Field notes / Security

Using AI to Challenge What I Know About Application Security

There is a big difference between using AI to get an answer and using AI to determine whether you actually understand the answer.

I have been experimenting heavily with the second approach.

As part of developing my application security skills, I started building interactive exercises with AI around three areas that matter heavily in real-world AppSec work:

These aren't simply prompts where I ask AI to quiz me about security concepts. I have been deliberately building a learning environment where the AI presents a scenario, gives me enough information to work with, and then gets out of the way.

I analyze the problem first.

I commit to an answer.

Then the AI evaluates my reasoning, challenges assumptions, identifies gaps, and helps me extract the larger security principle behind what I just worked through.

The goal was never to have AI do AppSec for me.

It was almost the opposite.

I wanted AI to create situations where I had to think, make decisions, explain those decisions, and occasionally discover that something I thought I understood had a few more layers than I realized.

What emerged was less like an AI tutor handing me answers and more like an interactive AppSec sparring partner.

The Problem With Passive Learning

Security has no shortage of educational material.

There are books, courses, certifications, videos, vulnerable applications, CTFs, walkthroughs, documentation, conference talks, and thousands of blog posts explaining individual vulnerabilities.

I've used many of them.

But there is a recurring problem with technical learning: recognition can masquerade as understanding.

Reading an explanation of an authorization vulnerability and thinking, "Yep, that makes sense," is very different from looking at an unfamiliar application and identifying where authorization assumptions are being made.

Reading about trust boundaries is different from finding them yourself.

Watching someone review vulnerable code is different from reviewing it without knowing where the vulnerability is.

And reading secure code is very different from being asked to write it.

I wanted exercises that forced me across that gap.

More specifically, I wanted something I could adapt continuously. If I understood a concept, make the next problem harder. If my reasoning exposed a weakness, explore that weakness. If I solved the obvious problem, change one assumption and make me reconsider the entire thing.

AI turned out to be surprisingly useful for creating exactly that kind of environment.

Turning AI Into an AppSec Challenger

Instead of asking AI:

What vulnerabilities should I look for?

I can give it a different job.

Create an application architecture.

Give me the business requirements.

Define the users, services, data flows, authentication mechanisms, APIs, and external dependencies.

Then stop.

Now I have to analyze it.

I identify assets.

I identify trust boundaries.

I determine where authentication and authorization decisions occur.

I examine data flows.

I consider attacker-controlled inputs.

I decide what deserves attention first.

Only after committing to my analysis do I let the AI challenge it.

That distinction is important.

If AI immediately identifies every weakness, explains why it matters, and tells me how to fix it, I've learned something, but I've skipped a large portion of the actual AppSec work.

Instead, I want to find out what I notice before being told what to notice.

That changes the interaction completely.

AI stops being an answer generator and becomes part scenario designer, part evaluator, and part adversarial reviewer.

Threat Modeling Without a Predetermined Answer

Threat modeling was one of the first areas where this approach became useful.

A generated scenario might describe something like:

User
  |
  v
Web Application
  |
  +----> Authentication Service
  |
  +----> REST API
             |
             +----> Database
             |
             +----> Internal Service

The interesting question isn't:

"What vulnerabilities exist in this diagram?"

The better questions are:

Those questions require reasoning.

And because AI can dynamically change the scenario, the exercise doesn't have to end after one analysis.

Add an API gateway.

Move authentication to a third-party identity provider.

Introduce asynchronous processing.

Add a privileged administrative service.

Expose one previously internal endpoint.

Suddenly the threat model changes.

And I have to reconsider my previous conclusions instead of simply moving on to the next vulnerability category.

That ability to mutate an architecture is incredibly useful because real applications don't remain static either.

Learning to Think in Trust Boundaries

One of the biggest lessons from these exercises has been that AppSec becomes much easier to reason about when I stop thinking primarily in terms of vulnerability names.

Instead, I look for trust.

Every application makes assumptions.

The frontend trusts something from the backend.

The backend trusts something from an identity provider.

One microservice trusts claims supplied by another.

An API trusts that an identifier represents an object the current user should be allowed to access.

A parser trusts that input follows a particular format.

A developer trusts that a library behaves a certain way.

Some of those assumptions are justified.

Some aren't.

The interesting security questions often appear where those assumptions cross boundaries.

That perspective is far more transferable than memorizing another list of vulnerability categories.

AI-Generated Code Review Exercises

Code review became another natural extension of the idea.

Instead of asking AI to explain insecure code, I can have it generate code for me to review.

For example:

@app.route("/profile/<user_id>")
@login_required
def profile(user_id):
    user = db.get_user(user_id)

    if not user:
        abort(404)

    return render_template("profile.html", user=user)

There is nothing syntactically wrong with this code.

It might even look perfectly reasonable during a quick review.

But the important questions aren't about syntax.

They are about assumptions.

Where does user_id come from?

What does @login_required actually guarantee?

Does authentication imply authorization?

Can one authenticated user request another user's profile?

Where should ownership be validated?

What information does the profile contain?

What happens elsewhere in the application?

The exercise isn't simply spotting "IDOR" or "broken access control."

The exercise is reconstructing the application's security model from the code.

That is a much more useful skill.

Code Review Is Model Building

The more of these exercises I worked through, the more I realized that secure code review is largely an exercise in building a mental model.

I am trying to determine:

  1. What does the developer expect to happen?
  2. What does the application actually enforce?
  3. What can the attacker influence?
  4. Where do those three things diverge?

That divergence is often where the interesting security behavior lives.

AI works particularly well here because I can ask it to create incomplete codebases, multiple interacting functions, APIs, middleware, authentication logic, or business rules.

Then I have to trace the behavior.

And I can be wrong.

That's important.

The exercise isn't useful because AI can confirm when I found everything. It is useful because I can submit an analysis that feels complete and have it challenge a missing assumption, an overlooked data flow, or an incorrect interpretation.

The AI can challenge my conclusions afterward, but I have already done the important part.

I built the model myself.

Learning to Explain the Steps I Was Skipping

One of the more unexpected things these exercises exposed wasn't a gap in my AppSec knowledge.

It was a gap in how I communicated that knowledge.

There were times when my conclusion was correct, but the AI would challenge my reasoning because I hadn't explained how I got there. My first reaction was sometimes essentially:

But that's obvious.

And that turned out to be the problem.

I was making intermediate connections automatically in my head and then skipping over them when I explained my analysis.

I might identify a trust boundary, recognize why a particular data flow was dangerous, or know that an authorization check needed to occur, but jump directly from observation to conclusion without articulating the reasoning between them.

The missing steps weren't necessarily missing from my understanding.

They were missing from my explanation.

That distinction became valuable because security work isn't just about reaching the correct conclusion. You have to be able to communicate why it is correct.

A developer needs to understand why a code path is dangerous.

An engineering team needs to understand why a trust relationship matters.

A finding needs enough reasoning that someone else can reproduce the thought process rather than simply accept the security engineer's conclusion.

So the exercises started challenging another skill:

Can I make the reasoning that feels automatic to me explicit enough for someone else to follow?

That forced me to slow down and document the chain more completely:

Attacker control → Application behavior → Trust assumption → Missing control → Resulting impact

In a strange way, AI was catching the equivalent of undocumented code in my own thought process.

The logic was there.

I just hadn't written the comments.

Writing Code Changes the Perspective Again

Eventually I added another dimension: writing code.

Finding a vulnerability is one skill.

Fixing it without breaking the application is another.

So some exercises reverse the problem.

Instead of:

Find the security issue.

The task becomes:

Implement this feature securely.

That introduces a completely different set of decisions.

Suppose the requirement is:

Add an endpoint allowing users to download documents associated with their account.

Now I have to think about:

And, critically, I have to think about where those controls belong.

It is easy to say an application should "validate authorization."

It is harder to design exactly how that authorization decision should work and ensure every execution path respects it.

Writing the code exposes whether the security model actually makes sense.

It also closes an important loop.

Threat modeling asks me to reason about how a system could fail.

Code review asks me to determine whether those failures exist in an implementation.

Writing code asks me to design the implementation so those failures don't happen in the first place.

Those are different perspectives on the same underlying security problem.

Building an Interactive Learning Loop

Over time, these exercises developed into a structure I can repeat:

Scenario → Independent analysis → Challenge → Feedback → Takeaway → New scenario

The AI provides a scenario.

I analyze it without being given the solution.

I submit my reasoning.

AI critiques the reasoning rather than immediately replacing it.

If something is missing, we explore why.

The scenario can then evolve.

I respond again.

At the end, I extract the lessons that are transferable beyond that particular exercise.

Then those lessons can influence the next exercise.

That last part matters.

The useful takeaway shouldn't be:

I found vulnerability X.

It should be something closer to:

Authentication establishes identity. Authorization determines what that identity can do. Never assume the first automatically provides the second.

Or:

When reviewing an application, trace attacker-controlled data until you find the point where the application begins trusting it.

Those become reusable mental models.

And because the next scenario can test the same principle in a completely different context, I can find out whether I actually learned the concept or simply learned to recognize the previous example.

That is the part of this experiment I've found most valuable.

AI Shouldn't Remove the Struggle

There is a temptation when using AI for technical learning to eliminate friction.

Ask the question.

Get the explanation.

Copy the solution.

Move on.

That is efficient if the objective is completing a task.

It is terrible if the objective is building expertise.

The struggle is part of the training.

If I spend twenty minutes tracing a request through several functions before realizing I misunderstood where authorization occurs, that twenty minutes wasn't wasted.

That was the exercise.

If I create a threat model and completely overlook an important trust boundary, discovering that after committing to my analysis teaches me considerably more than having the boundary highlighted before I begin.

AI becomes much more valuable when it preserves that difficulty instead of removing it.

Sometimes that means explicitly constraining it.

Don't tell me the vulnerability.

Don't give me hints yet.

Challenge my assumptions.

Tell me where my reasoning is incomplete without revealing the answer.

Introduce another requirement.

Make the architecture more complicated.

Show me the code and make me explain what it does.

Now we're doing something useful.

From Vulnerability Recognition to Security Reasoning

This approach has gradually shifted what I want from AppSec training.

I care less about whether I can recognize a textbook vulnerability.

I care more about whether I can reason through an unfamiliar system.

Can I reconstruct its trust model?

Can I follow data through the application?

Can I distinguish authentication from authorization?

Can I identify assumptions embedded in code?

Can I determine which assumptions become exploitable?

Can I explain the impact?

Can I propose a mitigation that actually fits the architecture?

Can I write that mitigation correctly?

And can I communicate the entire chain of reasoning clearly enough that another person doesn't have to make the same automatic assumptions I did?

Most importantly, can I still do those things when the application doesn't look anything like the example I learned from?

That is the capability I want to develop.

AI as a Force Multiplier for Deliberate Practice

AI obviously has limitations.

Generated code can be unrealistic.

Scenarios can contain inconsistencies.

Security explanations can be wrong.

An AI model confidently agreeing with an analysis does not make that analysis correct.

That means traditional sources still matter: documentation, standards, source code, testing, experimentation, and independent verification.

AI isn't my source of truth.

It is part of the training environment.

And it offers something static educational resources generally cannot provide on demand:

Infinite variations.

I can take one security concept and explore it repeatedly.

Change the language.

Change the architecture.

Change the authentication mechanism.

Change the attacker.

Change the business requirements.

Change one trust relationship.

Add another service.

Remove a security control.

Now solve it again.

And again.

Eventually I'm not trying to remember what the answer was last time.

I'm applying the underlying principle to a system I haven't seen before.

That turns a single concept into deliberate practice.

The Most Useful Prompt Might Be "Challenge Me"

There is plenty of discussion about how AI can make technical work faster.

For learning, I'm increasingly interested in the opposite question:

How can AI make the work harder in useful ways?

Give me incomplete information.

Make me ask questions.

Give me code without telling me what's wrong.

Give me an architecture and make me find the trust boundaries.

Make me implement the security control.

Challenge my assumptions.

Challenge my explanation even when my conclusion is correct.

Then explain what I missed.

Then change the scenario and make me prove that I understood why I missed it.

That approach doesn't outsource the thinking.

It creates more opportunities to practice it.

And for application security, where every new application presents a different combination of code, architecture, business logic, trust relationships, and human assumptions, the ability to reason through unfamiliar systems may be one of the most important skills we can develop.

AI doesn't have to be the thing that gives us the answer.

Sometimes its most useful role is making sure we have earned it.

← Back to the blog