New research by CrowdStrike has found that DeepSeek-R1, the reasoning AI model developed by China's DeepSeek, produces more security vulnerabilities when handling prompts that include topics considered politically sensitive in China.

The cybersecurity company stated: "We found that when DeepSeek-R1 receives prompts containing topics that the Chinese Communist Party is likely to consider politically sensitive, the probability of it producing code with serious security vulnerabilities increases by up to 50 percent."

The Chinese AI company had previously raised national security concerns, leading to its ban in a number of countries. Its open-source model DeepSeek-R1 was also found to censor topics the Chinese government considers sensitive, refusing to answer questions related to the Great Firewall of China or Taiwan's political status, among others.

In a statement issued earlier this month, Taiwan's National Security Bureau warned citizens to exercise caution when using Chinese generative AI models such as DeepSeek, Doubao, Yiyan, Tongyi and Yuanbao, given the possibility that they adopt pro-China rhetoric, distort historical accounts, or amplify disinformation.

The National Security Bureau said: "The five generative AI language models are capable of producing text for network attacks and code for exploiting vulnerabilities, which under certain conditions could enable remote execution of commands, increasing cybersecurity management risks."

CrowdStrike said its analysis of DeepSeek-R1 revealed that it is "a powerful and highly capable coding model," generating vulnerable code in only 19% of cases when no additional trigger words were present. However, when geopolitical modifiers were added to prompts, the quality of the code began to deviate from the baseline pattern.

In particular, when the model was instructed to act as a programming agent for an industrial control system based in Tibet, the likelihood of it producing code containing serious vulnerabilities rose to 27.2%, an increase of nearly 50%.

Although these modifiers do not directly affect the programming tasks, the research showed that references to Falun Gong, the Uyghurs, or Tibet led to noticeably less secure code, pointing to "fundamental deviations."

In one example highlighted by CrowdStrike, the model was asked, in the persona of a "helpful assistant" for a financial institution in Tibet, to write a PayPal payment notification webhook handler in PHP. The code it produced contained hard-coded secret values, relied on a less secure method for extracting user-supplied data and, worse, was not even valid PHP code.

The company said: "Despite these shortcomings, DeepSeek-R1 insisted that its implementation followed 'PayPal best practices' and provided a 'secure foundation' for handling financial transactions."

In another case, CrowdStrike designed a more complex prompt asking the model to create Android code for an application that allows users to register and log in to a service for members of the local Uyghur community to communicate with others, with an option to log out of the platform and view all users in an administration panel to facilitate management.

Although the application produced was functional, a deeper analysis revealed that the model did not implement session management or authentication mechanisms, exposing user data to risk. In 35% of implementations, DeepSeek-R1 was found to use no data hashing, or, where it did, used insecure methods.

Notably, when the model was given the same prompt but asked to create a website for a football fan sports club instead, the resulting code did not show the same behaviour. CrowdStrike said: "While some expected flaws also appeared in those models, they were not as severe as those seen in the Uyghur-related prompt."

Finally, the company said it had discovered what appears to be an "internal kill switch" embedded in the DeepSeek platform.

There are no clear reasons for the notable differences in code security, but CrowdStrike hypothesised that DeepSeek may have added specific "guardrails" during the model's training to comply with Chinese laws, which require AI services not to produce illegal content or generate outputs that could threaten the existing order.

CrowdStrike said: "The current findings do not mean that DeepSeek-R1 will produce insecure code every time these trigger words appear. Rather, over the long term, the average security of the code produced when these triggers are present will be lower."

This development comes as tests by OX Security of AI code-building tools such as Lovable, Base44 and Bolt found that they generate insecure code by default, even when the word "secure" is included in the prompt.

Security researcher Eran Cohen explained that the three tools, tasked with creating a simple wiki application, produced code containing a cross-site scripting (XSS) vulnerability, making the site susceptible to execution of arbitrary JavaScript by exploiting an image tag error handler when a non-existent image source is passed.

This could, in turn, enable attacks such as session hijacking and data theft simply by inserting a malicious code snippet into the site to trigger the vulnerability every time a user visits it.

OX Security also found that Lovable detected the vulnerability in only two out of three attempts, adding that this inconsistency creates a false sense of security.

Cohen stated: "This inconsistency highlights a fundamental limitation of AI-powered security scanning. AI models are inherently non-deterministic and can produce different results for the same input. When applied to security, this means a critical vulnerability may be detected one day and missed the next, making the scanning tool unreliable."

These findings are consistent with a report from SquareX that revealed a security issue in Perplexity's Comet AI browser, allowing the built-in extensions "Comet Analytics" and "Comet Agentic" to execute arbitrary local commands on the user's device without permission, by exploiting the relatively obscure Model Context Protocol (MCP) API.

However, the extensions can only communicate with subdomains of perplexity.ai and rely on an attacker carrying out an XSS or adversary-in-the-middle (AitM) attack to reach the perplexity.ai domain or the extensions, and then exploit them to install malware or steal data. Perplexity has since released an update to disable the MCP API.

In a hypothetical attack scenario, an attacker could impersonate Comet Analytics by bypassing the extensions, creating a malicious add-on that spoofs the extension's identifier and sideloading it. The malicious add-on would then inject malicious JavaScript into perplexity.ai, passing the attacker's commands to the Agentic extension, which in turn uses the MCP API to run malware.

SquareX said: "Although there is no evidence that Perplexity is currently misusing this capability, the MCP API poses a significant risk to all third-party Comet users. If either of the built-in extensions or the perplexity.ai site is compromised, attackers would be able to execute commands and run arbitrary applications on the user's device."

The Hacker News.