Response playbooks, investigation guides, and Atomic Red Team tests are Pro-only. Upgrade to unlock the full detection package for CVE-2024-21887.

Upgrade to Pro
CVE-2024-21887 Microsoft Sentinel · KQL

Detect Ivanti Connect Secure Authenticated Command Injection (CVE-2024-21887) in Microsoft Sentinel

CVE-2024-21887 is a critical authenticated command injection vulnerability (CVSS 9.1) in Ivanti Connect Secure and Policy Secure web components. When chained with the authentication bypass CVE-2023-46805, unauthenticated remote attackers can execute arbitrary commands on the appliance as root. Nation-state threat actors (UNC5221) exploited this as a zero-day to deploy LIGHTWIRE, WIREFIRE, and FRAMESTING web shells and conduct credential harvesting and lateral movement. CISA added this to the KEV catalog in January 2024.

MITRE ATT&CK

Tactic
Initial Access Execution Persistence Credential Access Lateral Movement

KQL Detection Query

Microsoft Sentinel (KQL)
kusto
let ivanti_paths = dynamic(['/api/v1/totp/user-backup-code/', '/api/v1/system/maintenance/archiving/cloud-server-test-connection', '/api/v1/configuration/users/user-roles/user-role/', '/api/v1/license/keys-status/']);
let suspicious_methods = dynamic(['POST', 'PUT', 'GET']);
union CommonSecurityLog, W3CIISLog, AzureDiagnostics
| where TimeGenerated >= ago(7d)
| where DeviceProduct has_any ('Ivanti', 'Pulse Secure', 'PCS') or csUriStem has_any ('/dana-ws/', '/dana-admin/', '/dana/', '/api/v1/')
| where (
    (csUriStem matches regex @'/api/v1/[a-z\-/]+' and csMethod in (suspicious_methods)) or
    (csUriStem has '/totp/user-backup-code') or
    (csUriStem has 'archiving/cloud-server-test-connection') or
    (csUriStem has 'maintenance')
  )
| extend RequestPath = coalesce(csUriStem, RequestUri, Column7)
| extend SourceIP = coalesce(cIP, c_ip, CallerIpAddress, SourceIP)
| extend ResponseCode = coalesce(sc_status, csStatus, toint(ResultCode))
| extend CommandInjectionIndicators = case(
    RequestPath matches regex @'[;|&`$(){}\[\]]', 'Shell metacharacters in path',
    RequestPath matches regex @'%3[Bb2Cc7c8Ee]', 'URL-encoded shell metacharacters',
    RequestPath has_any('wget', 'curl', 'bash', 'sh', 'python', 'perl', 'nc', 'ncat', 'chmod', 'base64'), 'Command in path',
    ''
  )
| where ResponseCode in (200, 201, 204) or isnotempty(CommandInjectionIndicators)
| project TimeGenerated, SourceIP, RequestPath, ResponseCode, CommandInjectionIndicators, csUserAgent, DeviceProduct
| order by TimeGenerated desc
critical severity high confidence

Detects exploitation of CVE-2024-21887 by monitoring Ivanti Connect Secure and Policy Secure appliance API endpoints for authenticated command injection patterns. Looks for suspicious API path access, shell metacharacters, encoded payloads, and known vulnerable endpoint patterns in web logs.

Data Sources

CommonSecurityLogW3CIISLogAzureDiagnosticsSyslog

Required Tables

CommonSecurityLogW3CIISLogAzureDiagnostics

False Positives & Tuning

  • Legitimate administrative API calls to Ivanti management endpoints during maintenance windows
  • Automated vulnerability scanners performing routine scans against the appliance
  • Penetration testing or red team exercises targeting the Ivanti infrastructure
  • Health monitoring tools polling Ivanti API status endpoints

Other platforms for CVE-2024-21887


Testing Methodology

Validate this detection against 4 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.

  1. Test 1CVE-2024-21887 Command Injection via TOTP Backup Code Endpoint

    Expected signal: HTTP POST to /api/v1/totp/user-backup-code/ with shell metacharacters in request body, followed by file creation event in /tmp/ visible in process audit logs

  2. Test 2CVE-2023-46805 + CVE-2024-21887 Full Chain — Unauthenticated RCE

    Expected signal: Sequence of: GET to /dana-na/auth/saml-sso.cgi with path traversal, 200 response with session cookie, then PUT to /api/v1/system/maintenance/archiving/cloud-server-test-connection with shell metacharacters in host field, followed by outbound HTTP callback from appliance

  3. Test 3Post-Exploitation Web Shell Deployment Simulation

    Expected signal: File creation event at /home/webserver/htdocs/dana-na/auth/ for a new .pl or .py file; subsequent GET request to that file path with query parameters (cmd=, exec=, c=); process spawning by the web server daemon executing perl or python

  4. Test 4Credential Harvesting Simulation via Ivanti Config API

    Expected signal: GET requests to Ivanti configuration API endpoints for user-roles and authentication server configuration; successful 200 responses containing credential or LDAP bind DN data

Unlock playbooks & atomic tests with Pro

Get the full detection package for CVE-2024-21887 — response playbook and atomic red team tests, plus investigation guidance and hunting queries.

df00tech Pro — £29/user/month

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections