/

CVE-2026-71278

Severity:

CRITICAL RISK

(9.8)

Code Injection (CWE-94) in rust-iot-platform Calc Rules

CVE-2026-71278

Deferred

Vulnerability type

Category:

Code Injection

CWE:

CWE-94

Impact:

Unauthenticated arbitrary JavaScript execution

Severity:

CRITICAL RISK

(9.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

rust-iot-platform exposes an unauthenticated endpoint that accepts and stores arbitrary scripts as calculation rules. When a malicious rule is triggered, the server evaluates the script without sandboxing, allowing an attacker to execute arbitrary JavaScript within the server process.

Affected context

The vulnerability occurs in deployments where the calc-rule creation route is reachable without authentication and accepts a caller-controlled script field. Stored rules are later evaluated by the calculation runtime through a JavaScript engine without an effective sandbox or equivalent execution boundary.

Exploit preconditions

  • Attack surface: HTTP API endpoint for creating calculation rules
  • Required access: Network access to the endpoint; authentication is not required by the affected route
  • Trigger point: Execution of a stored calculation rule by the server
  • Why exploitation is possible: User-controlled script content is passed to an unsandboxed JavaScript evaluator and runs in the server process

Why this happens

The underlying flaw is a failure to treat submitted calculation logic as untrusted code. The application accepts arbitrary script content, does not consistently enforce its authentication guard on the creation route, and later evaluates that content using quick_js::Context::eval() without a sufficient sandbox. This behavior maps to CWE-94: Improper Control of Generation of Code, because externally controlled input is treated as executable program logic.

Potential impact

  • An unauthenticated attacker may execute arbitrary JavaScript in the server process
  • The attacker could access application data or runtime capabilities exposed to the JavaScript context
  • Application availability and integrity may be affected
  • Server-side compromise could enable further access depending on process privileges and deployment isolation

General mitigation guidance

Mitigation generally focuses on removing unauthenticated access to rule-management functions and eliminating the execution of unrestricted user-supplied code.

Common defensive patterns include:

  • Enforcing authentication and authorization consistently on all calculation-rule routes
  • Replacing arbitrary scripts with a constrained expression language or predefined operations
  • Applying strict allowlists, schemas, and length limits to rule definitions
  • Using a capability-limited execution environment with explicit resource and API restrictions when dynamic evaluation is unavoidable
  • Running the service with least privilege and isolating calculation workers from sensitive systems
  • Treating stored rules as untrusted data throughout their lifecycle

How teams detect issues like this

Organizations can detect similar issues through:

  • Static analysis rules identifying dynamic evaluation APIs such as eval and embedded scripting engines
  • Code review checks for request handlers that accept executable content
  • Route and middleware analysis to identify endpoints missing authentication or authorization guards
  • API inventory tests that verify protected operations reject unauthenticated requests
  • Runtime monitoring for unexpected rule creation, script execution, and unusual calculation activity
  • Policy enforcement that prohibits unrestricted code execution from externally controlled input

Automated code review and security scanning tools may help identify dynamic execution and missing access-control patterns early.

Sources

SourceLink
github.comgithub.com/iot-ecology/rust-iot-platform

Frequently asked

questions

Yes. The affected rule-creation endpoint is reachable over the application API without authentication, allowing a network-accessible attacker to submit a malicious rule.

The attacker generally needs network access to the API endpoint. The affected route does not require the AuthToken guard used by other application routes.

Require authentication and authorization for rule management, and avoid evaluating arbitrary user-supplied scripts. Prefer constrained, allowlisted calculation behavior.

Apply access-control middleware consistently, treat stored scripts as untrusted input, prohibit unrestricted dynamic evaluation, and isolate any unavoidable scripting runtime with least privilege and strict resource boundaries.

Find out what's already
exploitable in your codebase.