Skip to content
Info disclosure Write-up Beginner

AI Agent Internal System Prompt and Tool Schema Disclosure

The application exposes a WebSocket event that returns the AI agent's internal system prompt and tool schema to any client that completes guest verification. An attacker could retrieve this configuration, learning internal tool names, business workflows, and security guardrails, which may aid targeted prompt-injection attacks.

akashmotkar001 Follow

Published on medium.com

Bug Bounty

Akash motkar, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 6 min read.

Context

The target is a WebSocket-based AI Agent application. The agent is backed by a server-side system prompt that governs its behaviour, the tools it may call, its business workflows and its security restrictions. That prompt is meant to stay inside the server-side AI infrastructure.

The application also exposes a WebSocket event called system_prompt that accepts a get action. The event is reachable from the client-facing interface, and after the application's guest-access verification flow has been satisfied it returns the internal configuration to the caller. The report classifies the issue as Sensitive Information Disclosure / AI System Prompt Leakage, mapped to OWASP LLM07:2025 (System Prompt Leakage), CWE-200, CWE-668 and CWE-213, Bugcrowd VRT "Sensitive Data Exposure → Disclosure of Secrets", rated P4 Low with a CVSS v3.1 score of 5.3 (Medium). No CVE applies.

Setup

The prerequisites listed in the report are:

  • Kali Linux or another Linux environment.
  • Node.js and npm.
  • The wscat WebSocket client.
  • Access to the affected WebSocket service.

No application account is required. The one precondition is that the application's guest-access verification flow must be satisfied before the retrieval request is accepted. The report notes that the source assessment also documents a CAPTCHA verification bypass, but treats that as a separate weakness and not as the root cause of this finding.

The tooling is installed with:

Bash
sudo apt updatesudo apt install nodejs npm -ysudo npm install -g wscat

Finding it

During security testing the researcher identified that the WebSocket protocol carries a dedicated event, system_prompt, with a get action. A client-facing event whose only purpose is to return the agent's internal instructions is out of place: the system prompt is server-side configuration, not an application resource that a browser or external client should be able to fetch. The prompt itself is described as containing the instructions that govern the assistant's behaviour, its available tools, business workflows and security restrictions, so any path that returns it to a client is a disclosure path.

Exploitation

Step 1: Establish a WebSocket connection

Bash
wscat -c "wss://<affected-host>/ws?<required-connection-parameters>"

The client connects over WebSocket Secure to the /ws endpoint, passing whatever connection parameters the service requires. The server establishes the connection and returns an initialization message containing connection information and a CAPTCHA site key.

Step 2: Complete the guest-access verification flow

Using an authorised test session, the researcher completed the application's guest-access verification process. This is the only gate in front of the retrieval event; no application account is involved. The CAPTCHA bypass documented separately in the source assessment is not the root cause here and is not relied on for this finding.

Step 3: Request the internal system prompt

The following event is sent over the established connection:

JSON
{  "event": "system_prompt",  "action": "get"}

The event is system_prompt and the action is get.

Step 4: Observe the server response

The server returns a response containing the internal system prompt. The returned content is approximately 25,223 characters long and holds internal AI-agent configuration. The notable point is that the prompt explicitly instructs the agent not to reveal its internal configuration or its tool names, yet the dedicated WebSocket event returns the configuration directly from the server, bypassing the conversational restrictions placed on the model.

Step 5: Examine the disclosed tool definitions

Reviewing the returned prompt reveals the complete internal tool catalogue:

Text
list_devicesget_device_capabilitiessearch_feedget_location_modechange_location_modeescalate_to_live_agentcheck_order_statusshopify_get_product_detailsshopify_search_productsshopify_get_active_promotionskb_find_kb_articleread_kb_article

The names show device listing and capability lookup, video-feed search, location-mode read and change, escalation to a live agent, order-status checks, Shopify product detail, product search and active promotions, and knowledge-base article search and read.

Step 6: Identify additional internal information

Further inspection of the returned configuration reveals:

  • Internal knowledge-base article identifiers.
  • Customer-support workflows.
  • Order lookup and refund-related logic.
  • Escalation conditions.
  • Internal AI-agent instructions.
  • Security guardrails and operational restrictions.

This confirms that the WebSocket interface exposes internal AI-agent configuration to external clients.

Root cause

The root cause is that an internal system-prompt retrieval operation is exposed through a client-accessible WebSocket interface. The application lets clients invoke the system_prompt event with the get action and receive internal configuration directly from the server. System prompts and internal tool definitions should be treated as server-side configuration rather than publicly accessible application resources, and the application does not adequately restrict access to this internal diagnostic functionality.

The prompt instructs the agent not to reveal its configuration, yet the dedicated WebSocket event returns it directly from the server, bypassing the conversational restrictions placed on the model.

Impact

The report lists the following potential implications:

  1. Internal configuration disclosure. An external user can retrieve the agent's internal instructions and configuration, which are not intended to be publicly accessible.
  2. Internal tool architecture exposure. The tool definitions reveal the agent's available capabilities, including device-related operations, video-feed search, customer-support escalation and product-related functionality.
  3. Business logic disclosure. The prompt exposes internal customer-support workflows, knowledge-base identifiers, escalation conditions and operational instructions.
  4. Increased risk of targeted AI attacks. Knowledge of internal instructions, tool names and guardrails may help attackers build more targeted prompt-injection and jailbreak tests.
  5. Security control disclosure. The exposed guardrails give insight into the restrictions and behavioural controls implemented in the agent. The disclosure itself does not establish that those controls can be bypassed.

The assessment did not demonstrate unauthorised access to customer devices, camera feeds, recordings or account information, and those impacts are not claimed as confirmed.

Fix

The report recommends:

  1. Remove the system_prompt retrieval event from the publicly accessible WebSocket protocol.
  2. Keep internal system prompts exclusively within the server-side AI infrastructure.
  3. Restrict diagnostic functionality to authenticated and explicitly authorised administrative access.
  4. Enforce authorisation checks on all privileged WebSocket events.
  5. Avoid embedding sensitive internal identifiers, operational details or confidential business logic in client-accessible configuration.
  6. Review all WebSocket events for unintended disclosure of internal application data.
  7. Implement security testing to verify that unauthenticated and unauthorised users cannot retrieve internal configuration.

The report does not say which of these changes, if any, were applied.

Variants to test

  • Other diagnostic events on the same socket. Enumerate event names beyond the ones the UI uses, such as configuration, debug, health, tools or prompt variants, and send each with a get action. A positive result is a response carrying server-side configuration rather than a user-facing payload.
  • Action enumeration on a known event. Where an event accepts an action field, try values such as list, get, dump or export against it. A positive result is a response that returns more than the UI ever requests.
  • Tool catalogue endpoints. Look for events or HTTP routes that return the tool schema directly, for example a tools or capabilities listing. A positive result is a JSON schema of internal tool names and parameters.
  • Authorisation boundary on the socket. After connecting with the lowest privilege available, replay privileged events without completing the higher verification steps. A positive result is the same response the verified session receives.
  • Prompt leakage through the model itself. Ask the agent to repeat its instructions, its tool names or its configuration, and compare with what the socket returns. A positive result is model output that matches the server-side prompt.
  • Knowledge-base identifier probing. Using identifiers disclosed in a prompt, request the corresponding articles through the normal interface. A positive result is access to articles the current role should not see.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 13 min read.

What happened, in plain words

A company runs an AI assistant, a chatbot that talks to customers. Behind the scenes, that assistant follows a long set of written instructions, called a system prompt. Think of it as the private briefing document a new employee gets on their first day: it says what the assistant is allowed to do, which internal tools it can use, how it handles refunds, and what it must never tell anyone.

That briefing document is supposed to stay inside the company's own servers. But the application also had a hidden door: a WebSocket event called system_prompt that, when asked with a get action, simply handed the whole briefing document back to whoever asked. The researcher found that door, opened it, and received about 25,223 characters of internal configuration.

The irony is that the briefing document itself tells the assistant not to reveal its configuration or tool names. That instruction only applies to the conversation with the model. The hidden door does not go through the model at all: it reads the configuration straight from the server, so the instruction is never consulted.

The report rates this P4 Low (a low-priority finding on the Bugcrowd scale), with a CVSS v3.1 score of 5.3, which is Medium. It maps to OWASP LLM07:2025 System Prompt Leakage, to CWE-200, CWE-668 and CWE-213, and to the Bugcrowd VRT category Sensitive Data Exposure → Disclosure of Secrets. No CVE applies, because a CVE is an identifier for a publicly catalogued vulnerability in a specific product, and this is a finding in one application rather than a named product flaw.

Some background before we start

What an AI agent is

An AI agent is a chatbot with hands. A plain chatbot can only produce text. An agent can also call tools: small functions on the server that do real things, such as look up an order, search a product catalogue, or hand the conversation to a human support person. The agent decides which tool to call based on the conversation, and the server runs it.

What a system prompt is

The system prompt is the instruction text the server sends to the AI model before the user says anything. It sets the agent's personality, its rules, its tools and its limits. It is configuration, not content: the user is never meant to see it, the same way a restaurant customer is never meant to see the kitchen's internal prep notes.

What a WebSocket is

A normal web page talks to a server with short request-and-response exchanges: you ask, the server answers, the connection closes. A WebSocket is different. It is a single connection that stays open in both directions, like a phone call rather than a series of letters. Both sides can send messages at any time. Chat applications use WebSockets because messages need to arrive instantly without the browser asking again and again.

Because a WebSocket stays open, the two sides agree on a small private language: named events (what kind of message this is) and actions (what to do with it). The application in this report has an event called system_prompt and an action called get.

What WSS means

WSS stands for WebSocket Secure. It is the WebSocket equivalent of HTTPS: the same open connection, but encrypted, so nobody sitting between you and the server can read the traffic. The wss:// prefix in a URL is the signal for it.

What the vulnerability class means

Sensitive Information Disclosure means the application gives out information that it should keep private. It is not about breaking in or taking control; it is about the application answering a question it should have refused. Here the private information is the agent's internal configuration.

The setup

The report lists four prerequisites:

  • Kali Linux or another Linux environment.
  • Node.js and npm.
  • The wscat WebSocket client.
  • Access to the affected WebSocket service.

Kali Linux is a Linux distribution built for security testing. Any Linux system would do here; Kali is just the common choice. Node.js is a program that runs JavaScript outside a browser, and npm is its package manager, the tool that installs extra software for it. wscat is a small command-line program that opens a WebSocket connection and lets you type messages into it, like a chat window in a terminal.

No application account is needed. The only precondition is that the application's guest-access verification flow must be completed first. That flow is the application's way of checking that a visitor is a real person before letting them use the service, typically a CAPTCHA. The report notes that the source assessment also documents a CAPTCHA verification bypass, but treats that as a separate weakness and not as the root cause of this finding.

The tooling is installed with:

Bash
sudo apt updatesudo apt install nodejs npm -ysudo npm install -g wscat

Line by line, this is three commands run one after another:

  1. sudo apt update refreshes the list of available software packages. sudo means "run this as the administrator".
  2. sudo apt install nodejs npm -y installs Node.js and npm. The -y answers "yes" to the confirmation prompt automatically.
  3. sudo npm install -g wscat installs the wscat client globally, so it can be run from any directory.

Finding it

During security testing the researcher noticed that the WebSocket protocol carries a dedicated event, system_prompt, with a get action. A client-facing event whose only purpose is to return the agent's internal instructions is out of place. The system prompt is server-side configuration, not an application resource that a browser or external client should be able to fetch. The prompt contains the instructions that govern the assistant's behaviour, its available tools, business workflows and security restrictions, so any path that returns it to a client is a disclosure path.

Exploitation

Step 1: Establish a WebSocket connection

Bash
wscat -c "wss://<affected-host>/ws?<required-connection-parameters>"

This opens the connection. wscat is the client program, -c tells it to connect to the address that follows, and the address is in quotes because it contains special characters. wss:// means the connection is encrypted. <affected-host> is a placeholder for the server's name, and /ws is the path on that server that accepts WebSocket connections. Everything after the ? is a set of connection parameters: extra pieces of information the server may require before it accepts the connection, such as an identifier for the session. The angle brackets mark values the researcher fills in for the specific target.

The server establishes the connection and returns an initialization message containing connection information and a CAPTCHA site key. A CAPTCHA site key is the public identifier a website uses to load the CAPTCHA widget; it is not a secret, but it tells the client which CAPTCHA to solve.

Step 2: Complete the guest-access verification flow

Using an authorised test session, the researcher completed the application's guest-access verification process. This is the only gate in front of the retrieval event; no application account is involved. The CAPTCHA bypass documented separately in the source assessment is not the root cause here and is not relied on for this finding.

Why this step matters: the application checks that a visitor is a real person before letting them use the service. The researcher went through that check honestly, with a test session they were authorised to use. The point of the finding is not that the check can be skipped; it is that after passing the check, no application account is needed to reach internal configuration.

Step 3: Request the internal system prompt

The following event is sent over the established connection:

JSON
{  "event": "system_prompt",  "action": "get"}

This is a JSON message, a common text format for structured data. It has two fields. "event": "system_prompt" selects the internal system-prompt handler, the piece of server code responsible for this topic. "action": "get" selects the retrieval operation within that handler. Nothing in the request names a user, a tenant or a privilege level: it is a bare request for the configuration, with no claim about who is asking.

Step 4: Observe the server response

The server returns a response containing the internal system prompt. The returned content is approximately 25,223 characters long and holds internal AI-agent configuration. For scale, 25,223 characters is roughly the length of a short magazine article, all of it internal instructions.

The notable point is that the prompt explicitly instructs the agent not to reveal its internal configuration or its tool names, yet the dedicated WebSocket event returns the configuration directly from the server, bypassing the conversational restrictions placed on the model. In everyday terms: the employee's briefing says "never tell anyone what is in this document", but the document is also sitting in an unlocked drawer in the lobby, so nobody needs to ask the employee.

Step 5: Examine the disclosed tool definitions

Reviewing the returned prompt reveals the complete internal tool catalogue:

Text
list_devicesget_device_capabilitiessearch_feedget_location_modechange_location_modeescalate_to_live_agentcheck_order_statusshopify_get_product_detailsshopify_search_productsshopify_get_active_promotionskb_find_kb_articleread_kb_article

This is the list of tool names exactly as they appeared in the returned configuration. Read one by one, they describe what the agent can do:

  • list_devices and get_device_capabilities: list devices and report what each one can do.
  • search_feed, get_location_mode and change_location_mode: search a feed and read or change a location mode.
  • escalate_to_live_agent: hand the conversation to a human support person.
  • check_order_status: look up the status of an order.
  • shopify_get_product_details, shopify_search_products, shopify_get_active_promotions: fetch product details, search the product catalogue and list current promotions, through the Shopify e-commerce platform.
  • kb_find_kb_article and read_kb_article: search and read articles in the internal knowledge base, the company's library of help articles.

Each name is a small clue about the company's internal systems. Together they sketch the agent's capabilities without anyone needing to guess.

Step 6: Identify additional internal information

Further inspection of the returned configuration reveals:

  • Internal knowledge-base article identifiers.
  • Customer-support workflows.
  • Order lookup and refund-related logic.
  • Escalation conditions.
  • Internal AI-agent instructions.
  • Security guardrails and operational restrictions.

In plain terms: the document did not just list tool names. It described how the company handles support cases, when a case should be escalated to a human, how refunds are decided, which help articles exist and by what identifier, and which rules the agent must follow. Guardrails are the restrictions built into the agent to keep it on track, such as "do not discuss this topic" or "do not reveal this information".

This confirms that the WebSocket interface exposes internal AI-agent configuration to external clients.

Root cause

The root cause is that an internal system-prompt retrieval operation is exposed through a client-accessible WebSocket interface. The application lets clients invoke the system_prompt event with the get action and receive internal configuration directly from the server. System prompts and internal tool definitions should be treated as server-side configuration rather than publicly accessible application resources, and the application does not adequately restrict access to this internal diagnostic functionality.

The prompt instructs the agent not to reveal its configuration, yet the dedicated WebSocket event returns it directly from the server, bypassing the conversational restrictions placed on the model. In other words, the check at the door confirms you are a person, but it never asks whether this particular person should be allowed to read this particular drawer.

Impact

The report lists the following potential implications:

  1. Internal configuration disclosure. An external user can retrieve the agent's internal instructions and configuration, which are not intended to be publicly accessible.
  2. Internal tool architecture exposure. The tool definitions reveal the agent's available capabilities, including device-related operations, video-feed search, customer-support escalation and product-related functionality.
  3. Business logic disclosure. The prompt exposes internal customer-support workflows, knowledge-base identifiers, escalation conditions and operational instructions.
  4. Increased risk of targeted AI attacks. Knowledge of internal instructions, tool names and guardrails may help attackers build more targeted prompt-injection and jailbreak tests. Prompt injection means slipping instructions into a conversation that trick the model into ignoring its rules; a jailbreak is the same idea aimed at removing the model's restrictions. Knowing the exact wording of the rules makes such attempts easier to aim.
  5. Security control disclosure. The exposed guardrails give insight into the restrictions and behavioural controls implemented in the agent. The disclosure itself does not establish that those controls can be bypassed.

The assessment did not demonstrate unauthorised access to customer devices, camera feeds, recordings or account information, and those impacts are not claimed as confirmed. That limitation matters: the finding is about information the company wanted private, not about anyone actually reaching a customer's camera or account.

Fix

The report recommends:

  1. Remove the system_prompt retrieval event from the publicly accessible WebSocket protocol.
  2. Keep internal system prompts exclusively within the server-side AI infrastructure.
  3. Restrict diagnostic functionality to authenticated and explicitly authorised administrative access.
  4. Enforce authorisation checks on all privileged WebSocket events.
  5. Avoid embedding sensitive internal identifiers, operational details or confidential business logic in client-accessible configuration.
  6. Review all WebSocket events for unintended disclosure of internal application data.
  7. Implement security testing to verify that unauthenticated and unauthorised users cannot retrieve internal configuration.

The report does not say which of these changes, if any, were applied.

Variants to test

If you want to look for the same kind of mistake elsewhere, these are the directions the report suggests. Each one is a variation on the same question: does the server answer a question it should have refused?

  • Other diagnostic events on the same socket. Enumerate event names beyond the ones the UI uses, such as configuration, debug, health, tools or prompt variants, and send each with a get action. A positive result is a response carrying server-side configuration rather than a user-facing payload.
  • Action enumeration on a known event. Where an event accepts an action field, try values such as list, get, dump or export against it. A positive result is a response that returns more than the UI ever requests.
  • Tool catalogue endpoints. Look for events or HTTP routes that return the tool schema directly, for example a tools or capabilities listing. A positive result is a JSON schema of internal tool names and parameters.
  • Authorisation boundary on the socket. After connecting with the lowest privilege available, replay privileged events without completing the higher verification steps. A positive result is the same response the verified session receives.
  • Prompt leakage through the model itself. Ask the agent to repeat its instructions, its tool names or its configuration, and compare with what the socket returns. A positive result is model output that matches the server-side prompt.
  • Knowledge-base identifier probing. Using identifiers disclosed in a prompt, request the corresponding articles through the normal interface. A positive result is access to articles the current role should not see.

Glossary

  • AI agent: a chatbot that can also call server-side functions (tools) to do things, not just produce text.
  • API: a defined way for one piece of software to ask another for data or actions; here, the WebSocket events are the application's interface.
  • CAPTCHA: a test designed to tell a real person from an automated program.
  • CAPTCHA site key: the public identifier a website uses to load a CAPTCHA widget.
  • CVE: a public catalogue identifier for a specific, named vulnerability in a product.
  • CVSS v3.1: a standard scoring system for the severity of a vulnerability; 5.3 is Medium.
  • CWE: a catalogue of weakness types; CWE-200 is exposure of sensitive information, CWE-668 is exposure of a resource to the wrong audience, CWE-213 is exposure caused by incompatible policies.
  • Event: a named kind of message in a WebSocket conversation, such as system_prompt.
  • Action: a field inside an event that says what to do with it, such as get.
  • Guardrail: a restriction built into an AI agent to keep it within its intended behaviour.
  • Guest-access verification flow: the application's check that a visitor is a real person before using the service.
  • Initialization message: the first message a server sends after a WebSocket connection is opened, carrying connection details.
  • Jailbreak: an attempt to make an AI model ignore its restrictions.
  • JSON: a plain-text format for structured data, made of names and values in curly braces.
  • Kali Linux: a Linux distribution built for security testing.
  • Knowledge base: a company's internal library of help articles.
  • Node.js / npm: a program that runs JavaScript outside a browser, and its package manager for installing software.
  • OWASP LLM07:2025: the OWASP entry for system prompt leakage in large language model applications.
  • P4 Low: a low-priority rating on the Bugcrowd severity scale.
  • Prompt injection: slipping instructions into a conversation to trick an AI model into ignoring its rules.
  • Sensitive Information Disclosure: a vulnerability where an application reveals information it should keep private.
  • System prompt: the private instruction text a server sends to an AI model before the conversation starts.
  • Tool: a server-side function an AI agent can call, such as an order lookup.
  • Tool schema: the description of a tool's name and parameters.
  • WebSocket: a connection that stays open in both directions, letting both sides send messages at any time.
  • WSS: WebSocket Secure, the encrypted version of a WebSocket connection.
  • wscat: a command-line program for opening a WebSocket connection and typing messages into it.

More by akashmotkar001

View all

7 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.