Skip to content
RCE Write-up Advanced

CVE-2026–39980 Analysis and POC

The safeEjs.ts file did not properly sanitise EJS templates, allowing users with the 'Manage customization' capability to run arbitrary JavaScript in the OpenCTI platform process during notifier template execution. An attacker could achieve remote code execution.

medium.com

Published on medium.com

I have read a lot of blogs about vulnerability analysis and exploitation, and always wanted to dive deep into 0-days and develop a POC for a 0-day/CVE with NO public exploit, YET!

Yousof Nahya, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the code assumed that a key used in the template context was always a string, but when an object was supplied, its toString method could be abused to access the Function constructor and execute arbitrary code.

Impact

An attacker with the 'Manage customization' capability could execute arbitrary commands on the server, leading to full compromise.

What the attacker needed

Access to OpenCTI with 'Manage customization' capability

The fix

The fix was to cast the key to a string in the createSafeContext function, preventing the type confusion.

How it was found

  1. Deploy OpenCTI version 6.9.4 using Docker.
  2. Access the create notifier functionality.
  3. Submit a crafted EJS template payload that exploits the type confusion.
  4. The payload executes a command on the server, demonstrating remote code execution.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

EJS is a template engine that lets you embed JavaScript in templates. If the template engine is not properly sandboxed, a user who can create templates can make the server run their JavaScript, which can lead to taking over the server.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.