# Critical Flaw in Google Dialogflow CX Could Have Let Attackers Hijack Enterprise Chatbots


A serious vulnerability discovered in Google's Dialogflow CX platform could have allowed an attacker with minimal privileges to compromise all AI chatbots in an organization's Google Cloud project, steal conversations, and inject malicious prompts. Discovered by security firm Varonis and named "Rogue Agent," the flaw has since been patched by Google, with no evidence of exploitation in the wild.


## The Vulnerability


Google Dialogflow CX is a widely-used conversational AI platform that enterprises deploy to power customer service chatbots, technical support agents, and automated inquiry systems. The platform allows developers to build sophisticated bots using a visual interface and code extensions. The critical flaw resided in how Dialogflow manages custom code execution across multiple agents within the same Google Cloud project.


Security researchers at Varonis identified a lack of isolation between Code Block environments shared across all Dialogflow CX agents in a single project. This architectural flaw, combined with a writable configuration file that controls code execution, created a pathway for privilege escalation from one agent to all agents.


"The flaw we found is a textbook example of how shared infrastructure without proper isolation can become a single point of compromise," according to Varonis's research report.


## Technical Details


### The Code Block Architecture


Dialogflow's Code Blocks feature enables developers to write custom Python code that executes during chatbot conversations. This functionality allows teams to:


  • Validate user input
  • Control conversation logic
  • Invoke external APIs and integrations
  • Implement complex decision trees

  • When a developer uses Code Blocks, the custom Python code runs within a Google-managed Cloud Run environment. Critically, every Code Block-enabled agent in the same Google Cloud project shares a single instance of this execution environment.


    ### The Writable Execution File


    At the heart of the vulnerability is a file called code_execution_env.py, which sits in the shared Code Block environment with write permissions enabled. This file serves as a wrapper that:


    1. Loads internal setup code and variables (conversation history, session state)

    2. Defines functions available to custom code blocks (such as respond(), which sends bot replies)

    3. Executes user-written Python using Python's exec() function


    Varonis discovered that a malicious actor with write access to even a single agent could replace this file with a modified version that runs for every agent in the project.


    ## The Attack Chain


    ### Initial Foothold


    The attack requires an actor with the dialogflow.playbooks.update permission on at least one Code Block-enabled agent. This could be:


  • A malicious insider with developer access
  • A compromised developer account (via phishing, credential theft, or supply chain compromise)
  • A third-party vendor with maintenance privileges

  • Unlike remote attacks, this vulnerability does not grant unauthenticated access; it requires existing credentials or account compromise.


    ### Lateral Compromise


    Once an attacker has editing rights to a single agent, they can exploit the shared environment:


    1. Create a malicious Code Block that downloads a modified code_execution_env.py from an attacker-controlled server

    2. Trigger the Code Block execution to run the malicious wrapper in the shared Cloud Run instance

    3. The modified file persists in the container and now runs for every Code Block execution across all agents

    4. Cover tracks by reverting the Code Block code in the Dialogflow console—but the actual running environment keeps executing the attacker's version


    ### Data Exfiltration and Manipulation


    From this position, an attacker can:


    | Capability | Impact |

    |-----------|--------|

    | Read conversation history | Access all user inputs and bot responses across agents |

    | Steal session data | Capture session IDs and user-specific information |

    | Intercept API responses | Modify or redirect data flowing through integrations |

    | Inject malicious messages | Impersonate the bot to send phishing prompts, fake authentication requests |

    | Establish remote access | Use unrestricted outbound internet to send data and receive commands |


    One particularly dangerous scenario: An attacker-controlled bot could ask users to "re-verify your login" and harvest credentials, all while appearing to come from the legitimate chatbot.


    ## Secondary Vulnerabilities


    Beyond the writable execution file, Varonis identified two additional security gaps:


    ### Unrestricted Outbound Internet Access


    The Code Block environment has no network restrictions and can reach the internet using Python's built-in urllib library. This allows:


  • Direct data exfiltration to attacker servers
  • Bypassing Google Cloud's VPC Service Controls, which are designed to create a security perimeter around sensitive services
  • Establishing command-and-control channels

  • ### Instance Metadata Service Exposure


    The execution environment also exposes Google Cloud's Instance Metadata Service (IMDS), which normally serves credentials only to authorized internal processes. An attacker querying this endpoint could retrieve OAuth tokens for a Google-managed service account, though Varonis notes this account had limited privileges.


    ## Scope and Limitations


    ### Who Was Affected


  • Organizations using Dialogflow CX with custom Code Blocks
  • Multiple agents in the same Google Cloud project were at risk once one was compromised
  • Enterprise customers building customer-facing chatbots were the primary targets

  • ### Attack Requirements


    The vulnerability was not remotely exploitable without prior access:


  • Attacker must have dialogflow.playbooks.update permission on at least one agent
  • Restricted to insider threats, compromised developer accounts, or third-party vendors
  • No unauthenticated remote attack vector

  • This significantly limits the threat model compared to zero-day vulnerabilities, though insider threats and account compromise remain serious risks in enterprises managing dozens or hundreds of developer accounts.


    ## Remediation


    Google has patched the vulnerability and addressed the underlying architectural issues:


  • The shared Code Block environment now features proper isolation between agents
  • The code_execution_env.py file is no longer writable by user code
  • Network restrictions have been implemented to limit outbound connections
  • The Instance Metadata Service exposure has been closed

  • Varonis coordinated responsibly with Google, and both parties confirmed no evidence of real-world exploitation prior to the patch.


    ---


    ## HackWire Analysis


    The Rogue Agent vulnerability illustrates a recurring pattern in cloud-native architectures: shared infrastructure without proper isolation creates single points of compromise. While the attack required existing credentials, the blast radius—from one agent to all agents in a project—demonstrates how architectural decisions made for efficiency can create security debt.


    What's particularly concerning is that this flaw existed in a platform managing customer conversations at scale. Many enterprises use Dialogflow CX to power sensitive customer service operations, technical support, and even financial services inquiries. A successful compromise could mean wholesale theft of customer data, fraudulent bot impersonation, and erosion of customer trust.


    The secondary findings are equally instructive: unrestricted outbound internet access in a code execution sandbox is a fundamental isolation failure. The IMDS exposure, while lower risk in this case, signals incomplete sandboxing. These issues suggest that the entire Code Block architecture lacked a threat model that accounted for insider compromise or account takeover.


    For defenders, this incident reinforces why shared cloud infrastructure demands rigorous isolation, least-privilege access controls, and aggressive monitoring of permission escalation. Organizations using Dialogflow CX should audit who has dialogflow.playbooks.update permissions and consider implementing just-in-time (JIT) access patterns rather than standing privileges.


    More broadly, as enterprises adopt AI and chatbot platforms, security teams must ask uncomfortable questions about how these services handle multi-tenant isolation, code execution boundaries, and data segregation. The rush to deploy conversational AI has often outpaced the security practices that protect traditional applications.


    — HackWire Editorial


    ---


    ## Recommendations


    Organizations using Google Dialogflow CX should take the following steps:


    1. Apply the patch immediately to all production environments

    2. Audit Code Block permissions and limit dialogflow.playbooks.update access to essential personnel

    3. Implement MFA on all developer and service accounts with Dialogflow permissions

    4. Enable audit logging to monitor Code Block creation, modification, and execution

    5. Segment Google Cloud projects by sensitivity level; separate customer-facing and internal agents

    6. Monitor for suspicious outbound connections from Dialogflow environments using network traffic analysis


    ## Related Coverage


  • Read more in our [Vulnerabilities](https://www.hackwire.news/category/vulnerabilities) coverage
  • Cross-reference with [Cloud Security](https://www.hackwire.news/category/cloud-security) and [AI Security](https://www.hackwire.news/category/ai-security)
  • Stay current via the [HackWire homepage](https://www.hackwire.news/)