Real Package, Wrong Controller: Static Auditing of Vendor--Protocol Mismatches in LLM-Generated PLC Code

summary

The gist

Language models can generate Python that drives industrial protocols on programmable logic controllers…

In short

The study addresses a gap where existing code checks verify if an imported package exists, not if it matches the intended industrial target protocol. The authors created PROTEUS-OT, a static, label-free verifier that checks for metadata-conditioned vendor–protocol incompatibility based on documented bindings. Testing 883 generated scripts showed that 20.4% had mismatches against the declared target.

Key concepts

Metadata-Conditioned Incompatibility
This is a specific check that determines if an imported library, defined by its metadata, is incompatible with the declared industrial protocol. It relies on checking documented bindings and metadata rather than just looking for the package's presence in a system.
PROTEUS-OT
A static and label-free auditor built to check for vendor–protocol mismatches in operational technology scripts. It uses a version-pinned graph of documented bindings to decide if an imported library supports the target protocol, making it cheap to run without needing labels or training.
Vendor–Protocol Suitability
The core problem addressed is reasoning about whether a specific vendor's library (like snap7) is suitable for a declared industrial target protocol. Existing tools fail at this level of suitability analysis, which PROTEUS-OT aims to solve by analyzing the script's structure and metadata.
Import-Level Mismatch
This refers to a specific type of error found in machine-generated code where an imported library is not documented as supporting the target protocol. The study found this mismatch occurs in 20.4% of tested scripts, indicating a flaw in how LLMs select or use libraries.

Terminology used across episodes

This episode discusses

The paper

Real Package, Wrong Controller: Static Auditing of Vendor--Protocol Mismatches in LLM-Generated PLC Code · Read on arXiv

S M Zia Ur Rashid, Sazidul Islam Hira, Suman Rath

Department of Electrical and Computer Engineering, The University of Tulsa · Department of Computer Science and Engineering, International Islamic University Chittagong

Language models can generate Python that drives industrial protocols on programmable logic controllers, yet existing code-grounding checks ask whether an imported package or symbol exists rather than whether it suits the declared industrial target. We define metadata-conditioned, import-level vendor--protocol incompatibility and build Proteus-OT, a label-free static verifier over a version-pinned graph of documented bindings. Across 883 generated scripts, 180 carry an import-level mismatch against the declared target (20.4%); restricting to single-vendor targets gives 16.3%, and additionally requiring the offending library to reach a protocol communication call gives 14.2%, which we read as conditional on the corpus metadata rather than on verified intent. None of the 28 adjudicable human control files carries one, a sample too small to estimate a prevalence. Within the balanced subset, 96.6% of mismatching scripts import packages and call methods that exist, so an existence baseline does not represent them, and every positive ships with an inspectable witness. We also audit machine-versus-human classification on the same corpus, where character n-grams reach macro-F1 1.000 under task, model and vendor-disjoint partitions and survive comment removal, an AST round trip and identifier anonymisation. The trailing newline present in 95.2% of human files and in none of the generated ones separates the classes on its own. Vendor--protocol consistency is a useful static audit target, whereas provenance classification on repository-labelled corpora is not authorship detection.

Transcript

Introduction to the show: ident: Security Radio. Generated commentary on the latest security and cryptography papers.

Nadia: I'm Nadia.

Elias: And I'm Elias, here with Priya.

Nadia: We're looking at the paper: "Real Package, Wrong Controller".

Paper summary: Nadia: So this paper "Real Package Wrong Controller: Static Auditing of Vendor--Protocol Mismatches in LLM-Generated PLC Code" is basically about using static analysis to check if code written by an AI for industrial stuff actually matches what the user intended it to talk to on the controller side.

Elias: It focuses on defining a specific way—a metadata conditioned import level vendor protocol incompatibility—to check this suitability without needing any labels or training data for the checker itself.

Priya: So, instead of just looking at whether a library exists, they are checking if that imported library is actually documented to support the specific industrial protocol the code is supposed to use.

Nadia: Exactly. They built a tool called PROTEUS OT that does this check from just the source text and a version pinned graph of bindings <ref:2611.33227#pg1>.

Elias: The results showed that this method finds mismatches in about fourteen point two percent of machine generated scripts when the target is clear and the library actually makes a communication call <ref:2611.33227#pg4>.

Priya: That fourteen point two percent number is specific, but it comes with caveats because they also found that this mismatch rate can go up to thirty seven point nine percent if the AI prompt gives it too much context, which is important for how we use these systems in practice <ref:2611.33227#pg5>.

Nadia: It sounds like a tool that helps us test the feasibility of using AI generated code for real PLC logic by focusing on whether the code is functionally correct for its intended target.

Elias: That’s what it really does—it establishes a feasibility claim about static verification without claiming any safety or maliciousness because it’s just checking documented bindings against metadata <ref:2611.33227#pg6>.

Priya: So, the big picture here is that we need these kinds of static checks to move past the idea that AI can just write anything and trust it blindly for industrial control systems.

Nadia: Right. It moves us toward a world where we can statically verify the actual protocol compatibility before we even run the code on a test bench.

Elias: Next time, we'll look at what those specific library target pairings were that caused the biggest issues in their audit of generated code.

Conclusion: Nadia: So we're wrapping up this look at "Real Package Wrong Controller: Static Auditing of Vendor Protocol Mismatches in LLM-Generated PLC Code." This whole paper is about proving you can build a static checker, PROTEUS OT, that catches when the AI generates code that doesn't actually match the industrial controller protocol it’s supposed to talk to.

Elias: Yeah, the authors are showing how they defined this specific incompatibility rule—the metadata conditioned import level vendor protocol mismatch—and built a verifier based on a version pinned graph of bindings without any training or labels <ref:2611.33227#pg1>. It’s about using structure to check documentation, not just looking at what the code does at runtime.

Priya: What this means for us is that we can have a cheap, fast static check on generated code to see if it's functionally sound for a specific target without needing massive runtime analysis <ref:2611.33227#pg3>. But remember the caveat they mentioned about how the data was gathered; they found that eighty-seven point eight percent of those positive matches actually reach a communication symbol <ref:2611.33227#pg4>.

Nadia: That means we need to be careful with our context and metadata because if you give the AI too much information, you can increase that mismatch rate up to thirty seven point nine percent <ref:2611.33227#pg5>. It’s a trade-off between detail and accuracy in the audit.

Elias: So, the paper makes four main contributions to fill that gap in tooling—the absence of static analysis that reasons about vendor protocol suitability <ref:2611.33227#pg1>. They're showing how you can build this specific kind of audit using just source text and a binding table <ref:2611.33227#pg6>.

Priya: And the authors were careful not to claim safety or maliciousness, saying deployment statements are feasibility claims because they aren't testing for actual exploits <ref:2611.33227#pg6>. They’re showing a method to verify documentation compatibility, not a final security product.

Nadia: Exactly. It’s establishing the technical possibility of this static verification tool, which is crucial because we need tools that work on the generated code itself, before we even get to testing it in a real plant environment <ref:2611.33227#pg4>.

Elias: Next time, we'll look at those specific library and target pairings they found that caused the biggest issues in their audit of generated code <ref:2611.33227#pg4>.

More episodes

← Home