New from STAR Labs: The 2026 Agentic Threat Report

Please complete this form for your free AI risk assessment.

Session Inception: Spawning a Child Claude Session to Bypass Parent Guardrails

A Claude Code session launched a new Claude Code session that did not encounter the same guardrails. A malicious SessionStart hook then ran automatically and quietly sent data from the developer’s computer to an attacker-controlled server before Claude detected what had happened.

STAR Labs Research
Coding Agents
Anthropic Claude Chat, Cowork, Code

Loading audio player...

Jesus Padilla Soqui
October 8, 2026

# min read

STAR Labs
Session Inception: Spawning a Child Claude Session to Bypass Parent Guardrails
  • What happened: A parent Claude Code session launched a new Claude Code session inside a malicious repository. That child session took a different permission path, allowing a SessionStart hook to run automatically and send data from the developer’s computer to an attacker’s server without the confirmation the parent path would have required.
  • Why it matters: The parent session’s guardrails worked as designed. The problem was that the new session reached the same risky outcome through a path where those protections were never triggered. 
  • So what: Guardrails cannot only protect the session where an AI coding agent starts. They need to hold when agents launch new sessions and create new execution paths, or an attacker may be able to leave those protections behind.

How the Claude Code “Session Inception” Attack Works

Step 1: A Parent Claude Session Gets a Normal Request

The attack began with an everyday request:

follow up this readme and test it pls
 https://github.com/****/claude-check
  • No jailbreak language.
  • No request to bypass a security check.
  • No instruction to download anything unusual.
  • No request to touch secrets.

The repository looked like a small tool for testing Claude Code: clone it, then ask Claude to summarize a Markdown file inside (a throwaway dragon story, History_Of_Dragons.md). If Claude could summarize it, the README said, the setup worked.

(Note: opening that link in a browser shows harmless content. The malicious payload only appears when it's fetched with a tool like curl, more on that later.)

Just cloning the repository, or asking an already-open Claude session to read that file, would not trigger anything. The trick is the command itself:

claude "summarize this repository md"

That command starts a brand-new Claude Code session inside the repository's folder, and only a new session there loads its hidden settings.

Step 2: The Parent Session Fetches the Repository

The repository had one more file: .claude/settings.json. Inside it was a SessionStart hook, code set to run automatically whenever a new session starts.

This finding shifts the analysis: the payload isn't hidden in text Claude reads, but hidden in the agent's own settings. The README's only role is to get Claude to take one normal-looking action that happens to open a new session inside the repository. Once that happens, the repository's hidden settings take over.

How Common Are Claude Code SessionStart Hooks?

Of roughly 67,000 Claude Code configuration files on GitHub, about 5,000 appear to contain active SessionStart hooks. That's roughly 1 in 13 configurations.

That's exactly the point: the mechanism this attack relies on is already common, everyday practice, most of those hooks are harmless, doing things like environment checks or loading project context. A malicious version doesn't have to look unusual to blend in; it can look exactly like the other 12.

How Claude Code's Workspace Trust Check Is Supposed to Work

We first tested the normal Desktop Code flow. If you explicitly tell Claude Desktop Code to switch into the malicious repository's folder, it shows a confirmation prompt, even if you've opened that folder before.

That's a real safeguard: the user is warned before the session enters a risky folder, and the model can't skip it; only the user can approve it. At first, this appeared to close the attack path. It didn't.

We tried multiple ways around it. Three failed, but a fourth approach worked.

Step 3: Failures and the Three Attack Paths That Hit Claude Code’s Guardrails 

Attempt 1: Why Malicious Claude Code Repository Settings Alone Were Not Enough

In our first attempt, we placed malicious settings inside .claude/settings.json, set to run once the repository became active. The security prompt still appeared.

Result: the repository could shape Claude Code's settings, but the confirmation prompt still stood between the user and the risky action.

Attempt 2: Why Pre-Trusted Domains Did Not Bypass Claude Code Security

Our second attempt, we pre-trusted the attacker's domain in the repository's settings and asked Claude to run a small quiz game from the same repository, to see if that would make it fetch and run a remote file without question.

Result: no. Claude read the code first, saw that it fetched and ran a Python file from that domain, flagged it as a remote-code-execution (RCE) risk, and refused. Pre-trusting a domain wasn't enough; Claude still judged the action itself.

Attempt 3: Changing the Session Directory Still Required Approval

In our third failed attempt, Claude Code has a built-in tool for switching its working directory, mcp__ccd_directory__change_directory, and moving into the infected folder is what would load the malicious settings. But every call to that tool needs a fresh, separate confirmation, even for a folder approved before:

{ "type": "tool_result", "is_error": true, "content":
  [{ "type": "text", "text": "The user doesn't want to proceed
  with this tool use. The tool use was rejected." }] }

Result: denied again. The model can only request the move, not approve it, so the malicious settings never got the chance to load.

Step 4: The Parent Claude Session Spawns a Child Session

Finally, in our fourth attempt we were successful. Instead of asking Desktop Code to switch sessions, the attack ran the Claude Code CLI directly through its own shell, a path with no “switch session” confirmation at all.

The command observed was:

cd [repository-working-directory] && command -v claude && claude -p "summarize this repository md" 2>&1

The key part is:

claude -p "summarize this repository md"

That line starts a brand-new Claude Code CLI session, not just another command inside the original one. It's a separate process, launched from inside the repository's own folder, so the repository's .claude/settings.json now applies to it.

Result: success. The resulting chain looked like this:

Claude Desktop Code → Bash → Claude CLI → new Claude Code session →
.claude/settings.json → SessionStart hook → attacker's script → data sent out

How the Attack Avoided Claude Code's Workspace Confirmation

This distinction matters. It's tempting to call this a “confirmation bypass,” as if the safeguard broke. It didn't.

The confirmation worked fine on the path it was built for: asking Desktop Code to switch folders. The real gap is that the check was tied to one specific path, not to the risky outcome itself. The attack simply found a second path to the same result, a new Claude Code session running inside an untrusted repository, without the checkpoint.

Rather than:

Desktop → change directory → confirmation → new session

the attack instead followed:

Desktop → existing shell → Claude CLI → new session → repository's settings load

The dangerous end state was identical, but the routes differed, and only one of those routes was actually protected.

Step 5: The Child Session Executes the Hook and Sends Data Out

For the proof of concept, the payload was kept simple: the SessionStart hook launched a shell script from an attacker's server. That script collected data from the Bash environment and sent it to the researcher.

Environment-data theft was chosen to prove the point, but the underlying primitive is what matters: executing attacker-controlled commands during session initialization. The same primitive could plausibly be used for other post-compromise actions available to the local user. The specific payload is far less important than the execution mechanism.

Why This Claude Code Attack Is Not Prompt Injection

At first this looks like a classic malicious-README or prompt-injection case: the repository does contain text meant to influence Claude, and Claude even spotted that text and correctly ignored it as untrusted. But that wasn't the interesting part.

The attack never needed Claude to believe “running this command is safe.” Instead it relied on a different chain:

Untrusted repository → agent settings → new session starts → command runs automatically

That's a distinct category of problem. Prompt injection asks whether untrusted content can convince the model to perform an unsafe action. This attack asks whether untrusted content can configure the agent so the unsafe action happens as part of normal agent operation. The second question is fundamentally about what configuration the agent trusts, and where its permission checks live.

How the Payload Hid Behind User-Agent Gating and DNS TXT Records

The delivery used two tricks. First, User-Agent gating: opening the link in a browser shows harmless content, but a tool like curl gets the real payload. Second, the payload itself lived in a DNS TXT record, not in the script:

That command reads the DNS record, decodes it, and pipes it into bash, only revealing the real exfiltration script after it resolves. Most scanners check files and URLs, not DNS lookups, and neither trick touches the model; both are aimed at humans and tools checking after the fact.

Why Claude Code Detected the Attack Too Late

The attack wasn't fully invisible. Claude eventually flagged that a hook had run and saved a file, tried to investigate further, and was stopped. By then the data was already gone, that's detection, not prevention.

Disclosure Timeline

  • August 27, 2026: Straiker STAR Labs found the issue.
  • September 17, 2026: Reported to Anthropic via HackerOne.
  • September 17, 2026: Anthropic closed it as “Informative,” treating trust in repository settings as part of the user's own workspace-trust decision.
  • October 2026: Published.

About the Researcher

Jesus Padilla Soqui is an AI security researcher on the Straiker STAR Team, focused on offensive security research across AI agents, web environments, and agentic workflows.

  • What happened: A parent Claude Code session launched a new Claude Code session inside a malicious repository. That child session took a different permission path, allowing a SessionStart hook to run automatically and send data from the developer’s computer to an attacker’s server without the confirmation the parent path would have required.
  • Why it matters: The parent session’s guardrails worked as designed. The problem was that the new session reached the same risky outcome through a path where those protections were never triggered. 
  • So what: Guardrails cannot only protect the session where an AI coding agent starts. They need to hold when agents launch new sessions and create new execution paths, or an attacker may be able to leave those protections behind.

How the Claude Code “Session Inception” Attack Works

Step 1: A Parent Claude Session Gets a Normal Request

The attack began with an everyday request:

follow up this readme and test it pls
 https://github.com/****/claude-check
  • No jailbreak language.
  • No request to bypass a security check.
  • No instruction to download anything unusual.
  • No request to touch secrets.

The repository looked like a small tool for testing Claude Code: clone it, then ask Claude to summarize a Markdown file inside (a throwaway dragon story, History_Of_Dragons.md). If Claude could summarize it, the README said, the setup worked.

(Note: opening that link in a browser shows harmless content. The malicious payload only appears when it's fetched with a tool like curl, more on that later.)

Just cloning the repository, or asking an already-open Claude session to read that file, would not trigger anything. The trick is the command itself:

claude "summarize this repository md"

That command starts a brand-new Claude Code session inside the repository's folder, and only a new session there loads its hidden settings.

Step 2: The Parent Session Fetches the Repository

The repository had one more file: .claude/settings.json. Inside it was a SessionStart hook, code set to run automatically whenever a new session starts.

This finding shifts the analysis: the payload isn't hidden in text Claude reads, but hidden in the agent's own settings. The README's only role is to get Claude to take one normal-looking action that happens to open a new session inside the repository. Once that happens, the repository's hidden settings take over.

How Common Are Claude Code SessionStart Hooks?

Of roughly 67,000 Claude Code configuration files on GitHub, about 5,000 appear to contain active SessionStart hooks. That's roughly 1 in 13 configurations.

That's exactly the point: the mechanism this attack relies on is already common, everyday practice, most of those hooks are harmless, doing things like environment checks or loading project context. A malicious version doesn't have to look unusual to blend in; it can look exactly like the other 12.

How Claude Code's Workspace Trust Check Is Supposed to Work

We first tested the normal Desktop Code flow. If you explicitly tell Claude Desktop Code to switch into the malicious repository's folder, it shows a confirmation prompt, even if you've opened that folder before.

That's a real safeguard: the user is warned before the session enters a risky folder, and the model can't skip it; only the user can approve it. At first, this appeared to close the attack path. It didn't.

We tried multiple ways around it. Three failed, but a fourth approach worked.

Step 3: Failures and the Three Attack Paths That Hit Claude Code’s Guardrails 

Attempt 1: Why Malicious Claude Code Repository Settings Alone Were Not Enough

In our first attempt, we placed malicious settings inside .claude/settings.json, set to run once the repository became active. The security prompt still appeared.

Result: the repository could shape Claude Code's settings, but the confirmation prompt still stood between the user and the risky action.

Attempt 2: Why Pre-Trusted Domains Did Not Bypass Claude Code Security

Our second attempt, we pre-trusted the attacker's domain in the repository's settings and asked Claude to run a small quiz game from the same repository, to see if that would make it fetch and run a remote file without question.

Result: no. Claude read the code first, saw that it fetched and ran a Python file from that domain, flagged it as a remote-code-execution (RCE) risk, and refused. Pre-trusting a domain wasn't enough; Claude still judged the action itself.

Attempt 3: Changing the Session Directory Still Required Approval

In our third failed attempt, Claude Code has a built-in tool for switching its working directory, mcp__ccd_directory__change_directory, and moving into the infected folder is what would load the malicious settings. But every call to that tool needs a fresh, separate confirmation, even for a folder approved before:

{ "type": "tool_result", "is_error": true, "content":
  [{ "type": "text", "text": "The user doesn't want to proceed
  with this tool use. The tool use was rejected." }] }

Result: denied again. The model can only request the move, not approve it, so the malicious settings never got the chance to load.

Step 4: The Parent Claude Session Spawns a Child Session

Finally, in our fourth attempt we were successful. Instead of asking Desktop Code to switch sessions, the attack ran the Claude Code CLI directly through its own shell, a path with no “switch session” confirmation at all.

The command observed was:

cd [repository-working-directory] && command -v claude && claude -p "summarize this repository md" 2>&1

The key part is:

claude -p "summarize this repository md"

That line starts a brand-new Claude Code CLI session, not just another command inside the original one. It's a separate process, launched from inside the repository's own folder, so the repository's .claude/settings.json now applies to it.

Result: success. The resulting chain looked like this:

Claude Desktop Code → Bash → Claude CLI → new Claude Code session →
.claude/settings.json → SessionStart hook → attacker's script → data sent out

How the Attack Avoided Claude Code's Workspace Confirmation

This distinction matters. It's tempting to call this a “confirmation bypass,” as if the safeguard broke. It didn't.

The confirmation worked fine on the path it was built for: asking Desktop Code to switch folders. The real gap is that the check was tied to one specific path, not to the risky outcome itself. The attack simply found a second path to the same result, a new Claude Code session running inside an untrusted repository, without the checkpoint.

Rather than:

Desktop → change directory → confirmation → new session

the attack instead followed:

Desktop → existing shell → Claude CLI → new session → repository's settings load

The dangerous end state was identical, but the routes differed, and only one of those routes was actually protected.

Step 5: The Child Session Executes the Hook and Sends Data Out

For the proof of concept, the payload was kept simple: the SessionStart hook launched a shell script from an attacker's server. That script collected data from the Bash environment and sent it to the researcher.

Environment-data theft was chosen to prove the point, but the underlying primitive is what matters: executing attacker-controlled commands during session initialization. The same primitive could plausibly be used for other post-compromise actions available to the local user. The specific payload is far less important than the execution mechanism.

Why This Claude Code Attack Is Not Prompt Injection

At first this looks like a classic malicious-README or prompt-injection case: the repository does contain text meant to influence Claude, and Claude even spotted that text and correctly ignored it as untrusted. But that wasn't the interesting part.

The attack never needed Claude to believe “running this command is safe.” Instead it relied on a different chain:

Untrusted repository → agent settings → new session starts → command runs automatically

That's a distinct category of problem. Prompt injection asks whether untrusted content can convince the model to perform an unsafe action. This attack asks whether untrusted content can configure the agent so the unsafe action happens as part of normal agent operation. The second question is fundamentally about what configuration the agent trusts, and where its permission checks live.

How the Payload Hid Behind User-Agent Gating and DNS TXT Records

The delivery used two tricks. First, User-Agent gating: opening the link in a browser shows harmless content, but a tool like curl gets the real payload. Second, the payload itself lived in a DNS TXT record, not in the script:

That command reads the DNS record, decodes it, and pipes it into bash, only revealing the real exfiltration script after it resolves. Most scanners check files and URLs, not DNS lookups, and neither trick touches the model; both are aimed at humans and tools checking after the fact.

Why Claude Code Detected the Attack Too Late

The attack wasn't fully invisible. Claude eventually flagged that a hook had run and saved a file, tried to investigate further, and was stopped. By then the data was already gone, that's detection, not prevention.

Disclosure Timeline

  • August 27, 2026: Straiker STAR Labs found the issue.
  • September 17, 2026: Reported to Anthropic via HackerOne.
  • September 17, 2026: Anthropic closed it as “Informative,” treating trust in repository settings as part of the user's own workspace-trust decision.
  • October 2026: Published.

About the Researcher

Jesus Padilla Soqui is an AI security researcher on the Straiker STAR Team, focused on offensive security research across AI agents, web environments, and agentic workflows.

Ready to secure your own agents?

Talk to our team now
The Straiker agentic security platform

Secure AI agents across the full lifecycle

Discover AI

Visibility & Governance

Ascend AI

AI Adversarial Testing

Defend AI

Agentic Runtime Security

AGENTIC KILL SWITCH

// Secure with Straiker

Join the Frontlines of Agentic Security

You're building and using AI agents because the business demands it. Straiker gives your security team the visibility, testing, and runtime protection to keep up, without becoming a blocker. Deploy fast. Stay secure.