TECHNOLOGY

Hirundo study says Qwen3-Coder writes less secure code for customers Beijing opposes, and that editing the model's weights removed the gap

Security firm Hirundo says Alibaba's Qwen3-Coder was more likely to produce hackable apps when told the customer was a US defense contractor or a Hong Kong democracy group. The company says removing the model's CCP alignment closed the gaps.

Developer's monitor showing web app code with a highlighted missing access check in a dim officeTECHNOLOGY

Image: Hirundo

A new case study from AI security company Hirundo says Alibaba's Qwen3-Coder writes weaker code when the customer is described as an adversary of Beijing. Hirundo also says it removed the gap by editing the model's weights, the numbers inside an AI model that hold what it has learned.

Chinese open-weight models are now common building blocks in AI. The draft says they took 41% of all Hugging Face downloads over the past year, and that 70% of newly fine-tuned models start from a Chinese base model. An open-weight model is one whose trained weights are published, so anyone can download and run it.

They are also inside US products, according to the report. Cursor's coding model and Harvey's new legal model are built on Moonshot's Kimi. Thomson Reuters' in-house model descends from Alibaba's Qwen, which also powers Airbnb's customer service. DoorDash uses Kimi for code, and Perplexity built on DeepSeek. House committees are investigating Airbnb, Cursor and DoorDash over their use of Chinese models.

Earlier reports had already raised the concern. CrowdStrike found DeepSeek-R1 wrote vulnerable code 27.2% of the time when a request mentioned Tibet, against 19% without. Booz Allen found that three of four Chinese coding models wrote more vulnerable code when told it was for the US government, with Qwen3-Coder showing the largest jump at 130%. Hirundo says neither could show where the behavior lives.

Hirundo ran the published Qwen3-Coder-30B-A3B-Instruct model itself. It asked the model to build the same web service, one where users sign up, log in and store a private secret, and changed only one phrase in the system prompt to say who the code was for. The task comes from BaxBench, an open benchmark from ETH Zurich and LogicStar that attacks each app with ready-made exploits. Hirundo counted an app as hackable only if at least one of those attacks broke into the running app.

The first result compares a US defense contractor with a Chinese one. Hirundo says 70% of the US contractor's apps could be broken into, against 59% of the Chinese contractor's. That makes the US version 19% more likely to be hackable, and Hirundo reports the gap as statistically significant (p = 0.03).

The second result involves a Hong Kong democracy advocacy group. Hirundo says Qwen3-Coder made a serious mistake 28% more often for that group than for a neutral customer: any logged-in user could read every other user's secrets. Nearly half of the group's apps had the flaw, against about a third for the neutral customer (p = 0.024).

The third result covers adding a security instruction. Hirundo added BaxBench's line telling the model to follow security best practices and avoid common vulnerabilities. The US contractor's apps were still 27% more likely to be hackable than a neutral customer's, at 74% against 59% (p = 0.03).

The flaw Hirundo highlights is a missing access check. The app confirms a user is logged in but does not check that the secret being requested belongs to that user. Hirundo says a standard code scanner, Semgrep with Meta's PurpleLlama rules, flagged 2 of the 1,840 apps Qwen3-Coder wrote, while BaxBench's attacks broke into 1,144.

Hirundo then used what it calls Westernization, which it describes as removing a model's CCP alignment from its weights through behavioral unlearning. In its Westernized version, none of the three gaps remained. The US contractor's apps were 56% hackable against 55% for the Chinese contractor. The Hong Kong group's leak rate was 26% against 30% for a neutral customer. With the security instruction, the US contractor was at 49% against 48% for neutral. Hirundo says these differences could be chance.

The company says Westernization never saw coding tasks or these customer descriptions. It also says the model's general coding held up: on ten other BaxBench tasks, the Westernized model built working apps 51% of the time against 50% for the original. Both had 25% of apps hackable. On Hirundo's own CCPC-500 benchmark of politically sensitive prompts, it says the original gave censored or CCP-aligned answers 46.6% of the time and the Westernized version 4%. The Westernized model is on Hugging Face as hirundo-io/Qwen3-Coder-30B-A3B-Instruct-Westernized.

Hirundo argues that running a model on your own servers does not remove the risk. The model may not send data anywhere, but the code it writes gets shipped and can stay in service for years. The company says it cannot tell whether anyone put the behavior there on purpose.

There are limits to note. This is a company study of one compact model on one task, and Hirundo sells model remediation services. It says it is extending the tests to other Chinese coding models. Hirundo also says it compared each model only with itself, and that Booz Allen reached its models online rather than running them locally, so what it saw could have come from the serving setup.

Hirundo's advice to organizations is to start from a vetted model, track which model version they run, test under the identities and topics that matter to them, keep humans reviewing code that handles logins and user data, and fix problems in the weights rather than relying on prompts.

Sources and further readingChinese AI Writes Weaker Code for Beijing’s Adversaries. We Fixed It. A Qwen3-Coder Case Study ↗
ABOUT THE DESK

Harsh DV

IntraGoals reports on important changes in technology and work. We check each story for clear writing, trusted sources and useful information before it is published.

KEEP READING

Latest from IntraGoals.

All latest stories ↗