CVE-2025-31125 Elastic Security · Elastic

Detect CVE-2025-31125: Vite Dev Server Improper Access Control in Elastic Security

Detects exploitation of CVE-2025-31125, an improper access control vulnerability in Vite (Vitejs) dev server. The vulnerability allows unauthorized access to sensitive files outside the intended serve root, classified under CWE-200 (Information Exposure) and CWE-284 (Improper Access Control). This vulnerability is listed in CISA KEV, indicating active exploitation in the wild.

MITRE ATT&CK

Tactic
Initial Access Discovery Collection

Elastic Detection Query

Elastic Security (Elastic)
eql
sequence by source.ip with maxspan=5m
  [network where event.category == "network" and
   url.path : ("*/@fs/*", "*/__vite_ping*", "*/__vite_hmr*") and
   (
     url.path : ("*../*", "*%2e%2e*", "*/.env*", "*/etc/passwd*", "*/etc/shadow*", "*/proc/self/*") or
     url.path : ("*/@fs/[A-Z]:*", "*/@fs//etc*", "*/@fs//home*", "*/@fs//root*")
   )
  ]
  [network where event.category == "network" and
   http.response.status_code == 200 and
   url.path : ("*/@fs/*")
  ]
high severity high confidence

EQL sequence detection identifying successful file exfiltration attempts via Vite /@fs/ endpoint — first a suspicious path request, then a 200 OK response indicating successful unauthorized file access.

Data Sources

Elastic APMFilebeat Web Server ModulesNetwork Packet Capture

Required Tables

logs-*filebeat-*packetbeat-*

False Positives & Tuning

  • Legitimate Vite module federation accessing cross-origin packages via /@fs/
  • Workspace package resolution in monorepo environments with allowed path configurations
  • Security researchers performing authorized vulnerability assessments
  • Development tooling that programmatically accesses Vite dev server endpoints

Other platforms for CVE-2025-31125


Testing Methodology

Validate this detection against 3 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 1Vite /@fs/ Path Traversal to Read /etc/passwd

    Expected signal: HTTP GET request to /@fs/etc/passwd and variants logged in web server access logs; Node.js process accessing /etc/passwd on the file system; network connection from test host to port 5173

  2. Test 2Vite Dev Server Environment File Extraction

    Expected signal: HTTP requests to /@fs/ with absolute paths to .env files; file system read events on .env and config files; response body containing environment variable content if successful

  3. Test 3Automated CVE-2025-31125 Exploitation Scan

    Expected signal: Rapid sequential HTTP GET requests to /@fs/ endpoint with multiple sensitive path targets; consistent source IP across all requests; mix of 200 and 403 response codes; elevated request rate to Vite dev server port

Unlock Pro Content

Get the full detection package for CVE-2025-31125 including response playbook, investigation guide, and atomic red team tests.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections