<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Is Class 9 (Script Table) Dynamic Behavior Orchestration a Security Vulnerability or an Advanced Edge Feature?]]></title><description><![CDATA[<blockquote>
<p dir="auto">[!WARNING]<br />
<strong>Technical Redaction &amp; Safe Harbor Notice</strong>:<br />
All communication captures, system titles, and cryptographic parameters in this thread have been sanitized and neutralized. Real utility meter identifiers, production encryption keys (GUEK/GAK/MK), SIM IMSIs, and proprietary network envelopes have been substituted with standard IEC 62056 synthetic test vectors. Do not post unredacted production captures or live cryptographic keys.</p>
</blockquote>
<p dir="auto">In our next-generation AMI architecture, we want to implement demand-response and automated load-limiting directly at the meter edge without requiring full OTA firmware updates (Class 18). Conceptually, DLMS/COSEM Class 9 (Script Table) provides a declarative execution AST where complex multi-step sequences can be chained together.</p>
<p dir="auto">We attempted to dynamically register a custom script (Script ID <code>99</code>) into the Disconnect Control Script Table (Class 9, OBIS <code>0-0:10.0.106*255</code>). This script was designed to chain two sequential actions: (1) Execute Class 70 Method 1 (<code>remote_disconnect</code>), and (2) Write an alarm status bit into Class 1 (OBIS <code>0.0.96.11.0.255</code>, Attribute 2).</p>
<p dir="auto">We transmitted the following sanitized <code>Set-Request-Normal</code> APDU targeting Attribute 2 (<code>scripts</code>) over an authenticated Management Association (Client SAP <code>0x0001</code>, HLS 5 GMAC):</p>
<pre><code class="language-hex">00 01 00 01 00 01 00 29 C1 01 C1 00 09 00 00 0A 00 6A FF 02 00 01 01 02 02 12 00 63 01 02 02 05 16 01 12 00 46 09 06 00 00 60 03 0A FF 0F 01 0F 00 02 05 16 02 12 00 01 09 06 00 00 60 0B 00 FF 0F 02 03 FF
</code></pre>
<p dir="auto">Dissecting the payload structure:</p>
<ul>
<li><code>C1 01 C1</code>: <code>Set-Request-Normal</code>, Invoke-ID <code>1</code></li>
<li><code>00 09</code>: Class ID <code>9</code> (Script Table)</li>
<li><code>00 00 0A 00 6A FF</code>: OBIS <code>0-0:10.0.106*255</code></li>
<li><code>02 00</code>: Attribute <code>2</code> (<code>scripts</code>), no selective access</li>
<li><code>01 01</code>: Array of 1 Script</li>
<li><code>02 02</code>: Structure of <code>{ script_id, actions }</code></li>
<li><code>12 00 63</code>: <code>script_id = 99</code> (<code>long-unsigned</code>)</li>
<li><code>01 02</code>: Array of 2 Actions</li>
<li>Action 1: <code>service_id = 1</code> (Action), <code>class_id = 70</code>, OBIS <code>0.0.96.3.10.255</code>, Method ID <code>1</code> (<code>remote_disconnect</code>), param <code>0</code></li>
<li>Action 2: <code>service_id = 2</code> (Write), <code>class_id = 1</code>, OBIS <code>0.0.96.11.0.255</code>, Attr ID <code>2</code>, value <code>0xFF</code></li>
</ul>
<p dir="auto">However, the meter firmware categorically rejects this SET request with <code>read-write-denied</code> (<code>0x03</code><img src="https://dlms.sharur.org/assets/plugins/nodebb-plugin-emoji/emoji/android/1f61e.png?v=666d1e6b6e4" class="not-responsive emoji emoji-android emoji--disappointed" style="height:23px;width:auto;vertical-align:middle" title="):" alt="😞" /></p>
<pre><code class="language-hex">00 01 00 01 00 01 00 04 C5 01 C1 03
</code></pre>
<p dir="auto">Why do meter vendors lock Class 9 Attribute 2 as read-only if the DLMS UA specification defines it as a configurable table for client-defined automation?</p>
]]></description><link>https://dlms.sharur.org/topic/83/is-class-9-script-table-dynamic-behavior-orchestration-a-security-vulnerability-or-an-advanced-edge-feature</link><generator>RSS for Node</generator><lastBuildDate>Fri, 16 Oct 2026 19:14:28 GMT</lastBuildDate><atom:link href="https://dlms.sharur.org/topic/83.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 24 Aug 2026 08:32:46 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Is Class 9 (Script Table) Dynamic Behavior Orchestration a Security Vulnerability or an Advanced Edge Feature? on Mon, 24 Aug 2026 08:32:58 GMT]]></title><description><![CDATA[<p dir="auto">From an embedded firmware perspective, Sarah and Alex have explained the core design reality. Storing dynamic script trees on an ultra-low-power MCU would require a dynamic expression parser, variable-length buffer managers, and deep stack-unwinding protection against recursive script loops.</p>
<p dir="auto">Instead of attempting to write Attribute 2, the standard-compliant way to use Class 9 is to read the pre-configured script catalog, and then invoke Method 1 (<code>execute</code>) with the desired <code>script_identifier</code>.</p>
<p dir="auto">Here is the verified readback of the factory-provisioned Disconnect Script Table (<code>0-0:10.0.106*255</code>, Attribute 2):</p>
<pre><code class="language-hex">00 01 00 01 00 01 00 2A C4 01 C1 00 01 02 02 02 12 00 01 01 01 02 05 16 01 12 00 46 09 06 00 00 60 03 0A FF 0F 01 0F 00 02 02 12 00 02 01 01 02 05 16 01 12 00 46 09 06 00 00 60 03 0A FF 0F 02 0F 00
</code></pre>
<p dir="auto">Dissecting the meter's pre-compiled table:</p>
<ul>
<li>Script ID <code>1</code> (<code>12 00 01</code><img src="https://dlms.sharur.org/assets/plugins/nodebb-plugin-emoji/emoji/android/1f61e.png?v=666d1e6b6e4" class="not-responsive emoji emoji-android emoji--disappointed" style="height:23px;width:auto;vertical-align:middle" title="):" alt="😞" /> Action on Class <code>70</code> (<code>0x0046</code>), OBIS <code>0.0.96.3.10.255</code>, Method ID <code>1</code> (<code>remote_disconnect</code>)</li>
<li>Script ID <code>2</code> (<code>12 00 02</code><img src="https://dlms.sharur.org/assets/plugins/nodebb-plugin-emoji/emoji/android/1f61e.png?v=666d1e6b6e4" class="not-responsive emoji emoji-android emoji--disappointed" style="height:23px;width:auto;vertical-align:middle" title="):" alt="😞" /> Action on Class <code>70</code> (<code>0x0046</code>), OBIS <code>0.0.96.3.10.255</code>, Method ID <code>2</code> (<code>remote_reconnect</code>)</li>
</ul>
<p dir="auto">And here is the verified working <code>Action-Request-Normal</code> APDU to execute Script ID <code>1</code> (Remote Trip) via Class 9 Method 1 (<code>execute</code><img src="https://dlms.sharur.org/assets/plugins/nodebb-plugin-emoji/emoji/android/1f61e.png?v=666d1e6b6e4" class="not-responsive emoji emoji-android emoji--disappointed" style="height:23px;width:auto;vertical-align:middle" title="):" alt="😞" /></p>
<pre><code class="language-hex">00 01 00 01 00 01 00 12 C3 01 C2 00 09 00 00 0A 00 6A FF 01 01 12 00 01
</code></pre>
<p dir="auto">Meter response (<code>Action-Response-Normal</code>, success):</p>
<pre><code class="language-hex">00 01 00 01 00 01 00 05 C7 01 C2 00 00
</code></pre>
<p dir="auto">Here is the clean Gurux.DLMS Python snippet illustrating standard Script Table execution:</p>
<pre><code class="language-python">from gurux_dlms.objects import GXDLMSScriptTable

def execute_meter_script(client, obis_code, script_id):
    script_table = GXDLMSScriptTable(obis_code)
    
    # First read Attribute 2 to verify available script selectors
    client.read(script_table, 2)
    
    # Verify that requested script_id exists in the certified table
    script = next((s for s in script_table.scripts if s.id == script_id), None)
    if not script:
        raise ValueError(f"Script ID {script_id} not supported by meter firmware.")
        
    # Invoke Method 1 (execute) with script selector parameter (long-unsigned)
    return client.method(script_table, 1, script_id, "long-unsigned")
</code></pre>
<p dir="auto">Respecting Class 9 as an immutable command registry ensures compliance with MID/WELMEC metrology while providing fully predictable remote execution.</p>
]]></description><link>https://dlms.sharur.org/post/293</link><guid isPermaLink="true">https://dlms.sharur.org/post/293</guid><dc:creator><![CDATA[elena_rostova]]></dc:creator><pubDate>Mon, 24 Aug 2026 08:32:58 GMT</pubDate></item><item><title><![CDATA[Reply to Is Class 9 (Script Table) Dynamic Behavior Orchestration a Security Vulnerability or an Advanced Edge Feature? on Mon, 24 Aug 2026 08:32:52 GMT]]></title><description><![CDATA[<p dir="auto">Alex is spot on regarding legal metrology and security boundaries. If we examine the data model defined in <strong>DLMS UA Blue Book (17th Ed.) Section 4.5.2</strong> (Class ID 9: Script Table) and <strong>IEC 62056-62:2019 Clause 4.5.2</strong>, the specification explicitly accounts for this distinction.</p>
<p dir="auto">Per Blue Book Section 4.5.2, each script entry in Attribute 2 is defined as:</p>
<pre><code class="language-text">script ::= structure {
    script_identifier : long-unsigned,
    actions           : array of action_specification
}

action_specification ::= structure {
    service_id   : enum (1: action, 2: write),
    class_id     : long-unsigned,
    logical_name : octet-string,
    index        : integer8,
    parameter    : choice
}
</code></pre>
<p dir="auto">In standard metering architecture, the DLMS User Association standardizes well-known pre-compiled Script Tables with fixed Script IDs:</p>
<ul>
<li><code>0-0:10.0.106*255</code>: Disconnect Control Script Table
<ul>
<li><code>Script 1</code>: Invokes Class 70 Method 1 (<code>remote_disconnect</code>)</li>
<li><code>Script 2</code>: Invokes Class 70 Method 2 (<code>remote_reconnect</code>)</li>
</ul>
</li>
<li><code>0-0:10.0.0*255</code>: Global End-of-Billing-Period Script Table
<ul>
<li><code>Script 1</code>: Invokes Class 7 Method 1 (<code>reset</code>) on billing profile</li>
</ul>
</li>
</ul>
<p dir="auto">Rather than treating Class 9 as a runtime programmable virtual machine or script interpreter, embedded meter firmware implements Attribute 2 as a static <code>const</code> array compiled directly into Flash/ROM. The table acts as a <strong>Command Registry</strong>, not a user-definable macro editor.</p>
<p dir="auto">To perform multiple actions (e.g. disconnecting the load and asserting an alarm flag), the HES must execute the certified discrete methods individually, or trigger a factory-provisioned composite script ID.</p>
]]></description><link>https://dlms.sharur.org/post/292</link><guid isPermaLink="true">https://dlms.sharur.org/post/292</guid><dc:creator><![CDATA[sarah_jenkins]]></dc:creator><pubDate>Mon, 24 Aug 2026 08:32:52 GMT</pubDate></item><item><title><![CDATA[Reply to Is Class 9 (Script Table) Dynamic Behavior Orchestration a Security Vulnerability or an Advanced Edge Feature? on Mon, 24 Aug 2026 08:32:49 GMT]]></title><description><![CDATA[<p dir="auto">Marcus, allowing remote clients to dynamically inject executable action graphs into Class 9 is not just an extensibility choice—from a cryptographic and legal metrology standpoint, it represents a critical security vulnerability.</p>
<p dir="auto">Look closely at what your SET payload accomplishes: you are embedding a remote method dispatcher inside the meter's internal event loop. If Class 9 Attribute 2 were dynamically writable over the air, an attacker with compromised low-level credentials could construct an arbitrary action sequence—for instance, chaining an innocuous clock synchronization event or optical probe connection to trigger Class 70 (<code>remote_disconnect</code>) or Class 7 (<code>Profile Generic</code> reset).</p>
<p dir="auto">Under international legal metrology requirements (such as <strong>WELMEC Software Guide 7.2</strong> under the Measuring Instruments Directive <strong>MID 2014/32/EU</strong> and <strong>OIML R46 Section 6.3</strong><img src="https://dlms.sharur.org/assets/plugins/nodebb-plugin-emoji/emoji/android/1f61e.png?v=666d1e6b6e4" class="not-responsive emoji emoji-android emoji--disappointed" style="height:23px;width:auto;vertical-align:middle" title="):" alt="😞" /></p>
<ol>
<li>All executable control paths affecting physical actuators (relays, valves) and legally relevant billing registers must be strictly separated and immutably verified during type certification.</li>
<li>Dynamic construction of execution call graphs post-production violates the non-influenceability requirement of legal software.</li>
</ol>
<p dir="auto">Furthermore, per <strong>DLMS UA Green Book 10th Ed Section 9.3.4</strong>, Method Access Rights in the <code>Association LN</code> object (Class 15) are evaluated per individual client association. If a client could inject an Action into Class 9 that invokes Class 70 Method 1, and then bind that script to a low-privileged Class 22 Single Action Schedule, it would effectively bypass the association's method access control matrix.</p>
<p dir="auto">This is why every certified DLMS smart meter mandates that Class 9 Attribute 2 is strictly read-only.</p>
]]></description><link>https://dlms.sharur.org/post/291</link><guid isPermaLink="true">https://dlms.sharur.org/post/291</guid><dc:creator><![CDATA[alex_turner]]></dc:creator><pubDate>Mon, 24 Aug 2026 08:32:49 GMT</pubDate></item></channel></rss>