SOCFortress CoPilot: Painless Script Injection via mitre_field

An authenticated user with the analyst role closes a string literal through the mitre_field parameter and places their own Painless code in the aggregation script that CoPilot sends to the Wazuh indexer.

Advisory ID: TP-2026-159
Product: SOCFortress CoPilot (open-source platform for security operations and incident response)
Vulnerability type: Code injection into a Painless script (CWE-94)
CVE: not requested
CVSS 3.1: 5.4 (Medium) · CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:L
Affected versions: before v0.1.91 (verified: v0.1.80, commit c392772)
Fixed in: v0.1.91
Reported: 11 July 2026

Summary

SOCFortress CoPilot is an open-source platform for security operations and incident response; its FastAPI backend queries the Wazuh indexer (OpenSearch), among other systems. Two endpoints of the MITRE alert search accept the query parameter mitre_field, which overrides the name of the index field holding the MITRE IDs. The backend places the value unvalidated into a Painless script by f-string and sends that script to the indexer as an aggregation script. A single quote closes the string literal doc['...'], and everything after it is Painless code. An authenticated account with the analyst role thereby controls the source of a script in the search request that CoPilot sends to the indexer.

Root cause

Line numbers refer to v0.1.80: _build_mitre_search_query builds the script by f-string with def field_value = doc['{mitre_field}'].value; (backend/app/connectors/wazuh_manager/services/mitre.py:862) and sends it as {"script": {"source": script_source, "lang": "painless"}} inside a terms aggregation (backend/app/connectors/wazuh_manager/services/mitre.py:887).
The value comes from the query parameter mitre_field: Optional[str] = Query(None, ...) with no pattern and no allow-list (backend/app/connectors/wazuh_manager/routes/mitre.py:400, backend/app/connectors/wazuh_manager/routes/mitre.py:461).
The service puts the caller's value first in the list of fields to try with field_options.insert(0, mitre_field) (backend/app/connectors/wazuh_manager/services/mitre.py:492, backend/app/connectors/wazuh_manager/services/mitre.py:947).
Both routes require only require_any_scope("admin", "analyst") (backend/app/connectors/wazuh_manager/routes/mitre.py:392, backend/app/connectors/wazuh_manager/routes/mitre.py:452).
The identifier validation that CoPilot has for Velociraptor queries in backend/app/connectors/velociraptor/utils/validation.py is not applied on this path.

Proof of Concept

GET /api/wazuh_manager/mitre/techniques/alerts?mitre_field=f'].value; def ANALYST_PWN=1; def q=doc['x HTTP/1.1
Authorization: Bearer <token of an account with the analyst role>

HTTP/1.1 200

_search request sent by CoPilot to the indexer (excerpt):
"script": {"source": "def field_value = doc['f'].value; def ANALYST_PWN=1; def q=doc['x'].value; ...", "lang": "painless"}

The ' ends the literal doc['...'], the following statement stands in the script as separate Painless code, and def q=doc['x reabsorbs the rest of the template. Verified on v0.1.80 with the token of an account holding the analyst role: the indexer connector pointed to a recording test server, and the _search request sent by CoPilot contained the injected statement verbatim as Painless source. Execution inside a Wazuh indexer itself was not observed, because the test setup contained none.

Impact

  • An account with the analyst role controls the source of a Painless aggregation script that the Wazuh indexer processes on behalf of the CoPilot service account.
  • Aggregation results and error messages of the script reveal field values from the queried indices.
  • Expensive scripts put load on the indexer; Painless runs in a sandbox in the default configuration, and the search context offers no write access to documents.

References

Is Something Like This in Your Software?

Our team found this vulnerability during its work. Have your applications tested by the same specialists, with a penetration test from turingpoint.